Bug 1413116 - Handle errors from MutableBlobStorage::Append. r?baku, r?SingingTree
MozReview-Commit-ID: D2cxv0VFzWx
--- 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)