mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 13:51:41 +00:00
Bug 1351160 - accept only integral types for operator*(). r=gerald
See bug 853398 for the reason to block double multiplier which is slower and less precise for large values. Also we remove the friend functions of operator* because it is easy to cause overloading ambiguity when making them templates. MozReview-Commit-ID: FhIWSHDd41b --HG-- extra : rebase_source : e9fec65dfb0b077dd7f962eb20af719c0dc76df8
This commit is contained in:
parent
38e85fef97
commit
fb7b33fc4f
@ -205,11 +205,15 @@ public:
|
||||
return *this;
|
||||
}
|
||||
|
||||
friend TimeUnit operator* (int aVal, const TimeUnit& aUnit) {
|
||||
return TimeUnit(aUnit.mValue * aVal);
|
||||
template <typename T>
|
||||
TimeUnit operator*(T aVal) const {
|
||||
// See bug 853398 for the reason to block double multiplier.
|
||||
// If required, use MultDouble below and with caution.
|
||||
static_assert(mozilla::IsIntegral<T>::value, "Must be an integral type");
|
||||
return TimeUnit(mValue * aVal);
|
||||
}
|
||||
friend TimeUnit operator* (const TimeUnit& aUnit, int aVal) {
|
||||
return TimeUnit(aUnit.mValue * aVal);
|
||||
TimeUnit MultDouble(double aVal) const {
|
||||
return TimeUnit::FromSeconds(ToSeconds() * aVal);
|
||||
}
|
||||
friend TimeUnit operator/ (const TimeUnit& aUnit, int aVal) {
|
||||
return TimeUnit(aUnit.mValue / aVal);
|
||||
|
@ -1505,7 +1505,7 @@ TrackBuffersManager::ProcessFrames(TrackBuffer& aSamples, TrackData& aTrackData)
|
||||
if (needDiscontinuityCheck && trackBuffer.mLastDecodeTimestamp.isSome() &&
|
||||
(decodeTimestamp < trackBuffer.mLastDecodeTimestamp.ref() ||
|
||||
(decodeTimestamp - trackBuffer.mLastDecodeTimestamp.ref()
|
||||
> 2 * trackBuffer.mLongestFrameDuration))) {
|
||||
> trackBuffer.mLongestFrameDuration * 2))) {
|
||||
MSE_DEBUG("Discontinuity detected.");
|
||||
SourceBufferAppendMode appendMode = mSourceBufferAttributes->GetAppendMode();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user