mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1266336 - Clarify expected usage of CDM wrapper - r=cpearce,a=ritu
Assert that the CDM wrapper is given a non-null CDM pointer. (so GetCDM() doesn't need to be null-checked.) Renamed WidevineVideoDecoder mCDM to mCDMWrapper, to avoid (my) confusion. Assert that WidevineVideoDecoder is given a non-null CDM-wrapper pointer. Assert that WidevineVideoDecoder only accesses the CDM before DecodingComplete. Small optimization: Move aCDM into mCDM (to save an AddRef/Release pair). MozReview-Commit-ID: yKupY067ly
This commit is contained in:
parent
9f1ce0169b
commit
0e348419fc
@ -48,7 +48,9 @@ public:
|
||||
|
||||
CDMWrapper(cdm::ContentDecryptionModule_8* aCDM)
|
||||
: mCDM(aCDM)
|
||||
{}
|
||||
{
|
||||
MOZ_ASSERT(mCDM);
|
||||
}
|
||||
cdm::ContentDecryptionModule_8* GetCDM() const { return mCDM; }
|
||||
private:
|
||||
cdm::ContentDecryptionModule_8* mCDM;
|
||||
|
@ -14,14 +14,17 @@ using namespace cdm;
|
||||
namespace mozilla {
|
||||
|
||||
WidevineVideoDecoder::WidevineVideoDecoder(GMPVideoHost* aVideoHost,
|
||||
RefPtr<CDMWrapper> aCDM)
|
||||
RefPtr<CDMWrapper> aCDMWrapper)
|
||||
: mVideoHost(aVideoHost)
|
||||
, mCDM(aCDM)
|
||||
, mCDMWrapper(Move(aCDMWrapper))
|
||||
, mExtraData(new MediaByteBuffer())
|
||||
, mSentInput(false)
|
||||
{
|
||||
// Expect to start with a CDM wrapper, will release it in DecodingComplete().
|
||||
MOZ_ASSERT(mCDMWrapper);
|
||||
Log("WidevineVideoDecoder created this=%p", this);
|
||||
|
||||
// Corresponding Release is in DecodingComplete().
|
||||
AddRef();
|
||||
}
|
||||
|
||||
@ -233,10 +236,11 @@ void
|
||||
WidevineVideoDecoder::DecodingComplete()
|
||||
{
|
||||
Log("WidevineVideoDecoder::DecodingComplete()");
|
||||
if (mCDM) {
|
||||
if (mCDMWrapper) {
|
||||
CDM()->DeinitializeDecoder(kStreamTypeVideo);
|
||||
mCDM = nullptr;
|
||||
mCDMWrapper = nullptr;
|
||||
}
|
||||
// Release that corresponds to AddRef() in constructor.
|
||||
Release();
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,7 @@ public:
|
||||
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(WidevineVideoDecoder)
|
||||
|
||||
WidevineVideoDecoder(GMPVideoHost* aVideoHost,
|
||||
RefPtr<CDMWrapper> aCDM);
|
||||
RefPtr<CDMWrapper> aCDMWrapper);
|
||||
void InitDecode(const GMPVideoCodec& aCodecSettings,
|
||||
const uint8_t* aCodecSpecific,
|
||||
uint32_t aCodecSpecificLength,
|
||||
@ -44,12 +44,17 @@ private:
|
||||
|
||||
~WidevineVideoDecoder();
|
||||
|
||||
cdm::ContentDecryptionModule_8* CDM() { return mCDM->GetCDM(); }
|
||||
cdm::ContentDecryptionModule_8* CDM() const {
|
||||
// CDM should only be accessed before 'DecodingComplete'.
|
||||
MOZ_ASSERT(mCDMWrapper);
|
||||
// CDMWrapper ensure the CDM is non-null, no need to check again.
|
||||
return mCDMWrapper->GetCDM();
|
||||
}
|
||||
|
||||
bool ReturnOutput(WidevineVideoFrame& aFrame);
|
||||
|
||||
GMPVideoHost* mVideoHost;
|
||||
RefPtr<CDMWrapper> mCDM;
|
||||
RefPtr<CDMWrapper> mCDMWrapper;
|
||||
RefPtr<MediaByteBuffer> mExtraData;
|
||||
RefPtr<MediaByteBuffer> mAnnexB;
|
||||
GMPVideoDecoderCallback* mCallback;
|
||||
|
Loading…
Reference in New Issue
Block a user