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
--- 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);