зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1172394 - Use tail dispatching instead of mSrcStreamTracksAvailable. r=padenot
Differential Revision: https://phabricator.services.mozilla.com/D52046 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
fc5a72ac75
Коммит
30c47c82ac
|
@ -5090,7 +5090,6 @@ void HTMLMediaElement::EndSrcMediaStreamPlayback() {
|
|||
|
||||
mSrcStream->UnregisterTrackListener(mMediaStreamTrackListener.get());
|
||||
mMediaStreamTrackListener = nullptr;
|
||||
mSrcStreamTracksAvailable = false;
|
||||
mSrcStreamPlaybackEnded = false;
|
||||
mSrcStreamReportPlaybackEnded = false;
|
||||
mSrcStreamVideoPrincipal = nullptr;
|
||||
|
@ -5163,23 +5162,9 @@ void HTMLMediaElement::NotifyMediaStreamTrackAdded(
|
|||
|
||||
UpdateReadyStateInternal();
|
||||
|
||||
if (!mSrcStreamTracksAvailable) {
|
||||
mAbstractMainThread->Dispatch(NS_NewRunnableFunction(
|
||||
"HTMLMediaElement::NotifyMediaStreamTrackAdded->FirstFrameLoaded",
|
||||
[this, self = RefPtr<HTMLMediaElement>(this), stream = mSrcStream]() {
|
||||
if (!mSrcStream || mSrcStream != stream) {
|
||||
return;
|
||||
}
|
||||
|
||||
LOG(LogLevel::Debug,
|
||||
("MediaElement %p MediaStream tracks available", this));
|
||||
|
||||
mSrcStreamTracksAvailable = true;
|
||||
|
||||
FirstFrameLoaded();
|
||||
UpdateReadyStateInternal();
|
||||
}));
|
||||
}
|
||||
mAbstractMainThread->TailDispatcher().AddDirectTask(
|
||||
NewRunnableMethod("HTMLMediaElement::FirstFrameLoaded", this,
|
||||
&HTMLMediaElement::FirstFrameLoaded));
|
||||
}
|
||||
|
||||
void HTMLMediaElement::NotifyMediaStreamTrackRemoved(
|
||||
|
@ -5600,13 +5585,6 @@ void HTMLMediaElement::UpdateReadyStateInternal() {
|
|||
}
|
||||
|
||||
if (mSrcStream && mReadyState < HAVE_METADATA) {
|
||||
if (!mSrcStreamTracksAvailable) {
|
||||
LOG(LogLevel::Debug, ("MediaElement %p UpdateReadyStateInternal() "
|
||||
"MediaStreamTracks not available yet",
|
||||
this));
|
||||
return;
|
||||
}
|
||||
|
||||
bool hasAudioTracks = AudioTracks() && !AudioTracks()->IsEmpty();
|
||||
bool hasVideoTracks = VideoTracks() && !VideoTracks()->IsEmpty();
|
||||
if (!hasAudioTracks && !hasVideoTracks) {
|
||||
|
@ -7023,7 +7001,9 @@ MediaDecoderOwner::NextFrameStatus HTMLMediaElement::NextFrameStatus() {
|
|||
return mDecoder->NextFrameStatus();
|
||||
}
|
||||
if (mSrcStream) {
|
||||
if (mSrcStreamTracksAvailable && !mSrcStreamPlaybackEnded) {
|
||||
AutoTArray<RefPtr<MediaTrack>, 4> tracks;
|
||||
GetAllEnabledMediaTracks(tracks);
|
||||
if (!tracks.IsEmpty() && !mSrcStreamPlaybackEnded) {
|
||||
return NEXT_FRAME_AVAILABLE;
|
||||
}
|
||||
return NEXT_FRAME_UNAVAILABLE;
|
||||
|
|
|
@ -1345,9 +1345,6 @@ class HTMLMediaElement : public nsGenericHTMLElement,
|
|||
// enabled audio tracks, while mSrcStream is set.
|
||||
RefPtr<MediaStreamRenderer> mMediaStreamRenderer;
|
||||
|
||||
// True once mSrcStream's initial set of tracks are known.
|
||||
bool mSrcStreamTracksAvailable = false;
|
||||
|
||||
// True once PlaybackEnded() is called and we're playing a MediaStream.
|
||||
// Reset to false if we start playing mSrcStream again.
|
||||
Watchable<bool> mSrcStreamPlaybackEnded = {
|
||||
|
|
Загрузка…
Ссылка в новой задаче