Bug 1364834 - Fix rounding error in WaveDataDecoder::ProcessDecode(). r?jya
The duration is rounded down to 0 if |frames| is smaller than |mInfo.mRate|.
We should call FramesToTimeUnit() instead.
MozReview-Commit-ID: E7eOQuD48x2
--- a/dom/media/platforms/agnostic/WAVDecoder.cpp
+++ b/dom/media/platforms/agnostic/WAVDecoder.cpp
@@ -112,17 +112,17 @@ WaveDataDecoder::ProcessDecode(MediaRawD
int32_t v = aReader.ReadLE24();
buffer[i * mInfo.mChannels + j] =
Int24bitToAudioSample<AudioDataValue>(v);
}
}
}
}
- auto duration = media::TimeUnit::FromMicroseconds(frames / mInfo.mRate);
+ auto duration = FramesToTimeUnit(frames, mInfo.mRate);
return DecodePromise::CreateAndResolve(
DecodedData{ new AudioData(aOffset, aSample->mTime, duration, frames,
Move(buffer), mInfo.mChannels, mInfo.mRate) },
__func__);
}
RefPtr<MediaDataDecoder::DecodePromise>