Bug 1438134 - Resolve ApplyConstraints and end track on unexpected error. r=jib

MozReview-Commit-ID: 1uVHTCOwlQw

--HG--
extra : rebase_source : 62a77cacad9de70511fe73006a26da627f002d5c
This commit is contained in:
Andreas Pehrson 2018-02-23 10:06:22 +01:00
Родитель 1a2a215d37
Коммит 85229c5bef
1 изменённых файлов: 9 добавлений и 6 удалений

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

@ -1271,7 +1271,8 @@ public:
p->Resolve(false);
},
[p, weakWindow = nsWeakPtr(do_GetWeakReference(aWindow))]
[p, weakWindow = nsWeakPtr(do_GetWeakReference(aWindow)),
listener = mListener, trackID = mTrackID]
(Maybe<nsString>&& aBadConstraint)
{
if (!MediaManager::Exists()) {
@ -1282,15 +1283,17 @@ public:
return;
}
nsCOMPtr<nsPIDOMWindowInner> window = do_QueryReferent(weakWindow);
if (aBadConstraint.isNothing()) {
auto error = MakeRefPtr<MediaStreamError>(
window,
NS_LITERAL_STRING("InternalError"));
p->Reject(error);
// Unexpected error during reconfig that left the source
// stopped. We resolve the promise and end the track.
if (listener) {
listener->StopTrack(trackID);
}
p->Resolve(false);
return;
}
nsCOMPtr<nsPIDOMWindowInner> window = do_QueryReferent(weakWindow);
auto error = MakeRefPtr<MediaStreamError>(
window,
NS_LITERAL_STRING("OverConstrainedError"),