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

Unified Diff: media/base/audio_timestamp_helper_unittest.cc

Issue 2562243005: Make AudioTimestampHelper::TimeToFrames() more accurate (Closed)
Patch Set: Modified unittests. Created 4 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/base/audio_timestamp_helper.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/base/audio_timestamp_helper_unittest.cc
diff --git a/media/base/audio_timestamp_helper_unittest.cc b/media/base/audio_timestamp_helper_unittest.cc
index 83bf57f1583397029ad9f48effe701e41d05f7f2..0ae2ad54f95d0b1a74009d2f05e9cb7e9eb654dd 100644
--- a/media/base/audio_timestamp_helper_unittest.cc
+++ b/media/base/audio_timestamp_helper_unittest.cc
@@ -80,9 +80,11 @@ TEST_F(AudioTimestampHelperTest, TimeToFrames) {
// Zero.
EXPECT_EQ(0, AudioTimestampHelper::TimeToFrames(
base::TimeDelta::FromMicroseconds(0), k48kHz));
- // Any duration less than 21 microseconds will return zero frames at 48 kHz
- // because each frame is 20.833 microseconds.
+ // Duration of each frame is 20.833 microseconds. The result is rounded to
+ // integral.
EXPECT_EQ(0, AudioTimestampHelper::TimeToFrames(
+ base::TimeDelta::FromMicroseconds(10), k48kHz));
+ EXPECT_EQ(1, AudioTimestampHelper::TimeToFrames(
base::TimeDelta::FromMicroseconds(20), k48kHz));
EXPECT_EQ(1, AudioTimestampHelper::TimeToFrames(
base::TimeDelta::FromMicroseconds(21), k48kHz));
« no previous file with comments | « media/base/audio_timestamp_helper.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698