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

Unified 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: Rebase ToT 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/renderer/media/audio_hardware.cc ('k') | media/audio/audio_util.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/media/audio_renderer_impl.cc
diff --git a/content/renderer/media/audio_renderer_impl.cc b/content/renderer/media/audio_renderer_impl.cc
index 8b4c3249c4103cb32ddf8bdd4e4d3480be765080..b835e686b95ed5e62412c124fba3d04eb8bbe08c 100644
--- a/content/renderer/media/audio_renderer_impl.cc
+++ b/content/renderer/media/audio_renderer_impl.cc
@@ -199,11 +199,10 @@ size_t AudioRendererImpl::Render(const std::vector<float*>& audio_data,
const size_t buf_size = number_of_frames * bytes_per_frame;
scoped_array<uint8> buf(new uint8[buf_size]);
- uint32 filled = FillBuffer(buf.get(), buf_size, request_delay);
- DCHECK_LE(filled, buf_size);
- UpdateEarliestEndTime(filled, request_delay, base::Time::Now());
-
- uint32 filled_frames = filled / bytes_per_frame;
+ uint32 frames_filled = FillBuffer(buf.get(), number_of_frames, request_delay);
+ uint32 bytes_filled = frames_filled * bytes_per_frame;
+ DCHECK_LE(bytes_filled, buf_size);
+ UpdateEarliestEndTime(bytes_filled, request_delay, base::Time::Now());
// Deinterleave each audio channel.
int channels = audio_data.size();
@@ -213,17 +212,17 @@ size_t AudioRendererImpl::Render(const std::vector<float*>& audio_data,
channels,
channel_index,
bytes_per_frame / channels,
- filled_frames);
+ frames_filled);
// If FillBuffer() didn't give us enough data then zero out the remainder.
- if (filled_frames < number_of_frames) {
- int frames_to_zero = number_of_frames - filled_frames;
- memset(audio_data[channel_index] + filled_frames,
+ if (frames_filled < number_of_frames) {
+ int frames_to_zero = number_of_frames - frames_filled;
+ memset(audio_data[channel_index] + frames_filled,
0,
sizeof(float) * frames_to_zero);
}
}
- return filled_frames;
+ return frames_filled;
}
void AudioRendererImpl::OnRenderError() {
« no previous file with comments | « content/renderer/media/audio_hardware.cc ('k') | media/audio/audio_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698