зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset 2b5684b6362e (bug 1208373)
This commit is contained in:
Родитель
39ce674aa0
Коммит
51b3fd3c7d
|
@ -1035,15 +1035,6 @@ DOMMediaStream::CloneDOMTrack(MediaStreamTrack& aTrack,
|
|||
NotifyTrackAdded(newTrack);
|
||||
|
||||
newTrack->SetEnabled(aTrack.Enabled());
|
||||
newTrack->SetReadyState(aTrack.ReadyState());
|
||||
|
||||
if (aTrack.Ended()) {
|
||||
// For extra suspenders, make sure that we don't forward data by mistake
|
||||
// to the clone when the original has already ended.
|
||||
RefPtr<Pledge<bool, nsresult>> blockingPledge =
|
||||
inputPort->BlockSourceTrackId(inputTrackID);
|
||||
Unused << blockingPledge;
|
||||
}
|
||||
|
||||
return newTrack.forget();
|
||||
}
|
||||
|
|
|
@ -115,8 +115,7 @@ MediaStreamTrack::MediaStreamTrack(DOMMediaStream* aStream, TrackID aTrackID,
|
|||
: mOwningStream(aStream), mTrackID(aTrackID),
|
||||
mInputTrackID(aInputTrackID), mSource(aSource),
|
||||
mPrincipal(aSource->GetPrincipal()),
|
||||
mReadyState(MediaStreamTrackState::Live),
|
||||
mEnabled(true), mRemote(aSource->IsRemote())
|
||||
mEnded(false), mEnabled(true), mRemote(aSource->IsRemote()), mStopped(false)
|
||||
{
|
||||
|
||||
if (!gMediaStreamTrackLog) {
|
||||
|
@ -217,8 +216,8 @@ MediaStreamTrack::Stop()
|
|||
{
|
||||
LOG(LogLevel::Info, ("MediaStreamTrack %p Stop()", this));
|
||||
|
||||
if (Ended()) {
|
||||
LOG(LogLevel::Warning, ("MediaStreamTrack %p Already ended", this));
|
||||
if (mStopped) {
|
||||
LOG(LogLevel::Warning, ("MediaStreamTrack %p Already stopped", this));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -240,7 +239,7 @@ MediaStreamTrack::Stop()
|
|||
RefPtr<Pledge<bool>> p = port->BlockSourceTrackId(mInputTrackID);
|
||||
Unused << p;
|
||||
|
||||
mReadyState = MediaStreamTrackState::Ended;
|
||||
mStopped = true;
|
||||
}
|
||||
|
||||
already_AddRefed<Promise>
|
||||
|
@ -356,13 +355,13 @@ MediaStreamTrack::NotifyEnded()
|
|||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
if (Ended()) {
|
||||
if (mEnded) {
|
||||
return;
|
||||
}
|
||||
|
||||
LOG(LogLevel::Info, ("MediaStreamTrack %p ended", this));
|
||||
|
||||
mReadyState = MediaStreamTrackState::Ended;
|
||||
mEnded = true;
|
||||
|
||||
DispatchTrustedEvent(NS_LITERAL_STRING("ended"));
|
||||
}
|
||||
|
|
|
@ -266,20 +266,10 @@ public:
|
|||
already_AddRefed<Promise>
|
||||
ApplyConstraints(const dom::MediaTrackConstraints& aConstraints, ErrorResult &aRv);
|
||||
already_AddRefed<MediaStreamTrack> Clone();
|
||||
MediaStreamTrackState ReadyState() { return mReadyState; }
|
||||
|
||||
IMPL_EVENT_HANDLER(ended)
|
||||
|
||||
/**
|
||||
* Convenience (and legacy) method for when ready state is "ended".
|
||||
*/
|
||||
bool Ended() const { return mReadyState == MediaStreamTrackState::Ended; }
|
||||
|
||||
/**
|
||||
* Forces the ready state to a particular value, for instance when we're
|
||||
* cloning an already ended track.
|
||||
*/
|
||||
void SetReadyState(MediaStreamTrackState aState) { mReadyState = aState; }
|
||||
bool Ended() const { return mEnded; }
|
||||
|
||||
/**
|
||||
* Notified by the MediaStreamGraph, through our owning MediaStream on the
|
||||
|
@ -417,9 +407,10 @@ protected:
|
|||
nsCOMPtr<nsIPrincipal> mPendingPrincipal;
|
||||
RefPtr<PrincipalHandleListener> mPrincipalHandleListener;
|
||||
nsString mID;
|
||||
MediaStreamTrackState mReadyState;
|
||||
bool mEnded;
|
||||
bool mEnabled;
|
||||
const bool mRemote;
|
||||
bool mStopped;
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
|
|
|
@ -63,11 +63,6 @@ dictionary MediaTrackConstraints : MediaTrackConstraintSet {
|
|||
sequence<MediaTrackConstraintSet> advanced;
|
||||
};
|
||||
|
||||
enum MediaStreamTrackState {
|
||||
"live",
|
||||
"ended"
|
||||
};
|
||||
|
||||
[Exposed=Window]
|
||||
interface MediaStreamTrack : EventTarget {
|
||||
readonly attribute DOMString kind;
|
||||
|
@ -79,7 +74,7 @@ interface MediaStreamTrack : EventTarget {
|
|||
// attribute EventHandler onunmute;
|
||||
// readonly attribute boolean _readonly;
|
||||
// readonly attribute boolean remote;
|
||||
readonly attribute MediaStreamTrackState readyState;
|
||||
// readonly attribute MediaStreamTrackState readyState;
|
||||
attribute EventHandler onended;
|
||||
MediaStreamTrack clone ();
|
||||
void stop ();
|
||||
|
|
Загрузка…
Ссылка в новой задаче