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 : GPSNwBVyD4j
extra : rebase_source : 3ba4a6fc7cc46a8bedf1799c4c6aa25585361269
This commit is contained in:
Andreas Pehrson 2015-09-30 09:31:54 +08:00
Родитель 867415c0b5
Коммит 2415aa80a7
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.