summaryrefslogtreecommitdiffstats
path: root/media/base
diff options
context:
space:
mode:
authorscherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-07-08 01:08:03 +0000
committerscherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-07-08 01:08:03 +0000
commit5d36df8a13c2db628a1b123f71cc7edbecebc0a3 (patch)
tree03061deb8d45c2d2d59abf8ec217c02c8f5e4332 /media/base
parentce782be8ffabb8d2a5ef03cd090e255b3d9ca4e2 (diff)
downloadchromium_src-5d36df8a13c2db628a1b123f71cc7edbecebc0a3.zip
chromium_src-5d36df8a13c2db628a1b123f71cc7edbecebc0a3.tar.gz
chromium_src-5d36df8a13c2db628a1b123f71cc7edbecebc0a3.tar.bz2
Fold Pipeline's initial prerolling state into the playing state.
It's no longer needed now that all renderers have moved towards buffering state callbacks. BUG=144683 Review URL: https://codereview.chromium.org/361243007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@281619 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media/base')
-rw-r--r--media/base/pipeline.cc62
-rw-r--r--media/base/pipeline.h10
2 files changed, 31 insertions, 41 deletions
diff --git a/media/base/pipeline.cc b/media/base/pipeline.cc
index a393cc8..bc16c80 100644
--- a/media/base/pipeline.cc
+++ b/media/base/pipeline.cc
@@ -204,7 +204,6 @@ const char* Pipeline::GetStateString(State state) {
RETURN_STRING(kInitDemuxer);
RETURN_STRING(kInitAudioRenderer);
RETURN_STRING(kInitVideoRenderer);
- RETURN_STRING(kInitPrerolling);
RETURN_STRING(kSeeking);
RETURN_STRING(kPlaying);
RETURN_STRING(kStopping);
@@ -232,17 +231,14 @@ Pipeline::State Pipeline::GetNextState() const {
return kInitAudioRenderer;
if (demuxer_->GetStream(DemuxerStream::VIDEO))
return kInitVideoRenderer;
- return kInitPrerolling;
+ return kPlaying;
case kInitAudioRenderer:
if (demuxer_->GetStream(DemuxerStream::VIDEO))
return kInitVideoRenderer;
- return kInitPrerolling;
+ return kPlaying;
case kInitVideoRenderer:
- return kInitPrerolling;
-
- case kInitPrerolling:
return kPlaying;
case kSeeking:
@@ -372,34 +368,36 @@ void Pipeline::StateTransitionTask(PipelineStatus status) {
case kInitVideoRenderer:
return InitializeVideoRenderer(done_cb);
- case kInitPrerolling:
- filter_collection_.reset();
- {
- base::AutoLock l(lock_);
- // We do not want to start the clock running. We only want to set the
- // base media time so our timestamp calculations will be correct.
- clock_->SetTime(base::TimeDelta(), base::TimeDelta());
- }
- if (!audio_renderer_ && !video_renderer_) {
- done_cb.Run(PIPELINE_ERROR_COULD_NOT_RENDER);
- return;
- }
-
- {
- PipelineMetadata metadata;
- metadata.has_audio = audio_renderer_;
- metadata.has_video = video_renderer_;
- metadata.timeline_offset = demuxer_->GetTimelineOffset();
- DemuxerStream* stream = demuxer_->GetStream(DemuxerStream::VIDEO);
- if (stream)
- metadata.natural_size = stream->video_decoder_config().natural_size();
- metadata_cb_.Run(metadata);
+ case kPlaying:
+ // Finish initial start sequence the first time we enter the playing
+ // state.
+ if (filter_collection_) {
+ filter_collection_.reset();
+ {
+ base::AutoLock l(lock_);
+ // We do not want to start the clock running. We only want to set the
+ // base media time so our timestamp calculations will be correct.
+ clock_->SetTime(base::TimeDelta(), base::TimeDelta());
+ }
+ if (!audio_renderer_ && !video_renderer_) {
+ ErrorChangedTask(PIPELINE_ERROR_COULD_NOT_RENDER);
+ return;
+ }
+
+ {
+ PipelineMetadata metadata;
+ metadata.has_audio = audio_renderer_;
+ metadata.has_video = video_renderer_;
+ metadata.timeline_offset = demuxer_->GetTimelineOffset();
+ DemuxerStream* stream = demuxer_->GetStream(DemuxerStream::VIDEO);
+ if (stream) {
+ metadata.natural_size =
+ stream->video_decoder_config().natural_size();
+ }
+ metadata_cb_.Run(metadata);
+ }
}
- // TODO(scherkus): Fold kInitPrerolling state into kPlaying.
- return done_cb.Run(PIPELINE_OK);
-
- case kPlaying:
base::ResetAndReturn(&seek_cb_).Run(PIPELINE_OK);
if (audio_renderer_)
diff --git a/media/base/pipeline.h b/media/base/pipeline.h
index f042548..3d25b8e 100644
--- a/media/base/pipeline.h
+++ b/media/base/pipeline.h
@@ -59,10 +59,7 @@ typedef base::Callback<void(PipelineMetadata)> PipelineMetadataCB;
// [ InitXXX (for each filter) ] [ Stopping ]
// | |
// V V
-// [ InitPrerolling ] [ Stopped ]
-// |
-// V
-// [ Playing ] <-- [ Seeking ]
+// [ Playing ] <-- [ Seeking ] [ Stopped ]
// | ^
// `---------------'
// Seek()
@@ -194,7 +191,6 @@ class MEDIA_EXPORT Pipeline : public DemuxerHost {
kInitDemuxer,
kInitAudioRenderer,
kInitVideoRenderer,
- kInitPrerolling,
kSeeking,
kPlaying,
kStopping,
@@ -296,10 +292,6 @@ class MEDIA_EXPORT Pipeline : public DemuxerHost {
// Initiates an asynchronous pause-flush-seek-preroll call sequence
// executing |done_cb| with the final status when completed.
- //
- // TODO(scherkus): Prerolling should be separate from seeking so we can report
- // finer grained ready states (HAVE_CURRENT_DATA vs. HAVE_FUTURE_DATA)
- // indepentent from seeking.
void DoSeek(base::TimeDelta seek_timestamp, const PipelineStatusCB& done_cb);
// Initiates an asynchronous pause-flush-stop call sequence executing