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

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 compile 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..661c09524924d085fb043676fefe80203a3dbed2 100644
--- a/media/cast/cast_defines.h
+++ b/media/cast/cast_defines.h
@@ -7,6 +7,7 @@
#include <stdint.h>
+#include <cmath>
#include <map>
#include <set>
@@ -178,9 +179,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
+ // ConvertTimeToFractions() effectively does a floor().
+ int64 ntp_time_us = ntp_seconds * base::Time::kMicrosecondsPerSecond +
+ static_cast<int64>(std::ceil(ntp_fractions / kMagicFractionalUnit));
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