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

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

Issue 313213002: Revert 258215 "Remove muting for extreme playbackRates." (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1985/src/
Patch Set: Created 6 years, 6 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 | « media/filters/audio_renderer_algorithm.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')
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 // The format of these tests are to enqueue a known amount of data and then 5 // The format of these tests are to enqueue a known amount of data and then
6 // request the exact amount we expect in order to dequeue the known amount of 6 // request the exact amount we expect in order to dequeue the known amount of
7 // data. This ensures that for any rate we are consuming input data at the 7 // data. This ensures that for any rate we are consuming input data at the
8 // correct rate. We always pass in a very large destination buffer with the 8 // correct rate. We always pass in a very large destination buffer with the
9 // expectation that FillBuffer() will fill as much as it can but no more. 9 // expectation that FillBuffer() will fill as much as it can but no more.
10 10
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 frames_enqueued_ += kFrameSize; 144 frames_enqueued_ += kFrameSize;
145 } 145 }
146 } 146 }
147 147
148 void CheckFakeData(AudioBus* audio_data, int frames_written) { 148 void CheckFakeData(AudioBus* audio_data, int frames_written) {
149 // Check each channel individually. 149 // Check each channel individually.
150 for (int ch = 0; ch < channels_; ++ch) { 150 for (int ch = 0; ch < channels_; ++ch) {
151 bool all_zero = true; 151 bool all_zero = true;
152 for (int i = 0; i < frames_written && all_zero; ++i) 152 for (int i = 0; i < frames_written && all_zero; ++i)
153 all_zero = audio_data->channel(ch)[i] == 0.0f; 153 all_zero = audio_data->channel(ch)[i] == 0.0f;
154 ASSERT_FALSE(all_zero) << " for channel " << ch; 154 ASSERT_EQ(algorithm_.is_muted(), all_zero) << " for channel " << ch;
155 } 155 }
156 } 156 }
157 157
158 int ComputeConsumedFrames(int initial_frames_enqueued, 158 int ComputeConsumedFrames(int initial_frames_enqueued,
159 int initial_frames_buffered) { 159 int initial_frames_buffered) {
160 int frame_delta = frames_enqueued_ - initial_frames_enqueued; 160 int frame_delta = frames_enqueued_ - initial_frames_enqueued;
161 int buffered_delta = algorithm_.frames_buffered() - initial_frames_buffered; 161 int buffered_delta = algorithm_.frames_buffered() - initial_frames_buffered;
162 int consumed = frame_delta - buffered_delta; 162 int consumed = frame_delta - buffered_delta;
163 CHECK_GE(consumed, 0); 163 CHECK_GE(consumed, 0);
164 return consumed; 164 return consumed;
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after
634 634
635 TEST_F(AudioRendererAlgorithmTest, WsolaSlowdown) { 635 TEST_F(AudioRendererAlgorithmTest, WsolaSlowdown) {
636 WsolaTest(0.6f); 636 WsolaTest(0.6f);
637 } 637 }
638 638
639 TEST_F(AudioRendererAlgorithmTest, WsolaSpeedup) { 639 TEST_F(AudioRendererAlgorithmTest, WsolaSpeedup) {
640 WsolaTest(1.6f); 640 WsolaTest(1.6f);
641 } 641 }
642 642
643 } // namespace media 643 } // namespace media
OLDNEW
« no previous file with comments | « media/filters/audio_renderer_algorithm.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698