| 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 #include "media/renderers/audio_renderer_impl.h" | 5 #include "media/renderers/audio_renderer_impl.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 | 66 |
| 67 class AudioRendererImplTest : public ::testing::Test { | 67 class AudioRendererImplTest : public ::testing::Test { |
| 68 public: | 68 public: |
| 69 // Give the decoder some non-garbage media properties. | 69 // Give the decoder some non-garbage media properties. |
| 70 AudioRendererImplTest() | 70 AudioRendererImplTest() |
| 71 : hardware_config_(AudioParameters(), AudioParameters()), | 71 : hardware_config_(AudioParameters(), AudioParameters()), |
| 72 tick_clock_(new base::SimpleTestTickClock()), | 72 tick_clock_(new base::SimpleTestTickClock()), |
| 73 demuxer_stream_(DemuxerStream::AUDIO), | 73 demuxer_stream_(DemuxerStream::AUDIO), |
| 74 decoder_(new MockAudioDecoder()), | 74 decoder_(new MockAudioDecoder()), |
| 75 ended_(false) { | 75 ended_(false) { |
| 76 AudioDecoderConfig audio_config(kCodec, | 76 AudioDecoderConfig audio_config(kCodec, kSampleFormat, kChannelLayout, |
| 77 kSampleFormat, | 77 kInputSamplesPerSecond, EmptyExtraData(), |
| 78 kChannelLayout, | 78 Unencrypted()); |
| 79 kInputSamplesPerSecond, | |
| 80 EmptyExtraData(), | |
| 81 false); | |
| 82 demuxer_stream_.set_audio_decoder_config(audio_config); | 79 demuxer_stream_.set_audio_decoder_config(audio_config); |
| 83 | 80 |
| 84 // Used to save callbacks and run them at a later time. | 81 // Used to save callbacks and run them at a later time. |
| 85 EXPECT_CALL(*decoder_, Decode(_, _)) | 82 EXPECT_CALL(*decoder_, Decode(_, _)) |
| 86 .WillRepeatedly(Invoke(this, &AudioRendererImplTest::DecodeDecoder)); | 83 .WillRepeatedly(Invoke(this, &AudioRendererImplTest::DecodeDecoder)); |
| 87 EXPECT_CALL(*decoder_, Reset(_)) | 84 EXPECT_CALL(*decoder_, Reset(_)) |
| 88 .WillRepeatedly(Invoke(this, &AudioRendererImplTest::ResetDecoder)); | 85 .WillRepeatedly(Invoke(this, &AudioRendererImplTest::ResetDecoder)); |
| 89 | 86 |
| 90 // Mock out demuxer reads. | 87 // Mock out demuxer reads. |
| 91 EXPECT_CALL(demuxer_stream_, Read(_)).WillRepeatedly( | 88 EXPECT_CALL(demuxer_stream_, Read(_)).WillRepeatedly( |
| (...skipping 799 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 891 // Advance far enough that we shouldn't be clamped to current time (tested | 888 // Advance far enough that we shouldn't be clamped to current time (tested |
| 892 // already above). | 889 // already above). |
| 893 tick_clock_->Advance(kOneSecond); | 890 tick_clock_->Advance(kOneSecond); |
| 894 EXPECT_EQ( | 891 EXPECT_EQ( |
| 895 current_time + timestamp_helper.GetFrameDuration(frames_to_consume.value), | 892 current_time + timestamp_helper.GetFrameDuration(frames_to_consume.value), |
| 896 CurrentMediaWallClockTime(&is_time_moving)); | 893 CurrentMediaWallClockTime(&is_time_moving)); |
| 897 EXPECT_TRUE(is_time_moving); | 894 EXPECT_TRUE(is_time_moving); |
| 898 } | 895 } |
| 899 | 896 |
| 900 } // namespace media | 897 } // namespace media |
| OLD | NEW |