| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #include "base/test/simple_test_tick_clock.h" | 5 #include "base/test/simple_test_tick_clock.h" |
| 6 #include "media/cast/audio_receiver/audio_decoder.h" | 6 #include "media/cast/audio_receiver/audio_decoder.h" |
| 7 #include "media/cast/cast_environment.h" | 7 #include "media/cast/cast_environment.h" |
| 8 #include "media/cast/test/fake_task_runner.h" | 8 #include "media/cast/test/fake_task_runner.h" |
| 9 #include "testing/gmock/include/gmock/gmock.h" | 9 #include "testing/gmock/include/gmock/gmock.h" |
| 10 | 10 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 }; | 24 }; |
| 25 } // namespace. | 25 } // namespace. |
| 26 | 26 |
| 27 class AudioDecoderTest : public ::testing::Test { | 27 class AudioDecoderTest : public ::testing::Test { |
| 28 protected: | 28 protected: |
| 29 AudioDecoderTest() { | 29 AudioDecoderTest() { |
| 30 testing_clock_.Advance(base::TimeDelta::FromMilliseconds(1234)); | 30 testing_clock_.Advance(base::TimeDelta::FromMilliseconds(1234)); |
| 31 task_runner_ = new test::FakeTaskRunner(&testing_clock_); | 31 task_runner_ = new test::FakeTaskRunner(&testing_clock_); |
| 32 cast_environment_ = new CastEnvironment(&testing_clock_, task_runner_, | 32 cast_environment_ = new CastEnvironment(&testing_clock_, task_runner_, |
| 33 task_runner_, task_runner_, task_runner_, task_runner_, task_runner_, | 33 task_runner_, task_runner_, task_runner_, task_runner_, task_runner_, |
| 34 GetDefaultCastLoggingConfig()); | 34 GetDefaultCastReceiverLoggingConfig()); |
| 35 } | 35 } |
| 36 virtual ~AudioDecoderTest() {} | 36 virtual ~AudioDecoderTest() {} |
| 37 | 37 |
| 38 void Configure(const AudioReceiverConfig& audio_config) { | 38 void Configure(const AudioReceiverConfig& audio_config) { |
| 39 audio_decoder_.reset( | 39 audio_decoder_.reset( |
| 40 new AudioDecoder(cast_environment_, audio_config, &cast_feedback_)); | 40 new AudioDecoder(cast_environment_, audio_config, &cast_feedback_)); |
| 41 } | 41 } |
| 42 | 42 |
| 43 TestRtpPayloadFeedback cast_feedback_; | 43 TestRtpPayloadFeedback cast_feedback_; |
| 44 base::SimpleTestTickClock testing_clock_; | 44 base::SimpleTestTickClock testing_clock_; |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 // Resampling makes the variance worse. | 211 // Resampling makes the variance worse. |
| 212 for (size_t i = 100 * audio_config.channels; i < audio_frame.samples.size(); | 212 for (size_t i = 100 * audio_config.channels; i < audio_frame.samples.size(); |
| 213 ++i) { | 213 ++i) { |
| 214 EXPECT_NEAR(0x3412, audio_frame.samples[i], 400); | 214 EXPECT_NEAR(0x3412, audio_frame.samples[i], 400); |
| 215 if (0x3412 == audio_frame.samples[i]) count++; | 215 if (0x3412 == audio_frame.samples[i]) count++; |
| 216 } | 216 } |
| 217 } | 217 } |
| 218 | 218 |
| 219 } // namespace cast | 219 } // namespace cast |
| 220 } // namespace media | 220 } // namespace media |
| OLD | NEW |