Bug 999364 : Fix the cluster length for WebM. r=rillian
authorBenjamin Chen <bechen@mozilla.com>
Wed, 30 Apr 2014 10:08:41 +0800
changeset 181350 8cb07945825cc2500fd0e8ec537e9e295682fd81
parent 181349 d05f273a2d1d73487f882840054c752497e7f864
child 181351 8ada6d76215baa84b8a2e65e10fbc3aff382a27a
push id272
push userpvanderbeken@mozilla.com
push dateMon, 05 May 2014 16:31:18 +0000
reviewersrillian
bugs999364
milestone32.0a1
Bug 999364 : Fix the cluster length for WebM. r=rillian
content/media/webm/EbmlComposer.cpp
--- a/content/media/webm/EbmlComposer.cpp
+++ b/content/media/webm/EbmlComposer.cpp
@@ -83,17 +83,20 @@ void EbmlComposer::FinishCluster()
     // No completed cluster available.
     return;
   }
 
   MOZ_ASSERT(mClusterLengthLoc > 0);
   EbmlGlobal ebml;
   EbmlLoc ebmlLoc;
   ebmlLoc.offset = mClusterLengthLoc;
-  ebml.offset = mClusterBuffs[mClusterHeaderIndex].Length();
+  ebml.offset = 0;
+  for (uint32_t i = mClusterHeaderIndex; i < mClusterBuffs.Length(); i++) {
+    ebml.offset += mClusterBuffs[i].Length();
+  }
   ebml.buf = mClusterBuffs[mClusterHeaderIndex].Elements();
   Ebml_EndSubElement(&ebml, &ebmlLoc);
   // Move the mClusterBuffs data from mClusterHeaderIndex that we can skip
   // the metadata and the rest P-frames after ContainerWriter::FLUSH_NEEDED.
   for (uint32_t i = mClusterHeaderIndex; i < mClusterBuffs.Length(); i++) {
     mClusterCanFlushBuffs.AppendElement()->SwapElements(mClusterBuffs[i]);
   }