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 draft
authorJay Harris <jharris@mozilla.com>
Wed, 18 Jan 2017 14:47:30 +1300
changeset 462852 5b8765b7070d659501cb97df2dd157b51e6c14f3
parent 462318 ad40c4b48d6cf6ce03d4592048902f37c39718fd
child 462853 783430c2d92018d686ddd8779bea1939936c618a
push id41870
push userbmo:jharris@mozilla.com
push dateWed, 18 Jan 2017 02:25:40 +0000
reviewerscpearce
bugs1318965
milestone53.0a1
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
dom/media/gmp/GMPVideoDecoderParent.cpp
--- 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;