GNOME Bugzilla – Bug 685273
Pre-rolling on GAP events doesn't work properly for audio sinks
Last modified: 2012-10-24 09:20:13 UTC
Created attachment 225570 [details] Log file I have a problem in DVD playback where jumping from a menu into the movie with no audio sends a gap event to the audio sink to trigger preroll but the pipeline never resumes. It looks to me that the audio clock never starts running again, even though the pipeline has gone back to PLAYING state. This pipeline fails: gst-launch-1.0 rsndvdbin name=s ! dvdspu ! xvimagesink s. ! dvdspu0. s. ! pulsesink This one, using the system clock, works fine: gst-launch-1.0 rsndvdbin name=s ! dvdspu ! xvimagesink s. ! dvdspu0. s. ! pulsesink provide-clock=false Log attached.
pulsesink doesn't start the clock yet until it receives a buffer and puts something in the ringbuffer. It should probably also start when it receives a GAP event.
Created attachment 225577 [details] [review] audiobasesink: Start the ring buffer when processing a GAP event. Calling the gst_audio_base_sink_drain() function for a GAP event causes the ringbuffer to start, the clock to start running, and for preroll to happen the same way it does for an EOS event. Fixes: #685273
This patch fixes my problem by making the audio sinks start running on a gap event. It seems like a hack though - it seems like the correct fix would be to render the commit the correct amount of silence to the ringbuffer and only trigger it when it overflows, as normal.
Also calling _drain will make it wait for the clock until the last sample is played, which doesn't sound like a good idea. Better would be to indeed insert silence for the timestamp/duration of the GAP event, you could probably do this by making a new buffer of silence and calling the _render function..
I was trying to avoid having baseaudiosink have to know what a silence buffer for any given format looks like.
gst_audio_format_fill_silence() might help :)
Yes, filling a silence buffer would work. It's a good point about draining. It doesn't really matter in this exact instance, since we're talking about prerolling. It matters for other gap events that might arrive later, though.
*** Bug 686224 has been marked as a duplicate of this bug. ***
Bug #686224 is caused by the same problem, unfortunately the GAP event there has timestamp 0 and duration 0 and it's not really trivial to get the correct timestamp/duration.
I can get a valid timestamp and probably also a duration, what would be needed though is that the audiosink clock continues to advance until it receives an EOS event.
Once the audio sink starts rendering, it'll keep pumping silence and the audio clock will continue to advance
commit 7b12afa4cbc89a24a7b1b253a89a02fc2b2bbd9f Author: Sebastian Dröge <sebastian.droege@collabora.co.uk> Date: Wed Oct 24 09:57:23 2012 +0200 streamsynchronizer: Create a GAP event with a sensible timestamp commit b793d0bfae531e47eda7afb3af66971f19ec3d07 Author: Sebastian Dröge <sebastian.droege@collabora.co.uk> Date: Wed Oct 24 11:16:54 2012 +0200 audiobasesink: Properly handle GAP events These are now converted into silence buffers if they have a duration or cause the ringbuffer and clock to be started if they don't have a duration. Fixes bug #685273. commit 69246dfef7b91b31b69b0398ab92990b9844b5a5 Author: Sebastian Dröge <sebastian.droege@collabora.co.uk> Date: Wed Oct 24 11:17:55 2012 +0200 pulsesink: Flush the ringbuffer on GAP events without duration This is required to properly start the ringbuffer and clock.