Bug 1138825 - Fix the crash at mAudioPromise: call decode audio data when the audio queue is empty and check the mAudioPromise is empty or not. r=sotaro
authorBenjamin Chen <bechen@mozilla.com>
Tue, 10 Mar 2015 14:38:39 +0800
changeset 234216 8d51dbc085b58f46c2a77dccc1682c58f39cc25f
parent 234215 3d582311e619083d74ad4e118520fcc9312ad8c7
child 234217 54ab128ef1c058596198766ab4373c4d1a73432e
push id57073
push usercbook@mozilla.com
push dateWed, 18 Mar 2015 11:00:37 +0000
treeherdermozilla-inbound@b976b2dc1a26 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssotaro
bugs1138825
milestone39.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 1138825 - Fix the crash at mAudioPromise: call decode audio data when the audio queue is empty and check the mAudioPromise is empty or not. r=sotaro
dom/media/omx/MediaCodecReader.cpp
--- a/dom/media/omx/MediaCodecReader.cpp
+++ b/dom/media/omx/MediaCodecReader.cpp
@@ -452,18 +452,23 @@ MediaCodecReader::DecodeAudioDataSync()
   }
   mAudioTrack.mCodec->releaseOutputBuffer(bufferInfo.mIndex);
 
 }
 
 void
 MediaCodecReader::DecodeAudioDataTask()
 {
-  DecodeAudioDataSync();
+  if (AudioQueue().GetSize() == 0 && !AudioQueue().IsFinished()) {
+    DecodeAudioDataSync();
+  }
   MonitorAutoLock al(mAudioTrack.mTrackMonitor);
+  if (mAudioTrack.mAudioPromise.IsEmpty()) {
+    return;
+  }
   if (AudioQueue().GetSize() > 0) {
     nsRefPtr<AudioData> a = AudioQueue().PopFront();
     if (a) {
       if (mAudioTrack.mDiscontinuity) {
         a->mDiscontinuity = true;
         mAudioTrack.mDiscontinuity = false;
       }
       mAudioTrack.mAudioPromise.Resolve(a, __func__);