diff options
author | kmackay <kmackay@chromium.org> | 2015-12-14 22:52:55 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-12-15 06:54:43 +0000 |
commit | d317eedd409d3c7760b6bf0873b17b3f2fad4bf8 (patch) | |
tree | ebc9919468fbd887ca6a7a5f9ceb8a21ae4e15be /chromecast | |
parent | 59d82c4e765d267f8420255d9452ff193e6e7ecd (diff) | |
download | chromium_src-d317eedd409d3c7760b6bf0873b17b3f2fad4bf8.zip chromium_src-d317eedd409d3c7760b6bf0873b17b3f2fad4bf8.tar.gz chromium_src-d317eedd409d3c7760b6bf0873b17b3f2fad4bf8.tar.bz2 |
[Chromecast] Ignore calls to SetPlaybackRate when the backend is stopped
It looks like SetPlaybackRate can be called in some cases when the
backend is not in the playing/paused states; this breaks the backend
API contract. Therefore, check that the backend is started before
calling into it to set the playback rate.
BUG= internal b/26082570
Review URL: https://codereview.chromium.org/1523123003
Cr-Commit-Position: refs/heads/master@{#365192}
Diffstat (limited to 'chromecast')
-rw-r--r-- | chromecast/media/cma/pipeline/media_pipeline_impl.cc | 15 | ||||
-rw-r--r-- | chromecast/media/cma/pipeline/media_pipeline_impl.h | 3 |
2 files changed, 8 insertions, 10 deletions
diff --git a/chromecast/media/cma/pipeline/media_pipeline_impl.cc b/chromecast/media/cma/pipeline/media_pipeline_impl.cc index 05fffcd..3f96cb0 100644 --- a/chromecast/media/cma/pipeline/media_pipeline_impl.cc +++ b/chromecast/media/cma/pipeline/media_pipeline_impl.cc @@ -59,7 +59,7 @@ MediaPipelineImpl::MediaPipelineImpl() backend_initialized_(false), paused_(false), target_playback_rate_(1.0f), - enable_time_update_(false), + backend_started_(false), pending_time_update_task_(false), statistics_rolling_counter_(0), weak_factory_(this) { @@ -201,7 +201,7 @@ void MediaPipelineImpl::StartPlayingFrom(base::TimeDelta time) { } // Enable time updates. - enable_time_update_ = true; + backend_started_ = true; statistics_rolling_counter_ = 0; if (!pending_time_update_task_) { pending_time_update_task_ = true; @@ -236,8 +236,7 @@ void MediaPipelineImpl::Flush(const ::media::PipelineStatusCB& status_cb) { DCHECK(audio_pipeline_ || video_pipeline_); DCHECK(!pending_flush_callbacks_); - // No need to update media time anymore. - enable_time_update_ = false; + backend_started_ = false; buffering_controller_->Reset(); @@ -286,9 +285,7 @@ void MediaPipelineImpl::Stop() { // audio/video pipelines. This will ensure A/V Flush won't happen in // stopped state. pending_flush_callbacks_.reset(); - - // No need to update media time anymore. - enable_time_update_ = false; + backend_started_ = false; // Stop both the audio and video pipeline. if (audio_pipeline_) @@ -307,6 +304,8 @@ void MediaPipelineImpl::SetPlaybackRate(double rate) { CMALOG(kLogControl) << __FUNCTION__ << " rate=" << rate; DCHECK(thread_checker_.CalledOnValidThread()); target_playback_rate_ = rate; + if (!backend_started_) + return; if (buffering_controller_ && buffering_controller_->IsBuffering()) return; @@ -370,7 +369,7 @@ void MediaPipelineImpl::OnBufferingNotification(bool is_buffering) { void MediaPipelineImpl::UpdateMediaTime() { pending_time_update_task_ = false; - if (!enable_time_update_) + if (!backend_started_) return; if (statistics_rolling_counter_ == 0) { diff --git a/chromecast/media/cma/pipeline/media_pipeline_impl.h b/chromecast/media/cma/pipeline/media_pipeline_impl.h index 5ca8ea4..df0ce67 100644 --- a/chromecast/media/cma/pipeline/media_pipeline_impl.h +++ b/chromecast/media/cma/pipeline/media_pipeline_impl.h @@ -96,8 +96,7 @@ class MediaPipelineImpl { float target_playback_rate_; // The media time is retrieved at regular intervals. - // Indicate whether time update is enabled. - bool enable_time_update_; + bool backend_started_; // Whether or not the backend is playing/paused. bool pending_time_update_task_; base::TimeDelta last_media_time_; |