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

View File

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