summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortrav90 <travawine@palemoon.org>2018-10-08 21:05:52 -0500
committertrav90 <travawine@palemoon.org>2018-10-08 21:05:52 -0500
commitae3cdb4be3cfe1faccf1d8a74928391570952609 (patch)
treea4938875fb0fb87fa3d8144ec01072c2d06e22b0
parent7ad419ece9a1fba9e65dcc94654fea822d08bc2f (diff)
downloaduxp-ae3cdb4be3cfe1faccf1d8a74928391570952609.tar.gz
[webm] Store LastSeenFrame dimensions as an nsIntSize
This simplifies the comparison and update logic.
-rw-r--r--dom/media/webm/WebMDemuxer.cpp11
-rw-r--r--dom/media/webm/WebMDemuxer.h3
2 files changed, 6 insertions, 8 deletions
diff --git a/dom/media/webm/WebMDemuxer.cpp b/dom/media/webm/WebMDemuxer.cpp
index 20ed715817..ac371fa7f9 100644
--- a/dom/media/webm/WebMDemuxer.cpp
+++ b/dom/media/webm/WebMDemuxer.cpp
@@ -651,14 +651,13 @@ WebMDemuxer::GetNextPacket(TrackInfo::TrackType aType, MediaRawDataQueue *aSampl
if (isKeyframe) {
// We only look for resolution changes on keyframes for both VP8 and
// VP9. Other resolution changes are invalid.
- if (mLastSeenFrameWidth.isSome() && mLastSeenFrameHeight.isSome() &&
- (si.w != mLastSeenFrameWidth.value() ||
- si.h != mLastSeenFrameHeight.value())) {
- mInfo.mVideo.mDisplay = nsIntSize(si.w, si.h);
+ auto dimensions = nsIntSize(si.w, si.h);
+ if (mLastSeenFrameSize.isSome()
+ && (dimensions != mLastSeenFrameSize.value())) {
+ mInfo.mVideo.mDisplay = dimensions;
mSharedVideoTrackInfo = new SharedTrackInfo(mInfo.mVideo, ++sStreamSourceID);
}
- mLastSeenFrameWidth = Some(si.w);
- mLastSeenFrameHeight = Some(si.h);
+ mLastSeenFrameSize = Some(dimensions);
}
}
}
diff --git a/dom/media/webm/WebMDemuxer.h b/dom/media/webm/WebMDemuxer.h
index 6fff38e7dc..a5008022ff 100644
--- a/dom/media/webm/WebMDemuxer.h
+++ b/dom/media/webm/WebMDemuxer.h
@@ -237,8 +237,7 @@ private:
int64_t mLastWebMBlockOffset;
const bool mIsMediaSource;
- Maybe<uint32_t> mLastSeenFrameWidth;
- Maybe<uint32_t> mLastSeenFrameHeight;
+ Maybe<nsIntSize> mLastSeenFrameSize;
// This will be populated only if a resolution change occurs, otherwise it
// will be left as null so the original metadata is used
RefPtr<SharedTrackInfo> mSharedVideoTrackInfo;