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

Side by Side Diff: media/filters/audio_renderer_base.cc

Issue 164447: Merge 22654 - Renderer busy looping after video (with sound) or audio ends... (Closed) Base URL: svn://chrome-svn/chrome/branches/195/src/
Patch Set: Created 11 years, 4 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | media/filters/audio_renderer_base_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Modified: svn:mergeinfo
Merged /trunk/src/media/filters/audio_renderer_base.cc:r22654
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "media/filters/audio_renderer_base.h" 5 #include "media/filters/audio_renderer_base.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "media/base/filter_host.h" 9 #include "media/base/filter_host.h"
10 #include "media/filters/audio_renderer_algorithm_ola.h" 10 #include "media/filters/audio_renderer_algorithm_ola.h"
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 state_ = kPaused; 113 state_ = kPaused;
114 callback->Run(); 114 callback->Run();
115 } 115 }
116 116
117 void AudioRendererBase::OnReadComplete(Buffer* buffer_in) { 117 void AudioRendererBase::OnReadComplete(Buffer* buffer_in) {
118 AutoLock auto_lock(lock_); 118 AutoLock auto_lock(lock_);
119 DCHECK(state_ == kPaused || state_ == kSeeking || state_ == kPlaying); 119 DCHECK(state_ == kPaused || state_ == kSeeking || state_ == kPlaying);
120 DCHECK_GT(pending_reads_, 0u); 120 DCHECK_GT(pending_reads_, 0u);
121 --pending_reads_; 121 --pending_reads_;
122 122
123 // Note: Calling this may schedule more reads. 123 // Don't enqueue an end-of-stream buffer because it has no data.
124 algorithm_->EnqueueBuffer(buffer_in); 124 if (!buffer_in->IsEndOfStream()) {
125 // Note: Calling this may schedule more reads.
126 algorithm_->EnqueueBuffer(buffer_in);
127 }
125 128
126 // Check for our preroll complete condition. 129 // Check for our preroll complete condition.
127 if (state_ == kSeeking) { 130 if (state_ == kSeeking) {
128 DCHECK(seek_callback_.get()); 131 DCHECK(seek_callback_.get());
129 if (algorithm_->IsQueueFull() || buffer_in->IsEndOfStream()) { 132 if (algorithm_->IsQueueFull() || buffer_in->IsEndOfStream()) {
130 // Transition into paused whether we have data in |algorithm_| or not. 133 // Transition into paused whether we have data in |algorithm_| or not.
131 // FillBuffer() will play silence if there's nothing to fill. 134 // FillBuffer() will play silence if there's nothing to fill.
132 state_ = kPaused; 135 state_ = kPaused;
133 seek_callback_->Run(); 136 seek_callback_->Run();
134 seek_callback_.reset(); 137 seek_callback_.reset();
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 217
215 void AudioRendererBase::SetPlaybackRate(float playback_rate) { 218 void AudioRendererBase::SetPlaybackRate(float playback_rate) {
216 algorithm_->set_playback_rate(playback_rate); 219 algorithm_->set_playback_rate(playback_rate);
217 } 220 }
218 221
219 float AudioRendererBase::GetPlaybackRate() { 222 float AudioRendererBase::GetPlaybackRate() {
220 return algorithm_->playback_rate(); 223 return algorithm_->playback_rate();
221 } 224 }
222 225
223 } // namespace media 226 } // namespace media
OLDNEW
« no previous file with comments | « no previous file | media/filters/audio_renderer_base_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698