diff --git a/dom/media/webm/WebMDemuxer.cpp b/dom/media/webm/WebMDemuxer.cpp index 00b63b65b92b..f2d6be7985c5 100644 --- a/dom/media/webm/WebMDemuxer.cpp +++ b/dom/media/webm/WebMDemuxer.cpp @@ -692,14 +692,16 @@ WebMDemuxer::GetNextPacket(TrackInfo::TrackType aType, if (isKeyframe) { // We only look for resolution changes on keyframes for both VP8 and // VP9. Other resolution changes are invalid. - auto dimensions = nsIntSize(si.w, si.h); - if (mLastSeenFrameSize.isSome() - && (dimensions != mLastSeenFrameSize.value())) { - mInfo.mVideo.mDisplay = dimensions; + if (mLastSeenFrameWidth.isSome() + && mLastSeenFrameHeight.isSome() + && (si.w != mLastSeenFrameWidth.value() + || si.h != mLastSeenFrameHeight.value())) { + mInfo.mVideo.mDisplay = nsIntSize(si.w, si.h); mSharedVideoTrackInfo = new TrackInfoSharedPtr(mInfo.mVideo, ++sStreamSourceID); } - mLastSeenFrameSize = Some(dimensions); + mLastSeenFrameWidth = Some(si.w); + mLastSeenFrameHeight = Some(si.h); } } } diff --git a/dom/media/webm/WebMDemuxer.h b/dom/media/webm/WebMDemuxer.h index d9f030155d3d..421052cabf8f 100644 --- a/dom/media/webm/WebMDemuxer.h +++ b/dom/media/webm/WebMDemuxer.h @@ -257,7 +257,8 @@ private: int64_t mLastWebMBlockOffset; const bool mIsMediaSource; - Maybe mLastSeenFrameSize; + Maybe mLastSeenFrameWidth; + Maybe mLastSeenFrameHeight; // This will be populated only if a resolution change occurs, otherwise it // will be left as null so the original metadata is used RefPtr mSharedVideoTrackInfo;