From 5d34b3448d0ffe9c6b5942f245b0a777eebea72d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Fri, 12 Oct 2018 10:18:34 +0300 Subject: [PATCH] Wait for Eos message on the bus for signalling global end-of-stream Each appsink will signal eos individually and considering the first one's eos as the global end-of-stream might cause the pipeline to be shut down before all other appsinks are done processing their data. The Eos message on the bus is only sent once *all* sinks are end-of-stream. Fixes https://github.com/servo/media/issues/151 --- backends/gstreamer/src/audio_decoder.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/backends/gstreamer/src/audio_decoder.rs b/backends/gstreamer/src/audio_decoder.rs index c002fdc0..c68656ae 100644 --- a/backends/gstreamer/src/audio_decoder.rs +++ b/backends/gstreamer/src/audio_decoder.rs @@ -170,7 +170,6 @@ impl AudioDecoder for GStreamerAudioDecoder { .map_err(|e| BackendError::SetPropertyFailed(e.0))?; let callbacks_ = callbacks.clone(); - let callbacks__ = callbacks.clone(); appsink.set_callbacks( AppSinkCallbacks::new() .new_sample(move |appsink| { @@ -230,9 +229,6 @@ impl AudioDecoder for GStreamerAudioDecoder { gst::FlowReturn::Ok }) - .eos(move |_| { - callbacks__.eos(); - }) .build(), ); @@ -324,6 +320,10 @@ impl AudioDecoder for GStreamerAudioDecoder { )); let _ = sender.lock().unwrap().send(()); } + MessageView::Eos(_) => { + callbacks_.eos(); + let _ = sender.lock().unwrap().send(()); + } _ => (), } gst::BusSyncReply::Drop