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

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

Issue 316733006: Revert 258215 "Remove muting for extreme playbackRates." (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1916/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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 frames_enqueued_ += kFrameSize; 147 frames_enqueued_ += kFrameSize;
148 } 148 }
149 } 149 }
150 150
151 void CheckFakeData(AudioBus* audio_data, int frames_written) { 151 void CheckFakeData(AudioBus* audio_data, int frames_written) {
152 // Check each channel individually. 152 // Check each channel individually.
153 for (int ch = 0; ch < channels_; ++ch) { 153 for (int ch = 0; ch < channels_; ++ch) {
154 bool all_zero = true; 154 bool all_zero = true;
155 for (int i = 0; i < frames_written && all_zero; ++i) 155 for (int i = 0; i < frames_written && all_zero; ++i)
156 all_zero = audio_data->channel(ch)[i] == 0.0f; 156 all_zero = audio_data->channel(ch)[i] == 0.0f;
157 ASSERT_FALSE(all_zero) << " for channel " << ch; 157 ASSERT_EQ(algorithm_.is_muted(), all_zero) << " for channel " << ch;
158 } 158 }
159 } 159 }
160 160
161 int ComputeConsumedFrames(int initial_frames_enqueued, 161 int ComputeConsumedFrames(int initial_frames_enqueued,
162 int initial_frames_buffered) { 162 int initial_frames_buffered) {
163 int frame_delta = frames_enqueued_ - initial_frames_enqueued; 163 int frame_delta = frames_enqueued_ - initial_frames_enqueued;
164 int buffered_delta = algorithm_.frames_buffered() - initial_frames_buffered; 164 int buffered_delta = algorithm_.frames_buffered() - initial_frames_buffered;
165 int consumed = frame_delta - buffered_delta; 165 int consumed = frame_delta - buffered_delta;
166 CHECK_GE(consumed, 0); 166 CHECK_GE(consumed, 0);
167 return consumed; 167 return consumed;
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after
637 637
638 TEST_F(AudioRendererAlgorithmTest, WsolaSlowdown) { 638 TEST_F(AudioRendererAlgorithmTest, WsolaSlowdown) {
639 WsolaTest(0.6f); 639 WsolaTest(0.6f);
640 } 640 }
641 641
642 TEST_F(AudioRendererAlgorithmTest, WsolaSpeedup) { 642 TEST_F(AudioRendererAlgorithmTest, WsolaSpeedup) {
643 WsolaTest(1.6f); 643 WsolaTest(1.6f);
644 } 644 }
645 645
646 } // namespace media 646 } // 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