OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/base/audio_timestamp_helper.h" | 5 #include "media/base/audio_timestamp_helper.h" |
6 #include "media/base/buffers.h" | 6 #include "media/base/buffers.h" |
7 #include "media/filters/audio_clock.h" | 7 #include "media/filters/audio_clock.h" |
8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
9 | 9 |
10 namespace media { | 10 namespace media { |
11 | 11 |
12 class AudioClockTest : public testing::Test { | 12 class AudioClockTest : public testing::Test { |
13 public: | 13 public: |
14 AudioClockTest() | 14 AudioClockTest() |
15 : sample_rate_(10), clock_(base::TimeDelta(), sample_rate_) {} | 15 : sample_rate_(10), clock_(base::TimeDelta(), sample_rate_) {} |
16 | 16 |
17 virtual ~AudioClockTest() {} | 17 ~AudioClockTest() override {} |
18 | 18 |
19 void WroteAudio(int frames_written, | 19 void WroteAudio(int frames_written, |
20 int frames_requested, | 20 int frames_requested, |
21 int delay_frames, | 21 int delay_frames, |
22 float playback_rate) { | 22 float playback_rate) { |
23 clock_.WroteAudio( | 23 clock_.WroteAudio( |
24 frames_written, frames_requested, delay_frames, playback_rate); | 24 frames_written, frames_requested, delay_frames, playback_rate); |
25 } | 25 } |
26 | 26 |
27 int FrontTimestampInDays() { return clock_.front_timestamp().InDays(); } | 27 int FrontTimestampInDays() { return clock_.front_timestamp().InDays(); } |
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
378 EXPECT_EQ(huge.InDays(), ContiguousAudioDataBufferedInDays()); | 378 EXPECT_EQ(huge.InDays(), ContiguousAudioDataBufferedInDays()); |
379 | 379 |
380 // Use huge delay to test calculation of buffered data. | 380 // Use huge delay to test calculation of buffered data. |
381 WroteAudio( | 381 WroteAudio( |
382 huge_amount_of_frames, huge_amount_of_frames, huge_amount_of_frames, 1.0); | 382 huge_amount_of_frames, huge_amount_of_frames, huge_amount_of_frames, 1.0); |
383 EXPECT_EQ((huge * 3).InDays(), FrontTimestampInDays()); | 383 EXPECT_EQ((huge * 3).InDays(), FrontTimestampInDays()); |
384 EXPECT_EQ((huge * 2).InDays(), ContiguousAudioDataBufferedInDays()); | 384 EXPECT_EQ((huge * 2).InDays(), ContiguousAudioDataBufferedInDays()); |
385 } | 385 } |
386 | 386 |
387 } // namespace media | 387 } // namespace media |
OLD | NEW |