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

Unified Diff: media/base/pipeline_impl.cc

Issue 6822019: Fix erratic HTML5 audio playback (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix nit Created 9 years, 8 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 | « media/base/pipeline_impl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/base/pipeline_impl.cc
diff --git a/media/base/pipeline_impl.cc b/media/base/pipeline_impl.cc
index f574b8515f96c146a0321b2a33c69850ad5cf002..25bdf47baa2bd119a44be67ac83971ec2ed8e1dd 100644
--- a/media/base/pipeline_impl.cc
+++ b/media/base/pipeline_impl.cc
@@ -358,6 +358,7 @@ void PipelineImpl::ResetState() {
seek_pending_ = false;
tearing_down_ = false;
error_caused_teardown_ = false;
+ playback_rate_change_pending_ = false;
duration_ = kZero;
buffered_time_ = kZero;
buffered_bytes_ = 0;
@@ -369,6 +370,7 @@ void PipelineImpl::ResetState() {
volume_ = 1.0f;
preload_ = AUTO;
playback_rate_ = 0.0f;
+ pending_playback_rate_ = 0.0f;
status_ = PIPELINE_OK;
has_audio_ = false;
has_video_ = false;
@@ -780,6 +782,14 @@ void PipelineImpl::ErrorChangedTask(PipelineStatus error) {
void PipelineImpl::PlaybackRateChangedTask(float playback_rate) {
DCHECK_EQ(MessageLoop::current(), message_loop_);
+
+ // Suppress rate change until after seeking.
+ if (IsPipelineSeeking()) {
+ pending_playback_rate_ = playback_rate;
+ playback_rate_change_pending_ = true;
+ return;
+ }
+
{
base::AutoLock auto_lock(lock_);
clock_->SetPlaybackRate(playback_rate);
@@ -959,6 +969,13 @@ void PipelineImpl::FilterStateTransitionTask() {
seek_timestamp_ = base::TimeDelta();
seek_pending_ = false;
+ // If a playback rate change was requested during a seek, do it now that
+ // the seek has compelted.
+ if (playback_rate_change_pending_) {
+ playback_rate_change_pending_ = false;
+ PlaybackRateChangedTask(pending_playback_rate_);
+ }
+
base::AutoLock auto_lock(lock_);
// We use audio stream to update the clock. So if there is such a stream,
// we pause the clock until we receive a valid timestamp.
« no previous file with comments | « media/base/pipeline_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698