Bug 1421179. P3 - ComputePlaybackRate() should call mPlaybackStatistics.GetRate() instead of mPlaybackStatistics.GetRateAtLastStop().
Otherwise mPlaybackBytesPerSecond will always be zero before playback is
stopped for the 1st time. This is important for a live stream where playback
rate can't be calculated from the duration and resource length (-1).
MozReview-Commit-ID: GEojREzHVEz
--- a/dom/media/ChannelMediaDecoder.cpp
+++ b/dom/media/ChannelMediaDecoder.cpp
@@ -406,17 +406,17 @@ ChannelMediaDecoder::ComputePlaybackRate
int64_t length = mResource->GetLength();
if (mozilla::IsFinite<double>(mDuration) && mDuration > 0 && length >= 0) {
mPlaybackRateReliable = true;
mPlaybackBytesPerSecond = length / mDuration;
return;
}
bool reliable = false;
- mPlaybackBytesPerSecond = mPlaybackStatistics.GetRateAtLastStop(&reliable);
+ mPlaybackBytesPerSecond = mPlaybackStatistics.GetRate(&reliable);
mPlaybackRateReliable = reliable;
}
void
ChannelMediaDecoder::UpdatePlaybackRate()
{
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(mResource);