Bug 1547381 - Call StopTrack() in the right order. r=padenot

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Jan-Ivar Bruaroey 2019-05-06 09:14:38 +00:00
Родитель 5e6b519d3b
Коммит a8cc07510f
1 изменённых файлов: 6 добавлений и 2 удалений

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

@ -4596,22 +4596,26 @@ void GetUserMediaWindowListener::StopSharing() {
void GetUserMediaWindowListener::StopRawID(const nsString& removedDeviceID) {
MOZ_ASSERT(NS_IsMainThread(), "Only call on main thread");
nsTArray<Pair<RefPtr<SourceListener>, TrackID>> matches;
for (auto& source : mActiveListeners) {
if (source->GetAudioDevice()) {
nsString id;
source->GetAudioDevice()->GetRawId(id);
if (removedDeviceID.Equals(id)) {
source->StopTrack(kAudioTrack);
matches.AppendElement(MakePair(source, TrackID(kAudioTrack)));
}
}
if (source->GetVideoDevice()) {
nsString id;
source->GetVideoDevice()->GetRawId(id);
if (removedDeviceID.Equals(id)) {
source->StopTrack(kVideoTrack);
matches.AppendElement(MakePair(source, TrackID(kVideoTrack)));
}
}
}
for (auto& pair : matches) {
pair.first()->StopTrack(pair.second());
}
}
void GetUserMediaWindowListener::ChromeAffectingStateChanged() {