Bug 1318965 - Changes the way the the 'DeinitializeDecoder' method in the ClearkeyCDM works r?cpearce draft
authorJay Harris <jharris@mozilla.com>
Wed, 18 Jan 2017 14:49:04 +1300
changeset 462853 783430c2d92018d686ddd8779bea1939936c618a
parent 462852 5b8765b7070d659501cb97df2dd157b51e6c14f3
child 462854 a0527f189a8ee834d9b4a8a7cda1c16bea2fbc4d
child 462865 432ab764dcec12da295294615e8024a9fdfe7662
push id41870
push userbmo:jharris@mozilla.com
push dateWed, 18 Jan 2017 02:25:40 +0000
reviewerscpearce
bugs1318965
milestone53.0a1
Bug 1318965 - Changes the way the the 'DeinitializeDecoder' method in the ClearkeyCDM works r?cpearce It is now more inline with the api spec in content_decryption_module MozReview-Commit-ID: KmZzyfvHv5p
media/gmp-clearkey/0.1/ClearKeyCDM.cpp
--- a/media/gmp-clearkey/0.1/ClearKeyCDM.cpp
+++ b/media/gmp-clearkey/0.1/ClearKeyCDM.cpp
@@ -11,20 +11,16 @@ ClearKeyCDM::ClearKeyCDM(Host_8* aHost)
 }
 
 void
 ClearKeyCDM::Initialize(bool aAllowDistinctiveIdentifier,
                         bool aAllowPersistentState)
 {
   mSessionManager->Init(aAllowDistinctiveIdentifier,
                         aAllowPersistentState);
-
-#ifdef ENABLE_WMF
-  mVideoDecoder = new VideoDecoder(mHost);
-#endif
 }
 
 void
 ClearKeyCDM::SetServerCertificate(uint32_t aPromiseId,
                                   const uint8_t* aServerCertificateData,
                                   uint32_t aServerCertificateDataSize)
 {
   mSessionManager->SetServerCertificate(aPromiseId,
@@ -116,28 +112,30 @@ ClearKeyCDM::InitializeAudioDecoder(
   return Status::kDecodeError;
 }
 
 Status
 ClearKeyCDM::InitializeVideoDecoder(
   const VideoDecoderConfig& aVideoDecoderConfig)
 {
 #ifdef ENABLE_WMF
+  mVideoDecoder = new VideoDecoder(mHost);
   return mVideoDecoder->InitDecode(aVideoDecoderConfig);
 #else
   return Status::kDecodeError;
 #endif
 }
 
 void
 ClearKeyCDM::DeinitializeDecoder(StreamType aDecoderType)
 {
 #ifdef ENABLE_WMF
   if (aDecoderType == StreamType::kStreamTypeVideo) {
-    mVideoDecoder->Reset();
+    mVideoDecoder->DecodingComplete();
+    mVideoDecoder = nullptr;
   }
 #endif
 }
 
 void
 ClearKeyCDM::ResetDecoder(StreamType aDecoderType)
 {
 #ifdef ENABLE_WMF
@@ -185,11 +183,14 @@ ClearKeyCDM::OnQueryOutputProtectionStat
   assert(false);
 }
 
 void
 ClearKeyCDM::Destroy()
 {
   mSessionManager->DecryptingComplete();
 #ifdef ENABLE_WMF
-  mVideoDecoder->DecodingComplete();
+  // If we have called 'DeinitializeDecoder' mVideoDecoder will be null.
+  if (mVideoDecoder) {
+    mVideoDecoder->DecodingComplete();
+  }
 #endif
 }
\ No newline at end of file