Bug 1495025 - P6. Remove now unused paramater. r=bryce
authorJean-Yves Avenard <jyavenard@mozilla.com>
Thu, 04 Oct 2018 09:47:59 +0000
changeset 488280 982f91f69b39773ac302d4d01610de1414894529
parent 488279 b88586cb4fddc5d67b0321408e259e198894abde
child 488281 dc46a5f43a47d173b7c29226aab8bc590701bc99
child 488317 c291143e24019097d087f9307e59b49facaf90cb
push id246
push userfmarier@mozilla.com
push dateSat, 13 Oct 2018 00:15:40 +0000
reviewersbryce
bugs1495025
milestone64.0a1
Bug 1495025 - P6. Remove now unused paramater. r=bryce Depends on D7316 Differential Revision: https://phabricator.services.mozilla.com/D7491
dom/media/platforms/wmf/MFTDecoder.cpp
dom/media/platforms/wmf/MFTDecoder.h
dom/media/platforms/wmf/WMFAudioMFTManager.cpp
dom/media/platforms/wmf/WMFVideoMFTManager.cpp
--- a/dom/media/platforms/wmf/MFTDecoder.cpp
+++ b/dom/media/platforms/wmf/MFTDecoder.cpp
@@ -94,17 +94,16 @@ MFTDecoder::SetMediaTypes(IMFMediaType* 
   NS_ENSURE_TRUE(SUCCEEDED(hr), hr);
 
   GUID currentSubtype = {0};
   hr = aOutputType->GetGUID(MF_MT_SUBTYPE, &currentSubtype);
   NS_ENSURE_TRUE(SUCCEEDED(hr), hr);
 
   hr = SetDecoderOutputType(currentSubtype,
                             aOutputType,
-                            true /* match all attributes */,
                             std::move(aCallback));
   NS_ENSURE_TRUE(SUCCEEDED(hr), hr);
 
   hr = mDecoder->GetInputStreamInfo(0, &mInputStreamInfo);
   NS_ENSURE_TRUE(SUCCEEDED(hr), hr);
 
   hr = SendMFTMessage(MFT_MESSAGE_NOTIFY_BEGIN_STREAMING, 0);
   NS_ENSURE_TRUE(SUCCEEDED(hr), hr);
@@ -121,37 +120,35 @@ MFTDecoder::GetAttributes()
   MOZ_ASSERT(mscom::IsCurrentThreadMTA());
   RefPtr<IMFAttributes> attr;
   HRESULT hr = mDecoder->GetAttributes(getter_AddRefs(attr));
   NS_ENSURE_TRUE(SUCCEEDED(hr), nullptr);
   return attr.forget();
 }
 
 HRESULT
-MFTDecoder::FindDecoderOutputType(bool aMatchAllAttributes)
+MFTDecoder::FindDecoderOutputType()
 {
   MOZ_ASSERT(mscom::IsCurrentThreadMTA());
   MOZ_ASSERT(mOutputType, "SetDecoderTypes must have been called once");
 
-  return FindDecoderOutputTypeWithSubtype(mOutputSubType, aMatchAllAttributes);
+  return FindDecoderOutputTypeWithSubtype(mOutputSubType);
 }
 
 HRESULT
