Bug 1601799 - Use a SharedDummyTrack for graph access in DecodedStream. r=karlt
When enabling our MediaTrack implementation (which we don't plan to by default, NB) and disabling all audio tracks and unselecting all video tracks while having an active captureStream leads to having no output tracks in DecodedStream. In this case, DecodedStream doesn't know which graph to use for creating the intermediary tracks it feeds data to. We don't want to resort to the default graph either, since two graphs on different clocks could then race each other. With this patch we plumb down a SharedDummyTrack from the media element where the captureStream was triggered, through MediaDecoder, to DecodedStream. The SharedDummyTrack guarantees to keep the graph alive, and holds the graph used for the output tracks. Differential Revision: https://phabricator.services.mozilla.com/D99822
This commit is contained in:
@@ -2629,6 +2629,16 @@ void HTMLMediaElement::NotifyLoadError(const nsACString& aErrorDetails) {
|
||||
}
|
||||
}
|
||||
|
||||
void HTMLMediaElement::NotifyMediaTrackAdded(dom::MediaTrack* aTrack) {
|
||||
// The set of tracks changed.
|
||||
mWatchManager.ManualNotify(&HTMLMediaElement::UpdateOutputTrackSources);
|
||||
}
|
||||
|
||||
void HTMLMediaElement::NotifyMediaTrackRemoved(dom::MediaTrack* aTrack) {
|
||||
// The set of tracks changed.
|
||||
mWatchManager.ManualNotify(&HTMLMediaElement::UpdateOutputTrackSources);
|
||||
}
|
||||
|
||||
void HTMLMediaElement::NotifyMediaTrackEnabled(dom::MediaTrack* aTrack) {
|
||||
MOZ_ASSERT(aTrack);
|
||||
if (!aTrack) {
|
||||
@@ -3560,7 +3570,15 @@ void HTMLMediaElement::UpdateOutputTrackSources() {
|
||||
}
|
||||
|
||||
if (mDecoder) {
|
||||
mDecoder->SetOutputCaptured(mTracksCaptured.Ref());
|
||||
if (!mTracksCaptured.Ref()) {
|
||||
mDecoder->SetOutputCaptureState(MediaDecoder::OutputCaptureState::None);
|
||||
} else if (!AudioTracks() || !VideoTracks() || !shouldHaveTrackSources) {
|
||||
// We've been unlinked, or tracks are not yet known.
|
||||
mDecoder->SetOutputCaptureState(MediaDecoder::OutputCaptureState::Halt);
|
||||
} else {
|
||||
mDecoder->SetOutputCaptureState(MediaDecoder::OutputCaptureState::Capture,
|
||||
mTracksCaptured.Ref().get());
|
||||
}
|
||||
}
|
||||
|
||||
// Start with all MediaTracks
|
||||
|
||||
Reference in New Issue
Block a user