Bug 1208316 - End a media element when its MediaStream source goes inactive. r=jib
MozReview-Commit-ID: 89LMDSsJLJP
This commit is contained in:
@@ -3873,22 +3873,6 @@ public:
|
||||
void Forget() { mElement = nullptr; }
|
||||
|
||||
// Main thread
|
||||
void DoNotifyFinished()
|
||||
{
|
||||
mFinished = true;
|
||||
if (mElement) {
|
||||
RefPtr<HTMLMediaElement> deathGrip = mElement;
|
||||
|
||||
// Update NextFrameStatus() to move to NEXT_FRAME_UNAVAILABLE and
|
||||
// HAVE_CURRENT_DATA.
|
||||
mElement = nullptr;
|
||||
// NotifyWatchers before calling PlaybackEnded since PlaybackEnded
|
||||
// can remove watchers.
|
||||
NotifyWatchers();
|
||||
|
||||
deathGrip->PlaybackEnded();
|
||||
}
|
||||
}
|
||||
|
||||
MediaDecoderOwner::NextFrameStatus NextFrameStatus()
|
||||
{
|
||||
@@ -3944,15 +3928,6 @@ public:
|
||||
}
|
||||
aGraph->DispatchToMainThreadAfterStreamStateUpdate(event.forget());
|
||||
}
|
||||
virtual void NotifyEvent(MediaStreamGraph* aGraph,
|
||||
MediaStreamGraphEvent event) override
|
||||
{
|
||||
if (event == MediaStreamGraphEvent::EVENT_FINISHED) {
|
||||
nsCOMPtr<nsIRunnable> event =
|
||||
NewRunnableMethod(this, &StreamListener::DoNotifyFinished);
|
||||
aGraph->DispatchToMainThreadAfterStreamStateUpdate(event.forget());
|
||||
}
|
||||
}
|
||||
virtual void NotifyHasCurrentData(MediaStreamGraph* aGraph) override
|
||||
{
|
||||
MutexAutoLock lock(mMutex);
|
||||
@@ -4019,6 +3994,17 @@ public:
|
||||
mElement->NotifyMediaStreamTrackRemoved(aTrack);
|
||||
}
|
||||
|
||||
void NotifyInactive() override
|
||||
{
|
||||
LOG(LogLevel::Debug, ("%p, mSrcStream %p became inactive",
|
||||
mElement, mElement->mSrcStream.get()));
|
||||
MOZ_ASSERT(!mElement->mSrcStream->Active());
|
||||
if (mElement->mMediaStreamListener) {
|
||||
mElement->mMediaStreamListener->Forget();
|
||||
}
|
||||
mElement->PlaybackEnded();
|
||||
}
|
||||
|
||||
protected:
|
||||
HTMLMediaElement* const mElement;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user