Chromium Code Reviews
DescriptionImplemented proper pause-then-seek behaviour for the media pipeline.
MediaFilter now has asynchronous Play() and Pause() methods that are implemented by default. Since we are a completely pull-based system, it turns out only AudioRendererBase and VideoRendererBase need to override them to halt reading from decoders.
When a seek is received by the pipeline, it goes through the following state transitions:
1) Playing -> Pausing -> Paused (notify filters to stop reading)
2) Paused -> Seeking (notify filters to flush buffers and preroll)
3) Seeking -> Playing (preroll completed, resume playback)
The key to this system is that there must be no pending reads in *any* filter when we start transitioning into the seeking state. That means the audio/video renderers do not complete their pausing->paused transition until they have completed all pending reads. To reiterate, since we're pulled based if the renderers are not reading any data, then *nothing* is happening in the pipeline.
We get a lot of nice benefits from this assertion, namely no callbacks are ever "lost", they are always replied to until we are fully paused. Furthermore, we can guarantee that the first buffer received after a Seek() will be guaranteed to be discontinuous.
This change also properly handles end-of-stream, seeking from an end-of-stream state, and displaying frames while paused. In summary, I was able to call Seek() in a while(true) loop without crashing or going out of sync.
BUG=16014, 16021, 17456
TEST=seeking should be way more robust
Patch Set 1 #Patch Set 2 : Unit tests passing #Patch Set 3 : Fixed gcc issues #Patch Set 4 : Removed old test #Patch Set 5 : Fixed reply order #Patch Set 6 : Uploaded too much #
Total comments: 26
Patch Set 7 : Fixes #
Total comments: 28
Patch Set 8 : Cleanup-o-rama #
Total comments: 4
Patch Set 9 : More fixes #
Total comments: 2
Patch Set 10 : yay #
Messages
Total messages: 12 (0 generated)
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||