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

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

Issue 164195: Merge 21935 - Fixes an audio playback regression caused by seeking in audio/v... (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 | « chrome/renderer/media/audio_renderer_impl.cc ('k') | no next file » | 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:r21935
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 <algorithm>
6
5 #include "media/base/filter_host.h" 7 #include "media/base/filter_host.h"
6 #include "media/filters/audio_renderer_base.h" 8 #include "media/filters/audio_renderer_base.h"
7 9
8 namespace media { 10 namespace media {
9 11
10 // The maximum size of the queue, which also acts as the number of initial reads 12 // The maximum size of the queue, which also acts as the number of initial reads
11 // to perform for buffering. The size of the queue should never exceed this 13 // to perform for buffering. The size of the queue should never exceed this
12 // number since we read only after we've dequeued and released a buffer in 14 // number since we read only after we've dequeued and released a buffer in
13 // callback thread. 15 // callback thread.
14 // 16 //
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 size_t dest_written = 0; 139 size_t dest_written = 0;
138 140
139 // The timestamp of the last buffer written during the last call to 141 // The timestamp of the last buffer written during the last call to
140 // FillBuffer(). 142 // FillBuffer().
141 base::TimeDelta last_fill_buffer_time; 143 base::TimeDelta last_fill_buffer_time;
142 { 144 {
143 AutoLock auto_lock(lock_); 145 AutoLock auto_lock(lock_);
144 146
145 // Mute audio by returning 0 when not playing. 147 // Mute audio by returning 0 when not playing.
146 if (state_ != kPlaying) { 148 if (state_ != kPlaying) {
147 return 0; 149 // TODO(scherkus): To keep the audio hardware busy we write at most 8k of
150 // zeros. This gets around the tricky situation of pausing and resuming
151 // the audio IPC layer in Chrome. Ideally, we should return zero and then
152 // the subclass can restart the conversation.
153 const size_t kZeroLength = 8192;
154 dest_written = std::min(kZeroLength, dest_len);
155 memset(dest, 0, dest_written);
156 return dest_written;
148 } 157 }
149 158
150 // Save a local copy of last fill buffer time and reset the member. 159 // Save a local copy of last fill buffer time and reset the member.
151 last_fill_buffer_time = last_fill_buffer_time_; 160 last_fill_buffer_time = last_fill_buffer_time_;
152 last_fill_buffer_time_ = base::TimeDelta(); 161 last_fill_buffer_time_ = base::TimeDelta();
153 162
154 // Loop until the buffer has been filled. 163 // Loop until the buffer has been filled.
155 while (dest_len > 0 && !queue_.empty()) { 164 while (dest_len > 0 && !queue_.empty()) {
156 scoped_refptr<Buffer> buffer = queue_.front(); 165 scoped_refptr<Buffer> buffer = queue_.front();
157 166
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 // TODO(scherkus): might be handy to support NULL parameters. 272 // TODO(scherkus): might be handy to support NULL parameters.
264 std::string mime_type; 273 std::string mime_type;
265 return media_format.GetAsString(MediaFormat::kMimeType, &mime_type) && 274 return media_format.GetAsString(MediaFormat::kMimeType, &mime_type) &&
266 media_format.GetAsInteger(MediaFormat::kChannels, channels_out) && 275 media_format.GetAsInteger(MediaFormat::kChannels, channels_out) &&
267 media_format.GetAsInteger(MediaFormat::kSampleRate, sample_rate_out) && 276 media_format.GetAsInteger(MediaFormat::kSampleRate, sample_rate_out) &&
268 media_format.GetAsInteger(MediaFormat::kSampleBits, sample_bits_out) && 277 media_format.GetAsInteger(MediaFormat::kSampleBits, sample_bits_out) &&
269 mime_type.compare(mime_type::kUncompressedAudio) == 0; 278 mime_type.compare(mime_type::kUncompressedAudio) == 0;
270 } 279 }
271 280
272 } // namespace media 281 } // namespace media
OLDNEW
« no previous file with comments | « chrome/renderer/media/audio_renderer_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698