diff --git a/dom/media/MediaFormatReader.cpp b/dom/media/MediaFormatReader.cpp index bd53a11325dc..0a74b8def798 100644 --- a/dom/media/MediaFormatReader.cpp +++ b/dom/media/MediaFormatReader.cpp @@ -1024,6 +1024,10 @@ MediaFormatReader::Update(TrackType aTrack) needOutput = true; if (!decoder.mOutput.IsEmpty()) { // We have a decoded sample ready to be returned. + if (aTrack == TrackType::kVideoTrack) { + mVideo.mIsHardwareAccelerated = + mVideo.mDecoder && mVideo.mDecoder->IsHardwareAccelerated(); + } nsRefPtr output = decoder.mOutput[0]; decoder.mOutput.RemoveElementAt(0); decoder.mSizeOfQueue -= 1; @@ -1504,7 +1508,7 @@ MediaFormatReader::SetSharedDecoderManager(SharedDecoderManager* aManager) bool MediaFormatReader::VideoIsHardwareAccelerated() const { - return mVideo.mDecoder && mVideo.mDecoder->IsHardwareAccelerated(); + return mVideo.mIsHardwareAccelerated; } void diff --git a/dom/media/MediaFormatReader.h b/dom/media/MediaFormatReader.h index d0d0a454484f..739d99b8f560 100644 --- a/dom/media/MediaFormatReader.h +++ b/dom/media/MediaFormatReader.h @@ -203,6 +203,7 @@ private: , mNumSamplesInput(0) , mNumSamplesOutput(0) , mSizeOfQueue(0) + , mIsHardwareAccelerated(false) , mLastStreamSourceID(UINT32_MAX) {} @@ -294,6 +295,9 @@ private: // Used by the MDSM for logging purposes. Atomic mSizeOfQueue; + // Used by the MDSM to determine if video decoding is hardware accelerated. + // This value is updated after a frame is successfully decoded. + Atomic mIsHardwareAccelerated; // Sample format monitoring. uint32_t mLastStreamSourceID; Maybe mNextStreamSourceID;