mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-11-25 19:11:06 +00:00
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/1398>
This commit is contained in:
parent
b47aba1837
commit
c8b98dde8c
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