Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(294)

Issue 160005: Implemented proper pause-then-seek behaviour for the media pipeline. (Closed)

Created:
11 years, 5 months ago by scherkus (not reviewing)
Modified:
9 years, 7 months ago
CC:
chromium-reviews_googlegroups.com
Visibility:
Public.

Description

Implemented 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 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+675 lines, -365 lines) Patch
M media/base/filters.h View 1 2 3 4 5 6 7 1 chunk +19 lines, -0 lines 0 comments Download
M media/base/pipeline.h View 1 chunk +0 lines, -1 line 0 comments Download
M media/base/pipeline_impl.h View 1 2 3 4 5 6 7 8 7 chunks +71 lines, -27 lines 0 comments Download
M media/base/pipeline_impl.cc View 1 2 3 4 5 6 7 8 9 8 chunks +119 lines, -35 lines 0 comments Download
M media/base/pipeline_impl_unittest.cc View 7 chunks +16 lines, -0 lines 0 comments Download
M media/filters/audio_renderer_base.h View 1 4 chunks +26 lines, -9 lines 0 comments Download
M media/filters/audio_renderer_base.cc View 1 2 3 4 5 6 8 chunks +81 lines, -54 lines 0 comments Download
M media/filters/audio_renderer_base_unittest.cc View 1 2 2 chunks +16 lines, -8 lines 0 comments Download
M media/filters/decoder_base.h View 2 3 4 5 6 7 8 7 chunks +33 lines, -33 lines 0 comments Download
M media/filters/ffmpeg_demuxer.cc View 2 chunks +5 lines, -2 lines 0 comments Download
M media/filters/ffmpeg_video_decoder.h View 1 chunk +1 line, -1 line 0 comments Download
M media/filters/ffmpeg_video_decoder.cc View 1 3 chunks +9 lines, -7 lines 0 comments Download
M media/filters/ffmpeg_video_decoder_unittest.cc View 2 2 chunks +32 lines, -15 lines 0 comments Download
M media/filters/video_renderer_base.h View 1 2 3 4 5 6 7 3 chunks +38 lines, -15 lines 0 comments Download
M media/filters/video_renderer_base.cc View 1 2 3 4 5 6 7 10 chunks +193 lines, -104 lines 0 comments Download
M media/filters/video_renderer_base_unittest.cc View 1 2 3 2 chunks +16 lines, -54 lines 0 comments Download

Messages

Total messages: 12 (0 generated)
scherkus (not reviewing)
Thoroughly tested. Has no effect on existing pipeline API cilents (other than seeking works!)
11 years, 5 months ago (2009-07-23 23:24:56 UTC) #1
awong
Couple of small comments. Will give a more thorough review tomorrow. http://codereview.chromium.org/160005/diff/84/1046 File media/base/pipeline_impl.cc (right): ...
11 years, 5 months ago (2009-07-24 00:25:02 UTC) #2
scherkus (not reviewing)
http://codereview.chromium.org/160005/diff/84/1046 File media/base/pipeline_impl.cc (right): http://codereview.chromium.org/160005/diff/84/1046#newcode546 Line 546: // will only execute the first Seek() request. ...
11 years, 5 months ago (2009-07-24 18:36:18 UTC) #3
Alpha Left Google
http://codereview.chromium.org/160005/diff/84/1044 File media/base/filters.h (right): http://codereview.chromium.org/160005/diff/84/1044#newcode101 Line 101: // downstream filters, except when they are pre-rolling ...
11 years, 5 months ago (2009-07-24 18:47:58 UTC) #4
awong
A few more comments. http://codereview.chromium.org/160005/diff/88/1061 File chrome/renderer/media/audio_renderer_impl.cc (right): http://codereview.chromium.org/160005/diff/88/1061#newcode27 Line 27: // Assuming a packet ...
11 years, 5 months ago (2009-07-24 19:23:54 UTC) #5
scherkus (not reviewing)
thanks for the review fellas -- I know it's not enjoyable :\ http://codereview.chromium.org/160005/diff/84/1044 File media/base/filters.h ...
11 years, 5 months ago (2009-07-24 22:24:31 UTC) #6
awong
Couple more small comments. http://codereview.chromium.org/160005/diff/88/1070 File media/filters/decoder_base.h (right): http://codereview.chromium.org/160005/diff/88/1070#newcode160 Line 160: DCHECK(!demuxer_stream_); On 2009/07/24 22:24:31, ...
11 years, 5 months ago (2009-07-24 22:35:17 UTC) #7
scherkus (not reviewing)
http://codereview.chromium.org/160005/diff/97/1086 File media/base/pipeline_impl.cc (right): http://codereview.chromium.org/160005/diff/97/1086#newcode596 Line 596: // Invalid states will be caught in the ...
11 years, 5 months ago (2009-07-25 00:18:55 UTC) #8
awong
LGTM Looks good enough. 2 more nit picks. http://codereview.chromium.org/160005/diff/115/118 File media/base/pipeline_impl.cc (right): http://codereview.chromium.org/160005/diff/115/118#newcode590 Line 590: ...
11 years, 5 months ago (2009-07-25 00:33:05 UTC) #9
Alpha Left Google
LGTM!
11 years, 5 months ago (2009-07-25 00:57:02 UTC) #10
scherkus (not reviewing)
ooooooooookay I think we're good here
11 years, 5 months ago (2009-07-25 01:01:14 UTC) #11
awong
11 years, 5 months ago (2009-07-25 01:02:33 UTC) #12
LFGTM!

Powered by Google App Engine
This is Rietveld 408576698