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

Unified Diff: media/filters/audio_renderer_base_unittest.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 | « media/filters/audio_renderer_base.cc ('k') | media/filters/null_audio_renderer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/filters/audio_renderer_base_unittest.cc
diff --git a/media/filters/audio_renderer_base_unittest.cc b/media/filters/audio_renderer_base_unittest.cc
index 4ada3e4a8607fa1fbafc7c3da38a03fd7b09ab21..58bc59f43f8368dae31f97daf9078c7bfc67a430 100644
--- a/media/filters/audio_renderer_base_unittest.cc
+++ b/media/filters/audio_renderer_base_unittest.cc
@@ -184,12 +184,16 @@ class AudioRendererBaseTest : public ::testing::Test {
// the consumed data is muted audio.
bool ConsumeBufferedData(uint32 size, bool* muted) {
scoped_array<uint8> buffer(new uint8[size]);
- uint32 bytes_read = renderer_->FillBuffer(buffer.get(), size,
- base::TimeDelta());
- if (bytes_read > 0 && muted) {
+ uint32 bytes_per_frame = (decoder_->bits_per_channel() / 8) *
+ ChannelLayoutToChannelCount(decoder_->channel_layout());
+ uint32 requested_frames = size / bytes_per_frame;
+ uint32 frames_read = renderer_->FillBuffer(
+ buffer.get(), requested_frames, base::TimeDelta());
+
+ if (frames_read > 0 && muted) {
*muted = (buffer[0] == kMutedAudio);
}
- return (bytes_read == size);
+ return (frames_read == requested_frames);
}
uint32 bytes_buffered() {
« no previous file with comments | « media/filters/audio_renderer_base.cc ('k') | media/filters/null_audio_renderer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698