Bug 1259788 - Remove direct track listeners from TrackUnionStream before inputs are removed. r=jesup

MozReview-Commit-ID: DTHF2pHEFSt

--HG--
extra : rebase_source : feddfc8ddbae33b2c97d0009b2a648ca71b33bbe
This commit is contained in:
Andreas Pehrson 2016-08-23 18:08:19 +02:00
Родитель 9f015ef1b0
Коммит 20c6e5d1e0
1 изменённых файлов: 8 добавлений и 0 удалений

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

@ -58,6 +58,10 @@ TrackUnionStream::TrackUnionStream() :
if (mTrackMap[i].mInputPort == aPort) {
STREAM_LOG(LogLevel::Debug, ("TrackUnionStream %p removing trackmap entry %d", this, i));
EndTrack(i);
for (auto listener : mTrackMap[i].mOwnedDirectListeners) {
// Remove listeners while the entry still exists.
RemoveDirectTrackListenerImpl(listener, mTrackMap[i].mOutputTrackID);
}
mTrackMap.RemoveElementAt(i);
}
}
@ -130,6 +134,10 @@ TrackUnionStream::TrackUnionStream() :
allFinished = false;
}
if (!mappedTracksWithMatchingInputTracks[i]) {
for (auto listener : mTrackMap[i].mOwnedDirectListeners) {
// Remove listeners while the entry still exists.
RemoveDirectTrackListenerImpl(listener, mTrackMap[i].mOutputTrackID);
}
mTrackMap.RemoveElementAt(i);
}
}