diff --git a/dom/media/TimeUnits.h b/dom/media/TimeUnits.h index 2f03fded7726..d815b9d4032b 100644 --- a/dom/media/TimeUnits.h +++ b/dom/media/TimeUnits.h @@ -93,7 +93,9 @@ public: if (mozilla::IsInfinite(aValue)) { return FromInfinity(); } - double val = aValue * USECS_PER_S; + // Due to internal double representation, this + // operation is not commutative, do not attempt to simplify. + double val = (aValue + .0000005) * USECS_PER_S; if (val >= double(INT64_MAX)) { return FromMicroseconds(INT64_MAX); } else if (val <= double(INT64_MIN)) {