Bug 1384495 - p2: resolve drain promise with empty decoded data only when draining complete. r=jya
authorJohn Lin <jolin@mozilla.com>
Wed, 26 Jul 2017 15:25:28 +0800
changeset 420122 e53245c9e2a8855baa5b7fb5f5d5bcb0565874e9
parent 420121 4c847269e1c8177462dcd0d0a1eb9ccfa56ac05e
child 420123 ac1b19c47aac763afed9a137fe6ff0ee8d2a7186
push id7566
push usermtabara@mozilla.com
push dateWed, 02 Aug 2017 08:25:16 +0000
treeherdermozilla-beta@86913f512c3c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjya
bugs1384495
milestone56.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 1384495 - p2: resolve drain promise with empty decoded data only when draining complete. r=jya MozReview-Commit-ID: 7livLq1K6Ro
dom/media/platforms/android/RemoteDataDecoder.cpp
--- a/dom/media/platforms/android/RemoteDataDecoder.cpp
+++ b/dom/media/platforms/android/RemoteDataDecoder.cpp
@@ -603,17 +603,18 @@ RemoteDataDecoder::ReturnDecodedData()
 {
   AssertOnTaskQueue();
   MOZ_ASSERT(!mShutdown);
 
   // We only want to clear mDecodedData when we have resolved the promises.
   if (!mDecodePromise.IsEmpty()) {
     mDecodePromise.Resolve(mDecodedData, __func__);
     mDecodedData.Clear();
-  } else if (!mDrainPromise.IsEmpty()) {
+  } else if (!mDrainPromise.IsEmpty() &&
+             (!mDecodedData.IsEmpty() || mDrainStatus == DrainStatus::DRAINED)) {
     mDrainPromise.Resolve(mDecodedData, __func__);
     mDecodedData.Clear();
   }
 }
 
 void
 RemoteDataDecoder::DrainComplete()
 {