Bug 1143278 - Add more null checks in gmp-clearkey's decoders. r=edwin

This commit is contained in:
Chris Pearce 2015-04-13 13:39:49 +12:00
parent e61fe5c00d
commit bdd3e51ab8
2 changed files with 27 additions and 6 deletions

View File

@ -36,7 +36,9 @@ AudioDecoder::AudioDecoder(GMPAudioHost *aHostAPI)
AudioDecoder::~AudioDecoder()
{
if (mMutex) {
mMutex->Destroy();
}
}
void
@ -223,8 +225,12 @@ AudioDecoder::MFToGMPSample(IMFSample* aInput,
void
AudioDecoder::Reset()
{
if (mDecoder) {
mDecoder->Reset();
}
if (mCallback) {
mCallback->ResetComplete();
}
}
void
@ -248,6 +254,9 @@ AudioDecoder::DrainTask()
void
AudioDecoder::Drain()
{
if (!mDecoder) {
return;
}
EnsureWorker();
mWorkerThread->Post(WrapTask(this,
&AudioDecoder::DrainTask));

View File

@ -39,7 +39,9 @@ VideoDecoder::VideoDecoder(GMPVideoHost *aHostAPI)
VideoDecoder::~VideoDecoder()
{
if (mMutex) {
mMutex->Destroy();
}
}
void
@ -330,8 +332,12 @@ VideoDecoder::SampleToVideoFrame(IMFSample* aSample,
void
VideoDecoder::Reset()
{
if (mDecoder) {
mDecoder->Reset();
}
if (mCallback) {
mCallback->ResetComplete();
}
}
void
@ -361,6 +367,12 @@ VideoDecoder::DrainTask()
void
VideoDecoder::Drain()
{
if (!mDecoder) {
if (mCallback) {
mCallback->DrainComplete();
}
return;
}
EnsureWorker();
mWorkerThread->Post(WrapTask(this,
&VideoDecoder::DrainTask));