Bug 1565317 - Handle missing mMediaSource in ReduceConstraint. r=jib

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Andreas Pehrson 2019-07-12 13:04:14 +00:00
Родитель 5ea23033d2
Коммит 83ae7ef921
1 изменённых файлов: 11 добавлений и 4 удалений

Просмотреть файл

@ -2289,10 +2289,17 @@ static void ReduceConstraint(
}
// Keep mediaSource, ignore all other constraints.
auto& c = aConstraint.GetAsMediaTrackConstraints();
MOZ_DIAGNOSTIC_ASSERT(c.mMediaSource.WasPassed());
nsString mediaSource = c.mMediaSource.Value();
aConstraint.SetAsMediaTrackConstraints().mMediaSource.Construct(mediaSource);
Maybe<nsString> mediaSource;
if (aConstraint.GetAsMediaTrackConstraints().mMediaSource.WasPassed()) {
mediaSource =
Some(aConstraint.GetAsMediaTrackConstraints().mMediaSource.Value());
}
if (mediaSource) {
aConstraint.SetAsMediaTrackConstraints().mMediaSource.Value() =
*mediaSource;
} else {
aConstraint.SetAsMediaTrackConstraints();
}
}
/**