Bug 1413116 - Handle errors from MutableBlobStorage::Append. r=baku,SingingTree
authorAndreas Pehrson <pehrsons@mozilla.com>
Tue, 31 Oct 2017 09:48:54 +0100
changeset 444348 aec9d75a9a1b027c09b4b5ac5240b171c794e43f
parent 444347 a4632a2f8aee8abed3c9f08f0a344724a7ac9376
child 444349 1935e4699d80e778154b2bd623e13a54bef23071
push id1618
push userCallek@gmail.com
push dateThu, 11 Jan 2018 17:45:48 +0000
treeherdermozilla-release@882ca853e05a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbaku, SingingTree
bugs1413116
milestone58.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1413116 - Handle errors from MutableBlobStorage::Append. r=baku,SingingTree MozReview-Commit-ID: D2cxv0VFzWx
dom/media/MediaRecorder.cpp
--- a/dom/media/MediaRecorder.cpp
+++ b/dom/media/MediaRecorder.cpp
@@ -270,21 +270,28 @@ class MediaRecorder::Session: public Pri
       : Runnable("StoreEncodedBufferRunnable")
       , mSession(aSession)
       , mBuffer(Move(aBuffer))
     {}
 
     NS_IMETHOD
     Run() override
     {
+      MOZ_ASSERT(NS_IsMainThread());
       mSession->MaybeCreateMutableBlobStorage();
       for (uint32_t i = 0; i < mBuffer.Length(); i++) {
-        if (!mBuffer[i].IsEmpty()) {
-          mSession->mMutableBlobStorage->Append(mBuffer[i].Elements(),
-                                                mBuffer[i].Length());
+        if (mBuffer[i].IsEmpty()) {
+          continue;
+        }
+
+        nsresult rv = mSession->mMutableBlobStorage->Append(mBuffer[i].Elements(),
+                                                            mBuffer[i].Length());
+        if (NS_WARN_IF(NS_FAILED(rv))) {
+          mSession->DoSessionEndTask(rv);
+          break;
         }
       }
 
       return NS_OK;
     }
   };
 
   // Notify encoder error, run in main thread task. (Bug 1095381)