GNOME Bugzilla – Bug 606649
Problems pausing playbin2 on some files with large audio-buffer
Last modified: 2018-05-04 09:12:06 UTC
Created attachment 151174 [details] [review] Core: allow subclasses of basesink to override prerolling behaviour If you have a large audio ringbuffer, sometimes pausing can fail - the PAUSE never prerolls. Because of the large audio buffer, the steady-state in playback has the video side of the decodebin2 multiqueue full, and the audio side empty. So, at any given time, most likely, the demuxer will be blocked trying to push a buffer into the video queue. When we set to PAUSED, then, we try to preroll the sinks. The video sink pretty much immediately prerolls with a buffer from the video queue. The demuxer can now push its buffer into the queue, and gets unblocked. Now, the demuxer goes to push again. In the files I'm testing with, the audio is in large (~0.5 seconds) chunks, so usually the next thing to push will be another video frame. We try to push that - and it blocks in the video queue again. Now we're deadlocked - we can't push anything into the audio queue, so we can't preroll the audio sink. Testing with seek.c, used like this: ./seek 15 'playbin2 uri=file:///tmp/test.mov audio-sink="pulsesink buffer-time=5000000"' I ran into this originally with Songbird, which uses a large audio ringbuffer. Wim suggested that we could make the audio sink preroll based on audio in the ring buffer. I'm attaching an attempt at implementing this (two patches: one to core, one to base)
Created attachment 151175 [details] [review] Base: audiosinks can preroll if they have data in their ringbuffer
FWIW, there also was bug #342155 at some point.
Seems good to me. We probably need a different implementation for pulseaudio.
What should be done different for pulsesink? Doesn't it just use it's custom ringbuffer implementation and would simply work with the baseaudiosink patch?
Ping? Wim?
Let's close this then, it's been a decade now and a lot of stuff has changed. The underlying problem is still relevant but the solution would probably look different. Someone needs to come up with a testcase and implementation plan then