Bug 1261192 - Make EMEDecryptor clear decrypted samples' crypto field before passing to wrapped MediaDataDecoder for decoding. r=gerald
authorChris Pearce <cpearce@mozilla.com>
Fri, 01 Apr 2016 13:53:01 +1300
changeset 291166 ba007e9d5ef1195d196c171859ce911e8cf8604f
parent 291165 0d7b5a4fbffa4df34440e19c04e5628060315576
child 291167 c710d0da3ac166eab902071388e89c68c5fba4ea
push id19656
push usergwagner@mozilla.com
push dateMon, 04 Apr 2016 13:43:23 +0000
treeherderb2g-inbound@e99061fde28a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgerald
bugs1261192
milestone48.0a1
Bug 1261192 - Make EMEDecryptor clear decrypted samples' crypto field before passing to wrapped MediaDataDecoder for decoding. r=gerald The Adobe GMP unencrypted decoder can't decode unencrypted input which has valid crypto data attached; it thinks the sample is encrypted, and returns a crypto error and decoding fails. The sample should be decrypted by the time we pass it to the wrapped decoder, so decoding should succeed without the crypto data. MozReview-Commit-ID: KjZcQyYiRqp
dom/media/platforms/agnostic/eme/EMEDecoderModule.cpp
--- a/dom/media/platforms/agnostic/eme/EMEDecoderModule.cpp
+++ b/dom/media/platforms/agnostic/eme/EMEDecoderModule.cpp
@@ -86,16 +86,23 @@ public:
       // if the key becomes usable again.
       Input(aDecrypted.mSample);
     } else if (GMP_FAILED(aDecrypted.mStatus)) {
       if (mCallback) {
         mCallback->Error();
       }
     } else {
       MOZ_ASSERT(!mIsShutdown);
+      // The Adobe GMP AAC decoder gets confused if we pass it non-encrypted
+      // samples with valid crypto data. So clear the crypto data, since the
+      // sample should be decrypted now anyway. If we don't do this and we're
+      // using the Adobe GMP for unencrypted decoding of data that is decrypted
+      // by gmp-clearkey, decoding will fail.
+      UniquePtr<MediaRawDataWriter> writer(aDecrypted.mSample->CreateWriter());
+      writer->mCrypto = CryptoSample();
       nsresult rv = mDecoder->Input(aDecrypted.mSample);
       Unused << NS_WARN_IF(NS_FAILED(rv));
     }
   }
 
   nsresult Flush() override {
     MOZ_ASSERT(mTaskQueue->IsCurrentThreadIn());
     MOZ_ASSERT(!mIsShutdown);