Bug 1560440 - Don't attempt to set sample's duration. r?bryce a=RyanVM
☠☠ backed out by 5cc3874b4b9c ☠ ☠
authorJean-Yves Avenard <jyavenard@mozilla.com>
Thu, 11 Jul 2019 18:50:09 +0300
changeset 544722 aa514246e7037ac76148cf0985b89807547cb678
parent 544721 5d678cfdd1ddbf16f300dd83057698c0b84e8880
child 544723 4871e8d95e3efc567b3c59ba894908fe3e14c0a9
push id2131
push userffxbld-merge
push dateMon, 26 Aug 2019 18:30:20 +0000
treeherdermozilla-release@b19ffb3ca153 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbryce, RyanVM
bugs1560440, 1524890, 1222874
milestone69.0
Bug 1560440 - Don't attempt to set sample's duration. r?bryce a=RyanVM This is a partial revert of bug 1524890 - P17. When setting the duration, with some videos, on output WMF set nonsensical values. Sometimes the duration read is equal to the timestamp of the previous frame leading to broken A/V sync. In bug 1222874, we will remove the entire concept of video frame's duration. Differential Revision: https://phabricator.services.mozilla.com//D37683
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
@@ -135,17 +135,17 @@ MFTDecoder::SendMFTMessage(MFT_MESSAGE_T
   NS_ENSURE_TRUE(mDecoder != nullptr, E_POINTER);
   HRESULT hr = mDecoder->ProcessMessage(aMsg, aData);
   NS_ENSURE_TRUE(SUCCEEDED(hr), hr);
   return S_OK;
 }
 
 HRESULT
 MFTDecoder::CreateInputSample(const uint8_t* aData, uint32_t aDataSize,
-                              int64_t aTimestamp, int64_t aDuration,
+                              int64_t aTimestamp,
                               RefPtr<IMFSample>* aOutSample) {
   MOZ_ASSERT(mscom::IsCurrentThreadMTA());
   NS_ENSURE_TRUE(mDecoder != nullptr, E_POINTER);
 
   HRESULT hr;
   RefPtr<IMFSample> sample;
   hr = wmf::MFCreateSample(getter_AddRefs(sample));
   NS_ENSURE_TRUE(SUCCEEDED(hr), hr);
@@ -175,19 +175,16 @@ MFTDecoder::CreateInputSample(const uint
   NS_ENSURE_TRUE(SUCCEEDED(hr), hr);
 
   hr = sample->AddBuffer(buffer);
   NS_ENSURE_TRUE(SUCCEEDED(hr), hr);
 
   hr = sample->SetSampleTime(UsecsToHNs(aTimestamp));
   NS_ENSURE_TRUE(SUCCEEDED(hr), hr);
 
-  hr = sample->SetSampleDuration(UsecsToHNs(aDuration));
-  NS_ENSURE_TRUE(SUCCEEDED(hr), hr);
-
   *aOutSample = sample.forget();
 
   return S_OK;
 }
 
 HRESULT
 MFTDecoder::CreateOutputSample(RefPtr<IMFSample>* aOutSample) {
   MOZ_ASSERT(mscom::IsCurrentThreadMTA());
@@ -274,24 +271,23 @@ MFTDecoder::Output(RefPtr<IMFSample>* aO
     output.pSample->Release();
     output.pSample = nullptr;
   }
 
   return S_OK;
 }
 
 HRESULT
-MFTDecoder::Input(const uint8_t* aData, uint32_t aDataSize, int64_t aTimestamp,
-                  int64_t aDuration) {
+MFTDecoder::Input(const uint8_t* aData, uint32_t aDataSize,
+                  int64_t aTimestamp) {
   MOZ_ASSERT(mscom::IsCurrentThreadMTA());
   NS_ENSURE_TRUE(mDecoder != nullptr, E_POINTER);
 
   RefPtr<IMFSample> input;
-  HRESULT hr =
-      CreateInputSample(aData, aDataSize, aTimestamp, aDuration, &input);
+  HRESULT hr = CreateInputSample(aData, aDataSize, aTimestamp, &input);
   NS_ENSURE_TRUE(SUCCEEDED(hr) && input != nullptr, hr);
 
   return Input(input);
 }
 
 HRESULT
 MFTDecoder::Input(IMFSample* aSample) {
   MOZ_ASSERT(mscom::IsCurrentThreadMTA());
--- a/dom/media/platforms/wmf/MFTDecoder.h
+++ b/dom/media/platforms/wmf/MFTDecoder.h
@@ -50,21 +50,21 @@ class MFTDecoder final {
   const GUID& GetOutputMediaSubType() const { return mOutputSubType; }
 
   // Submits data into the MFT for processing.
   //
   // Returns:
   //  - MF_E_NOTACCEPTING if the decoder can't accept input. The data
   //    must be resubmitted after Output() stops producing output.
   HRESULT Input(const uint8_t* aData, uint32_t aDataSize,
-                int64_t aTimestampUsecs, int64_t aDurationUsecs);
+                int64_t aTimestampUsecs);
   HRESULT Input(IMFSample* aSample);
 
   HRESULT CreateInputSample(const uint8_t* aData, uint32_t aDataSize,
-                            int64_t aTimestampUsecs, int64_t aDurationUsecs,
+                            int64_t aTimestampUsecs,
                             RefPtr<IMFSample>* aOutSample);
 
   // Retrieves output from the MFT. Call this once Input() returns
   // MF_E_NOTACCEPTING. Some MFTs with hardware acceleration (the H.264
   // decoder MFT in particular) can't handle it if clients hold onto
   // references to the output IMFSample, so don't do that.
   //
   // Returns:
--- a/dom/media/platforms/wmf/WMFAudioMFTManager.cpp
+++ b/dom/media/platforms/wmf/WMFAudioMFTManager.cpp
@@ -181,18 +181,17 @@ bool WMFAudioMFTManager::Init() {
   mDecoder = decoder;
 
   return true;
 }
 
 HRESULT
 WMFAudioMFTManager::Input(MediaRawData* aSample) {
   return mDecoder->Input(aSample->Data(), uint32_t(aSample->Size()),
-                         aSample->mTime.ToMicroseconds(),
-                         aSample->mDuration.ToMicroseconds());
+                         aSample->mTime.ToMicroseconds());
 }
 
 HRESULT
 WMFAudioMFTManager::UpdateOutputType() {
   HRESULT hr;
 
   RefPtr<IMFMediaType> type;
   hr = mDecoder->GetOutputMediaType(type);
--- a/dom/media/platforms/wmf/WMFVideoMFTManager.cpp
+++ b/dom/media/platforms/wmf/WMFVideoMFTManager.cpp
@@ -748,18 +748,17 @@ WMFVideoMFTManager::Input(MediaRawData* 
     if (profile != 0 && profile != 2) {
       return E_FAIL;
     }
   }
 
   RefPtr<IMFSample> inputSample;
   HRESULT hr = mDecoder->CreateInputSample(
       aSample->Data(), uint32_t(aSample->Size()),
-      aSample->mTime.ToMicroseconds(), aSample->mDuration.ToMicroseconds(),
-      &inputSample);
+      aSample->mTime.ToMicroseconds(), &inputSample);
   NS_ENSURE_TRUE(SUCCEEDED(hr) && inputSample != nullptr, hr);
 
   if (!mColorSpace && aSample->mTrackInfo) {
     // The colorspace definition is found in the H264 SPS NAL, available out of
     // band, while for VP9 it's only available within the VP9 bytestream.
     // The info would have been updated by the MediaChangeMonitor.
     mColorSpace = Some(aSample->mTrackInfo->GetAsVideoInfo()->mColorSpace);
   }