Bug 1318965 - Fixes a bug in the video decoder causing a crash if the video decoder wash shutdown while in the middle of a drain or a reset r?cpearce
MozReview-Commit-ID: 2ePTOelGbuA
--- a/dom/media/gmp/GMPVideoDecoderParent.cpp
+++ b/dom/media/gmp/GMPVideoDecoderParent.cpp
@@ -383,18 +383,22 @@ GMPVideoDecoderParent::RecvInputDataExha
mozilla::ipc::IPCResult
GMPVideoDecoderParent::RecvDrainComplete()
{
LOGD(("GMPVideoDecoderParent[%p]::RecvDrainComplete() frameCount=%d", this, mFrameCount));
nsAutoString msg;
msg.AppendLiteral("GMPVideoDecoderParent::RecvDrainComplete() outstanding frames=");
msg.AppendInt(mFrameCount);
LogToBrowserConsole(msg);
+
if (!mCallback) {
- return IPC_FAIL_NO_REASON(this);
+ // We anticipate shutting down in the middle of a drain in the
+ // `UnblockResetAndDrain` method, which is called when we shutdown, so
+ // everything is sunny.
+ return IPC_OK();
}
if (!mIsAwaitingDrainComplete) {
return IPC_OK();
}
mIsAwaitingDrainComplete = false;
// Ignore any return code. It is OK for this to fail without killing the process.
@@ -406,17 +410,20 @@ GMPVideoDecoderParent::RecvDrainComplete
mozilla::ipc::IPCResult
GMPVideoDecoderParent::RecvResetComplete()
{
LOGD(("GMPVideoDecoderParent[%p]::RecvResetComplete()", this));
CancelResetCompleteTimeout();
if (!mCallback) {
- return IPC_FAIL_NO_REASON(this);
+ // We anticipate shutting down in the middle of a reset in the
+ // `UnblockResetAndDrain` method, which is called when we shutdown, so
+ // everything is good if we reach here.
+ return IPC_OK();
}
if (!mIsAwaitingResetComplete) {
return IPC_OK();
}
mIsAwaitingResetComplete = false;
mFrameCount = 0;