diff --git a/dom/media/gmp/GMPVideoDecoderChild.cpp b/dom/media/gmp/GMPVideoDecoderChild.cpp index 259690628776..fcccbdf10a1b 100644 --- a/dom/media/gmp/GMPVideoDecoderChild.cpp +++ b/dom/media/gmp/GMPVideoDecoderChild.cpp @@ -225,7 +225,8 @@ GMPVideoDecoderChild::Alloc(size_t aSize, ++mNeedShmemIntrCount; rv = CallNeedShmem(aSize, aMem); --mNeedShmemIntrCount; - if (mPendingDecodeComplete) { + if (mPendingDecodeComplete && mNeedShmemIntrCount == 0) { + mPendingDecodeComplete = false; mPlugin->GMPMessageLoop()->PostTask( NewRunnableMethod(this, &GMPVideoDecoderChild::RecvDecodingComplete)); } diff --git a/dom/media/gmp/GMPVideoEncoderChild.cpp b/dom/media/gmp/GMPVideoEncoderChild.cpp index fa139cef4900..1b9196a1e3c2 100644 --- a/dom/media/gmp/GMPVideoEncoderChild.cpp +++ b/dom/media/gmp/GMPVideoEncoderChild.cpp @@ -206,7 +206,8 @@ GMPVideoEncoderChild::Alloc(size_t aSize, ++mNeedShmemIntrCount; rv = CallNeedShmem(aSize, aMem); --mNeedShmemIntrCount; - if (mPendingEncodeComplete) { + if (mPendingEncodeComplete && mNeedShmemIntrCount == 0) { + mPendingEncodeComplete = false; mPlugin->GMPMessageLoop()->PostTask( NewRunnableMethod(this, &GMPVideoEncoderChild::RecvEncodingComplete)); }