Internal change
PiperOrigin-RevId: 153188364
Change-Id: Ic8dcb827b7ce77ff822b50d520a527cee34c0203
diff --git a/src/mp4util.cpp b/src/mp4util.cpp
index 47bd74e..932b22d 100644
--- a/src/mp4util.cpp
+++ b/src/mp4util.cpp
@@ -259,7 +259,8 @@
// check if we can safely use integer operations
if (ilog2(t) + ilog2(newTimeScale) <= 64) {
- return (t * newTimeScale) / oldTimeScale;
+ // convert with rounding.
+ return (t * newTimeScale + oldTimeScale / 2) / oldTimeScale;
}
// final resort is to use floating point