Bug 1208328 - Don't block ended tracks on removal from MediaStream. r=jesup

After ending the MediaInputPort (to the playback stream) gets removed if locked
to the track specifically. Trying to remove the track at this point would try to
block it in the same MediaInputPort - but since it doesn't exist would trigger
an NS_ERROR instead.

MozReview-Commit-ID: IpRL6FAGxPp

--HG--
extra : rebase_source : 7fea1d440c8e03911861acd64323083944591f0e
extra : intermediate-source : aa209325161f45a5607982af76ef1784208690a5
extra : source : dbb4b83be583eacc401648c5c33091958c29c4c3
This commit is contained in:
Andreas Pehrson 2016-05-31 14:55:51 +02:00
parent 758a8d47ef
commit e1e731a6c0

View File

@ -600,7 +600,11 @@ DOMMediaStream::RemoveTrack(MediaStreamTrack& aTrack)
// to block it in the port. Doing this for a locked track is still OK as it
// will first block the track, then destroy the port. Both cause the track to
// end.
BlockPlaybackTrack(toRemove);
// If the track has already ended, it's input port might be gone, so in those
// cases blocking the underlying track should be avoided.
if (!aTrack.Ended()) {
BlockPlaybackTrack(toRemove);
}
DebugOnly<bool> removed = mTracks.RemoveElement(toRemove);
MOZ_ASSERT(removed);