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

Side by Side Diff: content/renderer/media/audio_renderer_impl.cc

Issue 9395057: Fix muted audio when playback rate != 1.0 or 0.0 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 10 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/audio/audio_util.h » ('j') | media/base/seekable_buffer.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/renderer/media/audio_renderer_impl.h" 5 #include "content/renderer/media/audio_renderer_impl.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 static_cast<int64>(ceil(request_delay.InMicroseconds() * 211 static_cast<int64>(ceil(request_delay.InMicroseconds() *
212 GetPlaybackRate()))); 212 GetPlaybackRate())));
213 } 213 }
214 214
215 uint32 bytes_per_frame = 215 uint32 bytes_per_frame =
216 audio_parameters_.bits_per_sample * audio_parameters_.channels / 8; 216 audio_parameters_.bits_per_sample * audio_parameters_.channels / 8;
217 217
218 const size_t buf_size = number_of_frames * bytes_per_frame; 218 const size_t buf_size = number_of_frames * bytes_per_frame;
219 scoped_array<uint8> buf(new uint8[buf_size]); 219 scoped_array<uint8> buf(new uint8[buf_size]);
220 220
221 uint32 filled = FillBuffer(buf.get(), buf_size, request_delay); 221 uint32 filled_frames = FillBuffer(buf.get(), number_of_frames, request_delay);
acolwell GONE FROM CHROMIUM 2012/02/22 07:51:40 nit: rename frames_filled to be consistent with by
vrk (LEFT CHROMIUM) 2012/02/23 20:33:06 Done.
222 DCHECK_LE(filled, buf_size); 222 uint32 bytes_filled = filled_frames * bytes_per_frame;
223 UpdateEarliestEndTime(filled, request_delay, base::Time::Now()); 223 DCHECK_LE(bytes_filled, buf_size);
224 224 UpdateEarliestEndTime(bytes_filled, request_delay, base::Time::Now());
225 uint32 filled_frames = filled / bytes_per_frame;
226 225
227 // Deinterleave each audio channel. 226 // Deinterleave each audio channel.
228 int channels = audio_data.size(); 227 int channels = audio_data.size();
229 for (int channel_index = 0; channel_index < channels; ++channel_index) { 228 for (int channel_index = 0; channel_index < channels; ++channel_index) {
230 media::DeinterleaveAudioChannel(buf.get(), 229 media::DeinterleaveAudioChannel(buf.get(),
231 audio_data[channel_index], 230 audio_data[channel_index],
232 channels, 231 channels,
233 channel_index, 232 channel_index,
234 bytes_per_frame / channels, 233 bytes_per_frame / channels,
235 filled_frames); 234 filled_frames);
(...skipping 11 matching lines...) Expand all
247 246
248 void AudioRendererImpl::OnRenderError() { 247 void AudioRendererImpl::OnRenderError() {
249 host()->DisableAudioRenderer(); 248 host()->DisableAudioRenderer();
250 } 249 }
251 250
252 void AudioRendererImpl::OnRenderEndOfStream() { 251 void AudioRendererImpl::OnRenderEndOfStream() {
253 // TODO(enal): schedule callback instead of polling. 252 // TODO(enal): schedule callback instead of polling.
254 if (base::Time::Now() >= earliest_end_time_) 253 if (base::Time::Now() >= earliest_end_time_)
255 SignalEndOfStream(); 254 SignalEndOfStream();
256 } 255 }
OLDNEW
« no previous file with comments | « no previous file | media/audio/audio_util.h » ('j') | media/base/seekable_buffer.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698