Bug 1170958 - Don't create owned MediaStreamTracks in MetadataLoaded. r=roc

When play()ing a media element after it has ended, MediaDecoder will
again call MetadataLoaded(). When capturing the media to a
DOMMediaStream, that will attempt to create new MediaStreamTracks in the
stream with the original TrackIDs. That won't work, since the original
tracks with the same TrackIDs have already ended.

We solve it by only explicitly creating MediaStreamTracks in the stream
in captureStream(), and only if they're already known. Otherwise the
tracks will be created asynchronously when available in the underlying
stream.

--HG--
extra : commitid : Kvj9RrN9MgP
This commit is contained in:
Andreas Pehrson 2015-09-25 23:23:18 +08:00
Родитель b4ff8db67c
Коммит 8a2adce7e2
1 изменённых файлов: 0 добавлений и 12 удалений

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

@ -3286,18 +3286,6 @@ void HTMLMediaElement::MetadataLoaded(const MediaInfo* aInfo,
#endif // MOZ_EME
}
// Expose the tracks to JS directly.
for (OutputMediaStream& out : mOutputStreams) {
if (aInfo->HasAudio()) {
TrackID audioTrackId = aInfo->mAudio.mTrackId;
out.mStream->CreateOwnDOMTrack(audioTrackId, MediaSegment::AUDIO);
}
if (aInfo->HasVideo()) {
TrackID videoTrackId = aInfo->mVideo.mTrackId;
out.mStream->CreateOwnDOMTrack(videoTrackId, MediaSegment::VIDEO);
}
}
// If this element had a video track, but consists only of an audio track now,
// delete the VideoFrameContainer. This happens when the src is changed to an
// audio only file.