Bug 1413108 - |count| is not incremented correctly in MediaCacheStream::Read() when reading the partial block. draft
authorJW Wang <jwwang@mozilla.com>
Tue, 31 Oct 2017 15:48:55 +0800
changeset 689180 8b209453a359657f90fafade704c38feaaec624d
parent 689081 083a9c84fbd09a6ff9bfecabbf773650842fe1c0
child 738259 e3c4655517d268371f0b0df40323f9eb76ea6d52
push id86956
push userjwwang@mozilla.com
push dateTue, 31 Oct 2017 07:50:55 +0000
bugs1413108
milestone58.0a1
Bug 1413108 - |count| is not incremented correctly in MediaCacheStream::Read() when reading the partial block. MozReview-Commit-ID: GzY2LqosWwO
dom/media/MediaCache.cpp
--- a/dom/media/MediaCache.cpp
+++ b/dom/media/MediaCache.cpp
@@ -2487,17 +2487,17 @@ MediaCacheStream::Read(char* aBuffer, ui
         bytes = std::min(bytes, int64_t(INT32_MAX));
         MOZ_ASSERT(bytes >= 0 && bytes <= aCount, "Bytes out of range.");
         memcpy(aBuffer,
           streamWithPartialBlock->mPartialBlockBuffer.get() + offsetInStreamBlock, bytes);
         if (mCurrentMode == MODE_METADATA) {
           streamWithPartialBlock->mMetadataInPartialBlockBuffer = true;
         }
         streamOffset += bytes;
-        count = bytes;
+        count += bytes;
         break;
       }
 
       // No data has been read yet, so block
       mon.Wait();
       if (mClosed) {
         // We may have successfully read some data, but let's just throw
         // that out.