| OLD | NEW |
| 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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 frames_enqueued_ += kFrameSize; | 134 frames_enqueued_ += kFrameSize; |
| 135 } | 135 } |
| 136 } | 136 } |
| 137 | 137 |
| 138 void CheckFakeData(AudioBus* audio_data, int frames_written) { | 138 void CheckFakeData(AudioBus* audio_data, int frames_written) { |
| 139 // Check each channel individually. | 139 // Check each channel individually. |
| 140 for (int ch = 0; ch < channels_; ++ch) { | 140 for (int ch = 0; ch < channels_; ++ch) { |
| 141 bool all_zero = true; | 141 bool all_zero = true; |
| 142 for (int i = 0; i < frames_written && all_zero; ++i) | 142 for (int i = 0; i < frames_written && all_zero; ++i) |
| 143 all_zero = audio_data->channel(ch)[i] == 0.0f; | 143 all_zero = audio_data->channel(ch)[i] == 0.0f; |
| 144 ASSERT_EQ(algorithm_.is_muted(), all_zero) << " for channel " << ch; | 144 ASSERT_FALSE(all_zero) << " for channel " << ch; |
| 145 } | 145 } |
| 146 } | 146 } |
| 147 | 147 |
| 148 int ComputeConsumedFrames(int initial_frames_enqueued, | 148 int ComputeConsumedFrames(int initial_frames_enqueued, |
| 149 int initial_frames_buffered) { | 149 int initial_frames_buffered) { |
| 150 int frame_delta = frames_enqueued_ - initial_frames_enqueued; | 150 int frame_delta = frames_enqueued_ - initial_frames_enqueued; |
| 151 int buffered_delta = algorithm_.frames_buffered() - initial_frames_buffered; | 151 int buffered_delta = algorithm_.frames_buffered() - initial_frames_buffered; |
| 152 int consumed = frame_delta - buffered_delta; | 152 int consumed = frame_delta - buffered_delta; |
| 153 CHECK_GE(consumed, 0); | 153 CHECK_GE(consumed, 0); |
| 154 return consumed; | 154 return consumed; |
| (...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 603 | 603 |
| 604 TEST_F(AudioRendererAlgorithmTest, WsolaSlowdown) { | 604 TEST_F(AudioRendererAlgorithmTest, WsolaSlowdown) { |
| 605 WsolaTest(0.6f); | 605 WsolaTest(0.6f); |
| 606 } | 606 } |
| 607 | 607 |
| 608 TEST_F(AudioRendererAlgorithmTest, WsolaSpeedup) { | 608 TEST_F(AudioRendererAlgorithmTest, WsolaSpeedup) { |
| 609 WsolaTest(1.6f); | 609 WsolaTest(1.6f); |
| 610 } | 610 } |
| 611 | 611 |
| 612 } // namespace media | 612 } // namespace media |
| OLD | NEW |