Bug 1208373 - Implement MediaStreamTrack's "ended" event and onended EventHandler. r=smaug,jib

MozReview-Commit-ID: DtqzY5nIdPI

--HG--
extra : rebase_source : e236f799c05de0bef9c9d1248e4a6db2e0ae7f31
extra : source : f6a237afe9a83a8389a8e0a4f7435da3c4d0ca54
This commit is contained in:
Andreas Pehrson 2016-05-10 17:03:29 +02:00
Родитель ba8b7f91e2
Коммит e86ac0c2b2
3 изменённых файлов: 28 добавлений и 3 удалений

Просмотреть файл

@ -350,6 +350,22 @@ MediaStreamTrack::Clone()
return newStream->CloneDOMTrack(*this, mTrackID);
}
void
MediaStreamTrack::NotifyEnded()
{
MOZ_ASSERT(NS_IsMainThread());
if (mEnded) {
return;
}
LOG(LogLevel::Info, ("MediaStreamTrack %p ended", this));
mEnded = true;
DispatchTrustedEvent(NS_LITERAL_STRING("ended"));
}
DOMMediaStream*
MediaStreamTrack::GetInputDOMStream()
{

Просмотреть файл

@ -267,9 +267,18 @@ public:
ApplyConstraints(const dom::MediaTrackConstraints& aConstraints, ErrorResult &aRv);
already_AddRefed<MediaStreamTrack> Clone();
IMPL_EVENT_HANDLER(ended)
bool Ended() const { return mEnded; }
// Notifications from the MediaStreamGraph
void NotifyEnded() { mEnded = true; }
/**
* Notified by the MediaStreamGraph, through our owning MediaStream on the
* main thread.
*
* Note that this sets the track to ended and raises the "ended" event
* synchronously.
*/
void NotifyEnded();
/**
* Get this track's principal.

Просмотреть файл

@ -75,7 +75,7 @@ interface MediaStreamTrack : EventTarget {
// readonly attribute boolean _readonly;
// readonly attribute boolean remote;
// readonly attribute MediaStreamTrackState readyState;
// attribute EventHandler onended;
attribute EventHandler onended;
MediaStreamTrack clone ();
void stop ();
// MediaTrackCapabilities getCapabilities ();