Bug 1223270: P5. Reduce VideoQueue size for GPU based images. r=mattwoodrow
authorJean-Yves Avenard <jyavenard@mozilla.com>
Fri, 16 Jun 2017 22:43:51 +0200
changeset 365333 79d9bc4917e1300c8cd22a04236447222f66d231
parent 365332 809aef3e8b196ce9b5fb560c1400b3f7d4ad73c5
child 365334 f2dce9290174906f0adf5e87edf2b5cd49bc2f93
push id91734
push userkwierso@gmail.com
push dateThu, 22 Jun 2017 01:05:37 +0000
treeherdermozilla-inbound@2576a0695305 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmattwoodrow
bugs1223270
milestone56.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 1223270: P5. Reduce VideoQueue size for GPU based images. r=mattwoodrow MozReview-Commit-ID: JGiHiBLyQZN
dom/media/MediaFormatReader.cpp
--- a/dom/media/MediaFormatReader.cpp
+++ b/dom/media/MediaFormatReader.cpp
@@ -2277,16 +2277,25 @@ MediaFormatReader::Update(TrackType aTra
               a.mStats.mInterKeyFrameMax_us = segment_us;
             }
           }
           mPreviousDecodedKeyframeTime_us = output->mTime.ToMicroseconds();
         }
         nsCString error;
         mVideo.mIsHardwareAccelerated =
           mVideo.mDecoder && mVideo.mDecoder->IsHardwareAccelerated(error);
+#ifdef XP_WIN
+        // D3D11_YCBCR_IMAGE images are GPU based, we try to limit the amount
+        // of GPU RAM used.
+        VideoData* videoData = static_cast<VideoData*>(output.get());
+        mVideo.mIsHardwareAccelerated =
+          mVideo.mIsHardwareAccelerated ||
+          (videoData->mImage &&
+           videoData->mImage->GetFormat() == ImageFormat::D3D11_YCBCR_IMAGE);
+#endif
       }
     } else if (decoder.HasFatalError()) {
       LOG("Rejecting %s promise: DECODE_ERROR", TrackTypeToStr(aTrack));
       decoder.RejectPromise(decoder.mError.ref(), __func__);
       return;
     } else if (decoder.HasCompletedDrain()) {
       if (decoder.mDemuxEOS) {
         LOG("Rejecting %s promise: EOS", TrackTypeToStr(aTrack));