Bug 1423241 - Implement MediaStreamTrackListener::NotifyOutput. r=padenot

Differential Revision: https://phabricator.services.mozilla.com/D9094

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Andreas Pehrson 2018-11-23 15:00:31 +00:00
parent e6f44b02af
commit b2d7b962cd
2 changed files with 20 additions and 7 deletions

View File

@ -188,22 +188,32 @@ void MediaStreamGraphImpl::UpdateCurrentTimeForStreams(
MediaStreamListener* l = stream->mListeners[j];
l->NotifyOutput(this, mProcessedTime);
}
}
for (StreamTracks::TrackIter track(stream->mTracks); !track.IsEnded();
track.Next()) {
if (track->IsEnded() &&
track->GetEnd() <=
stream->GraphTimeToStreamTime(mStateComputedTime) &&
!track->NotifiedEnded()) {
for (StreamTracks::TrackIter track(stream->mTracks); !track.IsEnded();
track.Next()) {
StreamTime streamCurrentTime =
stream->GraphTimeToStreamTime(mStateComputedTime);
if (track->IsEnded() && track->GetEnd() <= streamCurrentTime) {
if (!track->NotifiedEnded()) {
// Playout of this track ended and listeners have not been notified.
track->NotifyEnded();
for (const TrackBound<MediaStreamTrackListener>& listener :
stream->mTrackListeners) {
if (listener.mTrackID == track->GetID()) {
track->NotifyEnded();
listener.mListener->NotifyOutput(this, track->GetEnd());
listener.mListener->NotifyEnded();
}
}
}
} else {
for (const TrackBound<MediaStreamTrackListener>& listener :
stream->mTrackListeners) {
if (listener.mTrackID == track->GetID()) {
listener.mListener->NotifyOutput(
this, streamCurrentTime - track->GetStart());
}
}
}
}

View File

@ -158,6 +158,9 @@ class MediaStreamTrackListener {
virtual void NotifyPrincipalHandleChanged(
MediaStreamGraph* aGraph, const PrincipalHandle& aNewPrincipalHandle) {}
virtual void NotifyOutput(MediaStreamGraph* aGraph,
StreamTime aCurrentTrackTime) {}
virtual void NotifyEnded() {}
virtual void NotifyRemoved() {}