Comments (4)
Okay. I think this is because we use a MPSC channel internally (std::sync::mpsc
) and we check for these messages using if let
instead of while let
. This causes us to only get one message every 500 ms which is very bad. We can fix this in two ways:
- The quick way is changing that
if let
for awhile let
, which I think should work. If it blocks the thread for too long we might have to find a way to make it non-blocking. - Switching our thread-shared state management to use
Arc<Mutex<T>>
orArc<RwLock<T>>
. The switch shouldn't be difficult.
Can you try doing one of this fixes on a local copy of souvlaki and see if it works?
from souvlaki.
Why is conn.process() set to 1000ms by default? In fact why does it even need a duration?
Setting conn.process(Duration::from_millis(0))?;
lets me read playback position in real-time like on zbus
and so far there's no adverse side effects.
from souvlaki.
I also don't get the whole loop{if let}
vs while let
thing. Shouldn't they be functionally equivalent? Where's the 500ms come from?
from souvlaki.
Okay I see what you meant with while let.
diff --git a/src/platform/mpris/dbus/controls.rs b/src/platform/mpris/dbus/controls.rs
index 6aa5123..a59e228 100644
--- a/src/platform/mpris/dbus/controls.rs
+++ b/src/platform/mpris/dbus/controls.rs
@@ -242,10 +242,10 @@ where
}),
);
- loop {
- if let Ok(event) = event_channel.recv_timeout(Duration::from_millis(10)) {
+ 'outer: loop {
+ while let Ok(event) = event_channel.recv_timeout(Duration::from_millis(10)) {
if event == InternalEvent::Kill {
- break;
+ break 'outer;
}
let mut changed_properties = HashMap::new();
To consume all the events at once before processing. That also works. I still find the 1000ms wild though.
from souvlaki.
Related Issues (20)
- PropertiesChanged signal on wrong interface HOT 2
- Using the library without `winit::event_loop` HOT 4
- Support for other platforms HOT 4
- Support HWND directly HOT 2
- Handle Access is denied error on Windows from not running as Administrator HOT 3
- Question about the name HOT 4
- Better error handling HOT 1
- Fetching media playback metadata? HOT 1
- Linux: Volume control HOT 17
- Add some documentation on how `cover_url` is meant to be used HOT 1
- Windows hangs on `MediaControls::set_metadata()` HOT 1
- Linux: Shuffle/Loop
- MediaControls does not implement Debug HOT 1
- Windows: Volume control
- MacOS: Volume control
- [Meta] Git tags and / or a changelog file? HOT 2
- Add MSRV (Minimal Supported Rust Version) HOT 6
- [docs] `SetVolume` says values will be 0.0 to 1.0, but can actually be more HOT 1
- Metadata not updating (linux) HOT 10
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from souvlaki.