Bug 1318965 - Changes the way the the 'DeinitializeDecoder' method in the ClearkeyCDM works r=cpearce
authorJay Harris <jharris@mozilla.com>
Wed, 18 Jan 2017 14:49:04 +1300
changeset 377216 cc2329247ee15c6adbbbb55d99bdc677ec6b7c67
parent 377215 019a392cb8dd7e77256c92e1cedd03ea3b480fb7
child 377217 ffbbd9fe609b6e386e7e5600308171f1d92f0078
push id1419
push userjlund@mozilla.com
push dateMon, 10 Apr 2017 20:44:07 +0000
treeherdermozilla-release@5e6801b73ef6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerscpearce
bugs1318965
milestone53.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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