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

Unified Diff: media/cast/cast_defines.h

Issue 638123004: Type conversion fixes, media/ edition. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix test Created 6 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/base/sinc_resampler.cc ('k') | media/cast/common/clock_drift_smoother.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/cast/cast_defines.h
diff --git a/media/cast/cast_defines.h b/media/cast/cast_defines.h
index 76e252716e0bbd774d56857dea26cf58aceb3625..0be66d2b23031f61e3fdccac96e81cfa05b34fce 100644
--- a/media/cast/cast_defines.h
+++ b/media/cast/cast_defines.h
@@ -178,9 +178,10 @@ inline void ConvertTimeTicksToNtp(const base::TimeTicks& time,
inline base::TimeTicks ConvertNtpToTimeTicks(uint32 ntp_seconds,
uint32 ntp_fractions) {
- int64 ntp_time_us =
- static_cast<int64>(ntp_seconds) * base::Time::kMicrosecondsPerSecond +
- static_cast<int64>(ntp_fractions) / kMagicFractionalUnit;
+ // We need to ceil() here because the calculation of |fractions| in
wolenetz 2014/10/21 19:15:15 nit: fix compilation by #including std::ceil
Peter Kasting 2014/10/21 19:34:47 Done.
+ // ConvertTimeToFractions() effectively does a floor().
+ int64 ntp_time_us = ntp_seconds * base::Time::kMicrosecondsPerSecond +
+ static_cast<int64>(std::ceil(ntp_fractions / kMagicFractionalUnit));
wolenetz 2014/10/21 19:15:15 Though this works for the unit tests' hardcoded ti
wolenetz 2014/10/21 19:22:00 From offline chat w/pkasting@, the behavior-invari
Peter Kasting 2014/10/21 19:34:47 More detail: ceil() here is correct if we're tryi
base::TimeDelta elapsed_since_unix_epoch = base::TimeDelta::FromMicroseconds(
ntp_time_us -
« no previous file with comments | « media/base/sinc_resampler.cc ('k') | media/cast/common/clock_drift_smoother.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698