Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(86)

Side by Side Diff: media/filters/audio_clock_unittest.cc

Issue 1094783002: Switch to double for time calculations using playback rate. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Making changes at chromecast side to fix trybots Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « media/blink/webmediaplayer_impl.cc ('k') | media/filters/audio_renderer_algorithm.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
OLDNEW
« no previous file with comments | « media/blink/webmediaplayer_impl.cc ('k') | media/filters/audio_renderer_algorithm.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698