Bug 1422875 - Fix fake constraint to not apply to screensharing (on all platforms but android). r=pehrsons

MozReview-Commit-ID: K35vaNAolEy

--HG--
extra : rebase_source : 53fae5a862320ae6386e52d4163b06bea5c644d1
This commit is contained in:
Jan-Ivar Bruaroey 2017-12-04 11:56:28 -05:00
Родитель 22aabfd482
Коммит 4bed737a12
1 изменённых файлов: 7 добавлений и 1 удалений

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

@ -2511,9 +2511,15 @@ MediaManager::GetUserMedia(nsPIDOMWindowInner* aWindow,
bool fake = c.mFake.WasPassed()? c.mFake.Value() :
Preferences::GetBool("media.navigator.streams.fake");
bool hasVideo = videoType != MediaSourceEnum::Other;
bool hasAudio = audioType != MediaSourceEnum::Other;
bool fakeCams = fake && videoType == MediaSourceEnum::Camera;
bool fakeMics = fake && audioType == MediaSourceEnum::Microphone;
bool realDevicesRequested = (!fakeCams && hasVideo) || (!fakeMics && hasAudio);
bool askPermission =
(!privileged || Preferences::GetBool("media.navigator.permission.force")) &&
(!fake || Preferences::GetBool("media.navigator.permission.fake"));
(realDevicesRequested || Preferences::GetBool("media.navigator.permission.fake"));
RefPtr<PledgeSourceSet> p = EnumerateDevicesImpl(windowID, videoType,
audioType, fake);