Bug 1540580 - WebM demuxer skips empty samples. r=jya
authorBryce Van Dyk <bvandyk@mozilla.com>
Tue, 30 Apr 2019 15:12:30 +0000
changeset 530780 1a102b35a05d4c5d93782755383f13044f433bb2
parent 530779 139a838ca42fb715041775925f0aa5a994700e74
child 530781 d8571fb523a061813ecd4e92526f60024dbb87d3
push id11265
push userffxbld-merge
push dateMon, 13 May 2019 10:53:39 +0000
treeherdermozilla-beta@77e0fe8dbdd3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjya
bugs1540580
milestone68.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1540580 - WebM demuxer skips empty samples. r=jya The mp4 demuxer already does this, so have the WebM case follow suit. This avoids asserts with creating 0 size shmems in the case where the demuxer is being used with the remote data decoder. Differential Revision: https://phabricator.services.mozilla.com/D25846
dom/media/webm/WebMDemuxer.cpp
--- a/dom/media/webm/WebMDemuxer.cpp
+++ b/dom/media/webm/WebMDemuxer.cpp
@@ -1088,16 +1088,22 @@ RefPtr<WebMTrackDemuxer::SamplesPromise>
   nsresult rv = NS_ERROR_DOM_MEDIA_END_OF_STREAM;
 
   while (aNumSamples) {
     RefPtr<MediaRawData> sample;
     rv = NextSample(sample);
     if (NS_FAILED(rv)) {
       break;
     }
+    // Ignore empty samples.
+    if (sample->Size() == 0) {
+      WEBM_DEBUG(
+          "0 sized sample encountered while getting samples, skipping it");
+      continue;
+    }
     if (mNeedKeyframe && !sample->mKeyframe) {
       continue;
     }
     mNeedKeyframe = false;
     samples->mSamples.AppendElement(sample);
     aNumSamples--;
   }