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 ~AudioClockTest() override {} | 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 double 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(); } |
28 | 28 |
29 int FrontTimestampInMilliseconds() { | 29 int FrontTimestampInMilliseconds() { |
30 return clock_.front_timestamp().InMilliseconds(); | 30 return clock_.front_timestamp().InMilliseconds(); |
31 } | 31 } |
32 | 32 |
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 EXPECT_EQ(huge.InDays(), ContiguousAudioDataBufferedInDays()); | 324 EXPECT_EQ(huge.InDays(), ContiguousAudioDataBufferedInDays()); |
325 | 325 |
326 // Use huge delay to test calculation of buffered data. | 326 // Use huge delay to test calculation of buffered data. |
327 WroteAudio( | 327 WroteAudio( |
328 huge_amount_of_frames, huge_amount_of_frames, huge_amount_of_frames, 1.0); | 328 huge_amount_of_frames, huge_amount_of_frames, huge_amount_of_frames, 1.0); |
329 EXPECT_EQ((huge * 3).InDays(), FrontTimestampInDays()); | 329 EXPECT_EQ((huge * 3).InDays(), FrontTimestampInDays()); |
330 EXPECT_EQ((huge * 2).InDays(), ContiguousAudioDataBufferedInDays()); | 330 EXPECT_EQ((huge * 2).InDays(), ContiguousAudioDataBufferedInDays()); |
331 } | 331 } |
332 | 332 |
333 } // namespace media | 333 } // namespace media |
OLD | NEW |