Bug 1098126 - Disable MoofParser for EME; r=rillian
☠☠ backed out by 225f36741b2f ☠ ☠
authorAnthony Jones <ajones@mozilla.com>
Fri, 05 Dec 2014 14:01:44 -0800
changeset 219233 81bdd9d3aa258269fbc734f741322712951463a6
parent 219232 4b8bb6132ae1c9ec4205b214c51e510756c6f46c
child 219234 49a918ec025fba6c0fcfa83b404a10f2dd18b310
push id10368
push userkwierso@gmail.com
push dateFri, 12 Dec 2014 01:38:39 +0000
treeherderfx-team@5288b15d22de [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrillian
bugs1098126
milestone37.0a1
Bug 1098126 - Disable MoofParser for EME; r=rillian
media/libstagefright/binding/MoofParser.cpp
media/libstagefright/binding/mp4_demuxer.cpp
--- a/media/libstagefright/binding/MoofParser.cpp
+++ b/media/libstagefright/binding/MoofParser.cpp
@@ -1,14 +1,15 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "mp4_demuxer/MoofParser.h"
 #include "mp4_demuxer/Box.h"
+#include <limits>
 
 namespace mp4_demuxer
 {
 
 using namespace stagefright;
 using namespace mozilla;
 
 void
@@ -67,20 +68,18 @@ public:
 private:
   nsRefPtr<Stream> mStream;
 };
 
 bool
 MoofParser::BlockingReadNextMoof()
 {
   nsTArray<MediaByteRange> byteRanges;
-  int64_t size;
-  bool hasSize = mSource->Length(&size);
   byteRanges.AppendElement(
-    MediaByteRange(0,hasSize ? size : std::numeric_limits<int64_t>::max()));
+    MediaByteRange(0, std::numeric_limits<int64_t>::max()));
   mp4_demuxer::BlockingStream* stream = new BlockingStream(mSource);
 
   BoxContext context(stream, byteRanges);
   for (Box box(&context, mOffset); box.IsAvailable(); box = box.Next()) {
     if (box.IsType("moof")) {
       byteRanges.Clear();
       byteRanges.AppendElement(MediaByteRange(mOffset, box.Range().mEnd));
       RebuildFragmentedIndex(context);
--- a/media/libstagefright/binding/mp4_demuxer.cpp
+++ b/media/libstagefright/binding/mp4_demuxer.cpp
@@ -106,30 +106,30 @@ MP4Demuxer::Init()
       if (track->start() != OK) {
         return false;
       }
       mPrivate->mAudio = track;
       mAudioConfig.Update(metaData, mimeType);
       nsRefPtr<Index> index = new Index(mPrivate->mAudio->exportIndex(),
                                         mSource, mAudioConfig.mTrackId);
       mPrivate->mIndexes.AppendElement(index);
-      if (index->IsFragmented()) {
+      if (index->IsFragmented() && !mAudioConfig.crypto.valid) {
         mPrivate->mAudioIterator = new SampleIterator(index);
       }
     } else if (!mPrivate->mVideo.get() && !strncmp(mimeType, "video/", 6)) {
       sp<MediaSource> track = e->getTrack(i);
       if (track->start() != OK) {
         return false;
       }
       mPrivate->mVideo = track;
       mVideoConfig.Update(metaData, mimeType);
       nsRefPtr<Index> index = new Index(mPrivate->mVideo->exportIndex(),
                                         mSource, mVideoConfig.mTrackId);
       mPrivate->mIndexes.AppendElement(index);
-      if (index->IsFragmented()) {
+      if (index->IsFragmented() && !mVideoConfig.crypto.valid) {
         mPrivate->mVideoIterator = new SampleIterator(index);
       }
     }
   }
   sp<MetaData> metaData = e->getMetaData();
   mCrypto.Update(metaData);
 
   return mPrivate->mAudio.get() || mPrivate->mVideo.get();