Bug 1261192 - Make EMEDecryptor clear decrypted samples' crypto field before passing to wrapped MediaDataDecoder for decoding. r=gerald, a=ritu
authorChris Pearce <cpearce@mozilla.com>
Fri, 01 Apr 2016 13:53:01 +1300
changeset 323858 5c1cf0a4ab8d75fea8c7bd41b7224f24fef807bd
parent 323857 1caddf0eaae57e857e18b31f664579a25093aa5e
child 323859 7c3e676329cdfd791a889c838ba79620dc794b17
push id5913
push userjlund@mozilla.com
push dateMon, 25 Apr 2016 16:57:49 +0000
treeherdermozilla-beta@dcaf0a6fa115 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgerald, ritu
bugs1261192
milestone47.0a2
Bug 1261192 - Make EMEDecryptor clear decrypted samples' crypto field before passing to wrapped MediaDataDecoder for decoding. r=gerald, a=ritu 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);