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

Unified Diff: media/base/pipeline.cc

Issue 377003002: Pipeline: Call clock_->SetTime() right before StartPlayingFrom(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix PipelineTest.Seek Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | media/base/pipeline_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/base/pipeline.cc
diff --git a/media/base/pipeline.cc b/media/base/pipeline.cc
index 1c7507c57f56279472d45a61374445233db5b826..c0f092de3c6105fff6e09053fc4d087f63502b42 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)));
}
« no previous file with comments | « no previous file | media/base/pipeline_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698