-MFTDecoder::FindDecoderOutputTypeWithSubtype(const GUID& aSubType,
-                                             bool aMatchAllAttributes)
+MFTDecoder::FindDecoderOutputTypeWithSubtype(const GUID& aSubType)
 {
   return SetDecoderOutputType(
-    aSubType, nullptr, aMatchAllAttributes, [](IMFMediaType*) { return S_OK; });
+    aSubType, nullptr, [](IMFMediaType*) { return S_OK; });
 }
 
 HRESULT
 MFTDecoder::SetDecoderOutputType(
   const GUID& aSubType,
   IMFMediaType* aTypeToUse,
-  bool aMatchAllAttributes,
   std::function<HRESULT(IMFMediaType*)>&& aCallback)
 {
   MOZ_ASSERT(mscom::IsCurrentThreadMTA());
   NS_ENSURE_TRUE(mDecoder != nullptr, E_POINTER);
 
   if (!aTypeToUse) {
     aTypeToUse = mOutputType;
   }
@@ -161,24 +158,17 @@ MFTDecoder::SetDecoderOutputType(
   RefPtr<IMFMediaType> outputType;
   UINT32 typeIndex = 0;
   while (SUCCEEDED(mDecoder->GetOutputAvailableType(
     0, typeIndex++, getter_AddRefs(outputType)))) {
     GUID outSubtype = {0};
     HRESULT hr = outputType->GetGUID(MF_MT_SUBTYPE, &outSubtype);
     NS_ENSURE_TRUE(SUCCEEDED(hr), hr);
 
-    BOOL resultMatch = aSubType == outSubtype;
-
-    if (resultMatch && aMatchAllAttributes) {
-      hr = aTypeToUse->Compare(outputType, MF_ATTRIBUTES_MATCH_OUR_ITEMS,
-                               &resultMatch);
-      NS_ENSURE_TRUE(SUCCEEDED(hr), hr);
-    }
-    if (resultMatch == TRUE) {
+    if (aSubType == outSubtype) {
       hr = aCallback(outputType);
       NS_ENSURE_TRUE(SUCCEEDED(hr), hr);
 
       hr = mDecoder->SetOutputType(0, outputType, 0);
       NS_ENSURE_TRUE(SUCCEEDED(hr), hr);
 
       hr = mDecoder->GetOutputStreamInfo(0, &mOutputStreamInfo);
       NS_ENSURE_TRUE(SUCCEEDED(hr), hr);
--- a/dom/media/platforms/wmf/MFTDecoder.h
+++ b/dom/media/platforms/wmf/MFTDecoder.h
@@ -82,26 +82,24 @@ public:
 
   // Sends a flush message to the MFT. This causes it to discard all
   // input data. Use before seeking.
   HRESULT Flush();
 
   // Sends a message to the MFT.
   HRESULT SendMFTMessage(MFT_MESSAGE_TYPE aMsg, ULONG_PTR aData);
 
-  HRESULT FindDecoderOutputTypeWithSubtype(const GUID& aSubType,
-                                           bool aMatchAllAttributes);
-  HRESULT FindDecoderOutputType(bool aMatchAllAttributes);
+  HRESULT FindDecoderOutputTypeWithSubtype(const GUID& aSubType);
+  HRESULT FindDecoderOutputType();
 private:
   // Will search a suitable MediaType using aTypeToUse if set, if not will
   // use the current mOutputType.
   HRESULT SetDecoderOutputType(
     const GUID& aSubType,
     IMFMediaType* aTypeToUse,
-    bool aMatchAllAttributes,
     std::function<HRESULT(IMFMediaType*)>&& aCallback);
   HRESULT CreateOutputSample(RefPtr<IMFSample>* aOutSample);
 
   MFT_INPUT_STREAM_INFO mInputStreamInfo;
   MFT_OUTPUT_STREAM_INFO mOutputStreamInfo;
 
   RefPtr<IMFTransform> mDecoder;
 
--- a/dom/media/platforms/wmf/WMFAudioMFTManager.cpp
+++ b/dom/media/platforms/wmf/WMFAudioMFTManager.cpp
@@ -232,17 +232,17 @@ WMFAudioMFTManager::Output(int64_t aStre
   HRESULT hr;
   int typeChangeCount = 0;
   while (true) {
     hr = mDecoder->Output(&sample);
     if (hr == MF_E_TRANSFORM_NEED_MORE_INPUT) {
       return hr;
     }
     if (hr == MF_E_TRANSFORM_STREAM_CHANGE) {
-      hr = mDecoder->FindDecoderOutputType(false /* check all attribute */);
+      hr = mDecoder->FindDecoderOutputType();
       NS_ENSURE_TRUE(SUCCEEDED(hr), hr);
       hr = UpdateOutputType();
       NS_ENSURE_TRUE(SUCCEEDED(hr), hr);
       // Catch infinite loops, but some decoders perform at least 2 stream
       // changes on consecutive calls, so be permissive.
       // 100 is arbitrarily > 2.
       NS_ENSURE_TRUE(typeChangeCount < 100, MF_E_TRANSFORM_STREAM_CHANGE);
       ++typeChangeCount;
--- a/dom/media/platforms/wmf/WMFVideoMFTManager.cpp
+++ b/dom/media/platforms/wmf/WMFVideoMFTManager.cpp
@@ -1093,22 +1093,21 @@ WMFVideoMFTManager::Output(int64_t aStre
       // Video stream output type change, probably geometric aperture change or
       // pixel type.
       // We must reconfigure the decoder output type.
 
       // Attempt to find an appropriate OutputType, trying in order:
       // if HW accelerated: NV12, P010, P016
       // if SW: YV12, P010, P016
       if (FAILED((hr = (mDecoder->FindDecoderOutputTypeWithSubtype(
-                    mUseHwAccel ? MFVideoFormat_NV12 : MFVideoFormat_YV12,
-                    false)))) &&
+                    mUseHwAccel ? MFVideoFormat_NV12 : MFVideoFormat_YV12)))) &&
           FAILED((hr = mDecoder->FindDecoderOutputTypeWithSubtype(
-                    MFVideoFormat_P010, false))) &&
+                    MFVideoFormat_P010))) &&
           FAILED((hr = mDecoder->FindDecoderOutputTypeWithSubtype(
-                    MFVideoFormat_P016, false)))) {
+                    MFVideoFormat_P016)))) {
         LOG("No suitable output format found");
         return hr;
       }
 
       RefPtr<IMFMediaType> outputType;
       hr = mDecoder->GetOutputMediaType(outputType);
       NS_ENSURE_TRUE(SUCCEEDED(hr), hr);