Bug 1336873 - Force to crash if we get the the unexpected new output stream when receive MF_E_TRANSFORM_STREAM_CHANGE. draft
authorAlastor Wu <alwu@mozilla.com>
Mon, 06 Feb 2017 11:33:15 +0800
changeset 479156 11cc8cd3dfeb32f37b788141ed676385a797d285
parent 479141 20a8536b0bfac74389d3a57bd8dd957d98779ce1
child 544604 eb0f6b3a9ab18c97010292a8b7b9f6306fb45126
push id44165
push useralwu@mozilla.com
push dateMon, 06 Feb 2017 03:37:00 +0000
bugs1336873, 1281835
milestone54.0a1
Bug 1336873 - Force to crash if we get the the unexpected new output stream when receive MF_E_TRANSFORM_STREAM_CHANGE. Force to crash can make us know whether that situation is the reason of the crash in bug1281835. MozReview-Commit-ID: JVMzKxikwdH
dom/media/platforms/wmf/MFTDecoder.cpp
--- a/dom/media/platforms/wmf/MFTDecoder.cpp
+++ b/dom/media/platforms/wmf/MFTDecoder.cpp
@@ -212,16 +212,23 @@ MFTDecoder::Output(RefPtr<IMFSample>* aO
   if (output.pEvents) {
     // We must release this, as per the IMFTransform::ProcessOutput()
     // MSDN documentation.
     output.pEvents->Release();
     output.pEvents = nullptr;
   }
 
   if (hr == MF_E_TRANSFORM_STREAM_CHANGE) {
+    if (status == MFT_PROCESS_OUTPUT_STATUS_NEW_STREAMS) {
+      DWORD inputCount, outputCount;
+      mDecoder->GetStreamCount(&inputCount, &outputCount);
+      if (inputCount != outputCount) {
+        MOZ_CRASH("Got unexpected new output stream.");
+      }
+    }
     // Type change, probably geometric aperture change.
     // Reconfigure decoder output type, so that GetOutputMediaType()
     // returns the new type, and return the error code to caller.
     // This is an expected failure, so don't warn on encountering it.
     hr = SetDecoderOutputType(nullptr, nullptr);
     NS_ENSURE_TRUE(SUCCEEDED(hr), hr);
     // Return the error, so that the caller knows to retry.
     return MF_E_TRANSFORM_STREAM_CHANGE;