diff options
author | xhwang@chromium.org <xhwang@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-07-09 04:53:53 +0000 |
---|---|---|
committer | xhwang@chromium.org <xhwang@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-07-09 04:53:53 +0000 |
commit | 81547c5da6b4194046645fd48414e76d8f0d33f0 (patch) | |
tree | b4aa3e9649f8aa713c01745b12bb8d0140b48757 /media/base | |
parent | b9a08398219d2b07378990aadd5fb168a15b0b56 (diff) | |
download | chromium_src-81547c5da6b4194046645fd48414e76d8f0d33f0.zip chromium_src-81547c5da6b4194046645fd48414e76d8f0d33f0.tar.gz chromium_src-81547c5da6b4194046645fd48414e76d8f0d33f0.tar.bz2 |
Pipeline: Call clock_->SetTime() right before StartPlayingFrom().
Currently we call clock_->SetTime() before we flush the renderers. This CL
moves it to right before we call StartPlayingFrom(start_timestamp_). This
makes it easier in a later CL to hide all clock logic into a new Renderer
implementation.
This CL also fixed the PipelineTest.Seek test. Originally we AddTextStream()
in the text which causes a TextRenderer::Read(). But we never satisfy or
abort that Read(). This caused TextRenderer::Pause() to never return the
completion callback. Therefore, the pipeline seek process never finishes.
This test was passing because we SetTime() before we DoSeek(). Now I moved
SetTime() after DoSeek() and this issue is exposed.
BUG=392259
TEST=All existing tests pass.
Review URL: https://codereview.chromium.org/377003002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@281938 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media/base')
-rw-r--r-- | media/base/pipeline.cc | 22 | ||||
-rw-r--r-- | media/base/pipeline_unittest.cc | 1 |
2 files changed, 10 insertions, 13 deletions
diff --git a/media/base/pipeline.cc b/media/base/pipeline.cc index 824d1e4..05fcfc2 100644 --- a/media/base/pipeline.cc +++ b/media/base/pipeline.cc @@ -55,6 +55,7 @@ Pipeline::Pipeline( media_log_->AddEvent(media_log_->CreatePipelineStateChangedEvent(kCreated)); media_log_->AddEvent( media_log_->CreateEvent(MediaLogEvent::PIPELINE_CREATED)); + clock_->SetTime(base::TimeDelta(), base::TimeDelta()); } Pipeline::~Pipeline() { @@ -373,12 +374,6 @@ void Pipeline::StateTransitionTask(PipelineStatus status) { // 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; @@ -400,6 +395,11 @@ void Pipeline::StateTransitionTask(PipelineStatus status) { base::ResetAndReturn(&seek_cb_).Run(PIPELINE_OK); + { + base::AutoLock auto_lock(lock_); + clock_->SetTime(start_timestamp_, start_timestamp_); + } + if (audio_renderer_) audio_renderer_->StartPlayingFrom(start_timestamp_); if (video_renderer_) @@ -441,6 +441,10 @@ void Pipeline::DoSeek( DCHECK(task_runner_->BelongsToCurrentThread()); DCHECK(!pending_callbacks_.get()); SerialRunner::Queue bound_fns; + { + base::AutoLock auto_lock(lock_); + PauseClockAndStopRendering_Locked(); + } // Pause. if (text_renderer_) { @@ -683,12 +687,6 @@ void Pipeline::SeekTask(TimeDelta time, const PipelineStatusCB& seek_cb) { text_ended_ = false; start_timestamp_ = time; - // Kick off seeking! - { - base::AutoLock auto_lock(lock_); - PauseClockAndStopRendering_Locked(); - clock_->SetTime(time, time); - } DoSeek(time, base::Bind( &Pipeline::OnStateTransition, base::Unretained(this))); } diff --git a/media/base/pipeline_unittest.cc b/media/base/pipeline_unittest.cc index 0c0e474..4aa5e09 100644 --- a/media/base/pipeline_unittest.cc +++ b/media/base/pipeline_unittest.cc @@ -514,7 +514,6 @@ TEST_F(PipelineTest, Seek) { // Initialize then seek! InitializePipeline(PIPELINE_OK); - AddTextStream(); message_loop_.RunUntilIdle(); // Every filter should receive a call to Seek(). |