Bug 1422657. P1 - GetStatistics() should pass mPlaybackPosition to mResource->GetCachedDataEnd(). r=bechen,gerald draft
authorJW Wang <jwwang@mozilla.com>
Fri, 01 Dec 2017 13:53:46 +0800
changeset 708101 1f40adce4b93dbcf55cb3de9f5c16fdd6d0b6bee
parent 708100 608c24949e60fff86e3fb4eb873d38ab8b040d23
child 708102 2b9abaa1a22b78cadbbdbf99d1c778fe82f84eac
push id92285
push userjwwang@mozilla.com
push dateWed, 06 Dec 2017 07:14:46 +0000
reviewersbechen, gerald
bugs1422657
milestone59.0a1
Bug 1422657. P1 - GetStatistics() should pass mPlaybackPosition to mResource->GetCachedDataEnd(). r=bechen,gerald Usually mDecoderPosition and mPlaybackPosition are in the same cached range so GetCachedDataEnd(mDecoderPosition) and GetCachedDataEnd(mPlaybackPosition) will give the same result. It also makes more sense to pass the playback position instead of decoder position since 'canplaythrough' is about playback instead of decoding. MozReview-Commit-ID: Kk1uUeSFTCI
dom/media/ChannelMediaDecoder.cpp
--- a/dom/media/ChannelMediaDecoder.cpp
+++ b/dom/media/ChannelMediaDecoder.cpp
@@ -439,17 +439,17 @@ MediaStatistics
 ChannelMediaDecoder::GetStatistics(const PlaybackRateInfo& aInfo)
 {
   MOZ_ASSERT(NS_IsMainThread());
   MOZ_ASSERT(mResource);
 
   MediaStatistics result;
   result.mDownloadRate =
     mResource->GetDownloadRate(&result.mDownloadRateReliable);
-  result.mDownloadPosition = mResource->GetCachedDataEnd(mDecoderPosition);
+  result.mDownloadPosition = mResource->GetCachedDataEnd(mPlaybackPosition);
   result.mTotalBytes = mResource->GetLength();
   result.mPlaybackRate = aInfo.mRate;
   result.mPlaybackRateReliable = aInfo.mReliable;
   result.mPlaybackPosition = mPlaybackPosition;
   return result;
 }
 
 bool