forked from mirrors/gstreamer-rs
gstreamer: bus: Handle all previously queued messages too in the BusStream
Before the stream was created, some messages might've been queued on the bus. For more similar behaviour with the bus watch, first pop all the queued messages before handling new messages. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1402>
This commit is contained in:
parent
62973fc83c
commit
7cc1f6cd45
1 changed files with 7 additions and 1 deletions
|
@ -346,7 +346,13 @@ impl BusStream {
|
||||||
|
|
||||||
let (sender, receiver) = mpsc::unbounded();
|
let (sender, receiver) = mpsc::unbounded();
|
||||||
|
|
||||||
bus.set_sync_handler(move |_, message| {
|
bus.set_sync_handler(move |bus, message| {
|
||||||
|
// First pop all messages that might've been previously queued before creating
|
||||||
|
// the bus stream.
|
||||||
|
while let Some(message) = bus.pop() {
|
||||||
|
let _ = sender.unbounded_send(message);
|
||||||
|
}
|
||||||
|
|
||||||
let _ = sender.unbounded_send(message.to_owned());
|
let _ = sender.unbounded_send(message.to_owned());
|
||||||
|
|
||||||
BusSyncReply::Drop
|
BusSyncReply::Drop
|
||||||
|
|
Loading…
Reference in a new issue