Bug 1490700 - Cap capability values to avoid truncation. r=jib

Differential Revision: https://phabricator.services.mozilla.com/D5785

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Andreas Pehrson 2018-09-14 09:15:53 +00:00
parent bbcf773bf1
commit c66af482b6

View File

@ -901,9 +901,11 @@ MediaEngineRemoteVideoSource::ChooseCapability(
// algorithm there.
// TODO: This can be removed in bug 1453269.
aCapability.width =
(c.mWidth.mIdeal.valueOr(0) & 0xffff) << 16 | (c.mWidth.mMax & 0xffff);
(std::min(0xffff, c.mWidth.mIdeal.valueOr(0)) & 0xffff) << 16 |
(std::min(0xffff, c.mWidth.mMax) & 0xffff);
aCapability.height =
(c.mHeight.mIdeal.valueOr(0) & 0xffff) << 16 | (c.mHeight.mMax & 0xffff);
(std::min(0xffff, c.mHeight.mIdeal.valueOr(0)) & 0xffff) << 16 |
(std::min(0xffff, c.mHeight.mMax) & 0xffff);
aCapability.maxFPS =
c.mFrameRate.Clamp(c.mFrameRate.mIdeal.valueOr(aPrefs.mFPS));
return true;