Bug 1073792 - Refresh WMF output types on discontinuities, to catch cases where WMF doesn't notify us of an output type change. r=kinetik, a=lmandel
authorChris Pearce <cpearce@mozilla.com>
Tue, 30 Sep 2014 11:59:15 +1300
changeset 225445 c19814f20996d2a60b80b6fec2aa334bb3cd5875
parent 225444 0d960853f617616d28f531759c3e3dc8b9231d79
child 225446 d3baf1d41b83bab15131de6142bebc532cc67804
push id3979
push userraliiev@mozilla.com
push dateMon, 13 Oct 2014 16:35:44 +0000
treeherdermozilla-beta@30f2cc610691 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskinetik, lmandel
bugs1073792
milestone34.0a2
Bug 1073792 - Refresh WMF output types on discontinuities, to catch cases where WMF doesn't notify us of an output type change. r=kinetik, a=lmandel
content/media/fmp4/wmf/WMFAudioMFTManager.cpp
--- a/content/media/fmp4/wmf/WMFAudioMFTManager.cpp
+++ b/content/media/fmp4/wmf/WMFAudioMFTManager.cpp
@@ -251,16 +251,23 @@ WMFAudioMFTManager::Output(int64_t aStre
     NS_ENSURE_TRUE(SUCCEEDED(hr), hr);
     if (mAudioFrameOffset < 0) {
       // First sample has a negative timestamp. Strip off the samples until
       // we reach positive territory.
       numFramesToStrip = -mAudioFrameOffset;
       mAudioFrameOffset = 0;
     }
     mMustRecaptureAudioPosition = false;
+
+    // Also update the output type, in case this segment has a different
+    // rate. This also triggers on the first sample, which can have a
+    // different rate than is advertised in the container, and sometimes
+    // we don't get a MF_E_TRANSFORM_STREAM_CHANGE when the rate changes.
+    hr = UpdateOutputType();
+    NS_ENSURE_TRUE(SUCCEEDED(hr), hr);
   }
   MOZ_ASSERT(numFramesToStrip >= 0);
   int32_t offset = std::min<int32_t>(numFramesToStrip, numFrames);
   numFrames -= offset;
   numSamples -= offset * mAudioChannels;
   MOZ_ASSERT(numFrames >= 0);
   MOZ_ASSERT(numSamples >= 0);
   if (numFrames == 0) {