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