Backed out 2 changesets (bug 1571705) for causing liux debug gtest asertion failures CLOSED TREE
authorCiure Andrei <aciure@mozilla.com>
Mon, 19 Aug 2019 19:48:25 +0300
changeset 488773 d7d0e994a9a30e9a63d93c991eb3a36de9a20286
parent 488772 f65891d4a353093d98109f472000ee1ea6cf0d66
child 488774 7a7a0fdd1a83cc8aa67986841a9a73ec1e5ee278
push id92947
push useraciure@mozilla.com
push dateMon, 19 Aug 2019 16:50:07 +0000
treeherderautoland@d7d0e994a9a3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1571705
milestone70.0a1
backs out3d33cae2d9f95d2119c0f98948ee85d3de9e3b39
decff7a230b771cf3ce8d07bd466f3799e04dcb9
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backed out 2 changesets (bug 1571705) for causing liux debug gtest asertion failures CLOSED TREE Backed out changeset 3d33cae2d9f9 (bug 1571705) Backed out changeset decff7a230b7 (bug 1571705)
dom/media/AudioStreamTrack.cpp
dom/media/AudioStreamTrack.h
dom/media/MediaManager.cpp
dom/media/MediaStreamGraph.cpp
dom/media/MediaStreamTrack.cpp
dom/media/MediaStreamTrack.h
dom/media/VideoStreamTrack.cpp
dom/media/VideoStreamTrack.h
--- a/dom/media/AudioStreamTrack.cpp
+++ b/dom/media/AudioStreamTrack.cpp
@@ -35,15 +35,10 @@ void AudioStreamTrack::SetAudioOutputVol
 void AudioStreamTrack::GetLabel(nsAString& aLabel, CallerType aCallerType) {
   if (nsContentUtils::ResistFingerprinting(aCallerType)) {
     aLabel.AssignLiteral("Internal Microphone");
     return;
   }
   MediaStreamTrack::GetLabel(aLabel, aCallerType);
 }
 
-already_AddRefed<MediaStreamTrack> AudioStreamTrack::CloneInternal() {
-  return do_AddRef(new AudioStreamTrack(mWindow, mInputStream, mTrackID,
-                                        mSource, ReadyState(), mConstraints));
-}
-
 }  // namespace dom
 }  // namespace mozilla
--- a/dom/media/AudioStreamTrack.h
+++ b/dom/media/AudioStreamTrack.h
@@ -12,33 +12,36 @@
 namespace mozilla {
 namespace dom {
 
 class AudioStreamTrack : public MediaStreamTrack {
  public:
   AudioStreamTrack(
       nsPIDOMWindowInner* aWindow, MediaStream* aInputStream, TrackID aTrackID,
       MediaStreamTrackSource* aSource,
-      MediaStreamTrackState aReadyState = MediaStreamTrackState::Live,
       const MediaTrackConstraints& aConstraints = MediaTrackConstraints())
-      : MediaStreamTrack(aWindow, aInputStream, aTrackID, aSource, aReadyState,
+      : MediaStreamTrack(aWindow, aInputStream, aTrackID, aSource,
                          aConstraints) {}
 
   AudioStreamTrack* AsAudioStreamTrack() override { return this; }
   const AudioStreamTrack* AsAudioStreamTrack() const override { return this; }
 
   void AddAudioOutput(void* aKey);
   void RemoveAudioOutput(void* aKey);
   void SetAudioOutputVolume(void* aKey, float aVolume);
 
   // WebIDL
   void GetKind(nsAString& aKind) override { aKind.AssignLiteral("audio"); }
 
   void GetLabel(nsAString& aLabel, CallerType aCallerType) override;
 
  protected:
-  already_AddRefed<MediaStreamTrack> CloneInternal() override;
+  already_AddRefed<MediaStreamTrack> CloneInternal() override {
+    return do_AddRef(
+        new AudioStreamTrack(mWindow, Ended() ? nullptr : mInputStream.get(),
+                             mTrackID, mSource, mConstraints));
+  }
 };
 
 }  // namespace dom
 }  // namespace mozilla
 
 #endif /* AUDIOSTREAMTRACK_H_ */
--- a/dom/media/MediaManager.cpp
+++ b/dom/media/MediaManager.cpp
@@ -1175,31 +1175,29 @@ class GetUserMediaStreamRunnable : publi
         mAudioDevice->GetName(audioDeviceName);
         RefPtr<MediaStream> stream = msg->CreateSourceStream();
         audioTrackSource = new LocalTrackSource(
             principal, audioDeviceName, mSourceListener,
             mAudioDevice->GetMediaSource(), stream, kAudioTrack, mPeerIdentity);
         MOZ_ASSERT(IsOn(mConstraints.mAudio));
         RefPtr<MediaStreamTrack> track = new dom::AudioStreamTrack(
             window, stream, kAudioTrack, audioTrackSource,
-            dom::MediaStreamTrackState::Live,
             GetInvariant(mConstraints.mAudio));
         domStream->AddTrackInternal(track);
       }
       if (mVideoDevice) {
         nsString videoDeviceName;
         mVideoDevice->GetName(videoDeviceName);
         RefPtr<MediaStream> stream = msg->CreateSourceStream();
         videoTrackSource = new LocalTrackSource(
             principal, videoDeviceName, mSourceListener,
             mVideoDevice->GetMediaSource(), stream, kVideoTrack, mPeerIdentity);
         MOZ_ASSERT(IsOn(mConstraints.mVideo));
         RefPtr<MediaStreamTrack> track = new dom::VideoStreamTrack(
             window, stream, kVideoTrack, videoTrackSource,
-            dom::MediaStreamTrackState::Live,
             GetInvariant(mConstraints.mVideo));
         domStream->AddTrackInternal(track);
         switch (mVideoDevice->GetMediaSource()) {
           case MediaSourceEnum::Browser:
           case MediaSourceEnum::Screen:
           case MediaSourceEnum::Window:
             // Wait for first frame for screen-sharing devices, to ensure
             // with and height settings are available immediately, to pass wpt.
--- a/dom/media/MediaStreamGraph.cpp
+++ b/dom/media/MediaStreamGraph.cpp
@@ -2954,21 +2954,18 @@ bool SourceMediaStream::HasPendingAudioT
   }
 
   return audioTrackPresent;
 }
 
 void MediaInputPort::Init() {
   LOG(LogLevel::Debug, ("%p: Adding MediaInputPort %p (from %p to %p)",
                         mSource->GraphImpl(), this, mSource, mDest));
-  // Only connect the port if it wasn't disconnected on allocation.
-  if (mSource) {
-    mSource->AddConsumer(this);
-    mDest->AddInput(this);
-  }
+  mSource->AddConsumer(this);
+  mDest->AddInput(this);
   // mPortCount decremented via MediaInputPort::Destroy's message
   ++mDest->GraphImpl()->mPortCount;
 }
 
 void MediaInputPort::Disconnect() {
   GraphImpl()->AssertOnGraphThreadOrNotRunning();
   NS_ASSERTION(!mSource == !mDest,
                "mSource must either both be null or both non-null");
@@ -3102,36 +3099,27 @@ already_AddRefed<MediaInputPort> Process
       // The graph holds its reference implicitly
       mPort->GraphImpl()->SetStreamOrderDirty();
       Unused << mPort.forget();
     }
     void RunDuringShutdown() override { Run(); }
     RefPtr<MediaInputPort> mPort;
   };
 
+  MOZ_ASSERT(aStream->GraphImpl() == GraphImpl());
   MOZ_ASSERT(aTrackID == TRACK_ANY || IsTrackIDExplicit(aTrackID),
              "Only TRACK_ANY and explicit ID are allowed for source track");
   MOZ_ASSERT(
       aDestTrackID == TRACK_ANY || IsTrackIDExplicit(aDestTrackID),
       "Only TRACK_ANY and explicit ID are allowed for destination track");
   MOZ_ASSERT(
       aTrackID != TRACK_ANY || aDestTrackID == TRACK_ANY,
       "Generic MediaInputPort cannot produce a single destination track");
-  RefPtr<MediaInputPort> port;
-  if (aStream->IsDestroyed()) {
-    // Create a port that's disconnected, which is what it'd be after its source
-    // stream is Destroy()ed normally. Disconnect() is idempotent so destroying
-    // this later is fine.
-    port = new MediaInputPort(nullptr, aTrackID, nullptr, aDestTrackID,
-                              aInputNumber, aOutputNumber);
-  } else {
-    MOZ_ASSERT(aStream->GraphImpl() == GraphImpl());
-    port = new MediaInputPort(aStream, aTrackID, this, aDestTrackID,
-                              aInputNumber, aOutputNumber);
-  }
+  RefPtr<MediaInputPort> port = new MediaInputPort(
+      aStream, aTrackID, this, aDestTrackID, aInputNumber, aOutputNumber);
   if (aBlockedTracks) {
     for (TrackID trackID : *aBlockedTracks) {
       port->BlockSourceTrackIdImpl(trackID, BlockingMode::CREATION);
     }
   }
   port->SetGraphImpl(GraphImpl());
   GraphImpl()->AppendMessage(MakeUnique<Message>(port));
   return port.forget();
--- a/dom/media/MediaStreamTrack.cpp
+++ b/dom/media/MediaStreamTrack.cpp
@@ -176,34 +176,32 @@ class MediaStreamTrack::TrackSink : publ
 
  private:
   WeakPtr<MediaStreamTrack> mTrack;
 };
 
 MediaStreamTrack::MediaStreamTrack(nsPIDOMWindowInner* aWindow,
                                    MediaStream* aInputStream, TrackID aTrackID,
                                    MediaStreamTrackSource* aSource,
-                                   MediaStreamTrackState aReadyState,
                                    const MediaTrackConstraints& aConstraints)
     : mWindow(aWindow),
       mInputStream(aInputStream),
-      mStream(aReadyState == MediaStreamTrackState::Live
-                  ? mInputStream->Graph()->CreateTrackUnionStream()
-                  : nullptr),
+      mStream(mInputStream ? mInputStream->Graph()->CreateTrackUnionStream()
+                           : nullptr),
       mPort(mStream ? mStream->AllocateInputPort(mInputStream) : nullptr),
       mTrackID(aTrackID),
       mSource(aSource),
       mSink(MakeUnique<TrackSink>(this)),
       mPrincipal(aSource->GetPrincipal()),
-      mReadyState(aReadyState),
+      mReadyState(mStream ? MediaStreamTrackState::Live
+                          : MediaStreamTrackState::Ended),
       mEnabled(true),
       mMuted(false),
       mConstraints(aConstraints) {
   if (!Ended()) {
-    MOZ_DIAGNOSTIC_ASSERT(!mInputStream->IsDestroyed());
     GetSource().RegisterSink(mSink.get());
 
     mMSGListener = new MSGListener(this);
     AddListener(mMSGListener);
   }
 
   nsresult rv;
   nsCOMPtr<nsIUUIDGenerator> uuidgen =
@@ -496,16 +494,17 @@ void MediaStreamTrack::RemoveConsumer(Me
     MOZ_ASSERT_UNREACHABLE("A consumer was not explicitly removed");
   }
 }
 
 already_AddRefed<MediaStreamTrack> MediaStreamTrack::Clone() {
   RefPtr<MediaStreamTrack> newTrack = CloneInternal();
   newTrack->SetEnabled(Enabled());
   newTrack->SetMuted(Muted());
+  MOZ_DIAGNOSTIC_ASSERT(newTrack->ReadyState() == ReadyState());
   return newTrack.forget();
 }
 
 void MediaStreamTrack::SetReadyState(MediaStreamTrackState aState) {
   MOZ_ASSERT(!(mReadyState == MediaStreamTrackState::Ended &&
                aState == MediaStreamTrackState::Live),
              "We don't support overriding the ready state from ended to live");
 
@@ -599,13 +598,16 @@ void MediaStreamTrack::RemoveDirectListe
   }
   mStream->RemoveDirectTrackListener(aListener, mTrackID);
 }
 
 already_AddRefed<MediaInputPort> MediaStreamTrack::ForwardTrackContentsTo(
     ProcessedMediaStream* aStream) {
   MOZ_ASSERT(NS_IsMainThread());
   MOZ_RELEASE_ASSERT(aStream);
-  return aStream->AllocateInputPort(mStream, mTrackID, mTrackID);
+  MOZ_DIAGNOSTIC_ASSERT(!Ended());
+  RefPtr<MediaInputPort> port =
+      aStream->AllocateInputPort(mStream, mTrackID, mTrackID);
+  return port.forget();
 }
 
 }  // namespace dom
 }  // namespace mozilla
--- a/dom/media/MediaStreamTrack.h
+++ b/dom/media/MediaStreamTrack.h
@@ -411,17 +411,16 @@ class MediaStreamTrack : public DOMEvent
 
  public:
   /**
    * aTrackID is the MediaStreamGraph track ID for the track in aInputStream.
    */
   MediaStreamTrack(
       nsPIDOMWindowInner* aWindow, MediaStream* aInputStream, TrackID aTrackID,
       MediaStreamTrackSource* aSource,
-      MediaStreamTrackState aReadyState = MediaStreamTrackState::Live,
       const MediaTrackConstraints& aConstraints = MediaTrackConstraints());
 
   NS_DECL_ISUPPORTS_INHERITED
   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(MediaStreamTrack,
                                            DOMEventTargetHelper)
 
   MOZ_DECLARE_WEAKREFERENCE_TYPENAME(MediaStreamTrack)
 
@@ -612,19 +611,19 @@ class MediaStreamTrack : public DOMEvent
   nsTArray<PrincipalChangeObserver<MediaStreamTrack>*>
       mPrincipalChangeObservers;
 
   nsTArray<WeakPtr<MediaStreamTrackConsumer>> mConsumers;
 
   // We need this to track our parent object.
   nsCOMPtr<nsPIDOMWindowInner> mWindow;
 
-  // The input MediaStream assigned us by the data producer.
+  // The input MediaStream assigned us by the data producer. Valid until we end.
   // Owned by the producer.
-  const RefPtr<MediaStream> mInputStream;
+  RefPtr<MediaStream> mInputStream;
   // The MediaStream representing this MediaStreamTrack in the MediaStreamGraph.
   // Valid until we end. Owned by us.
   RefPtr<ProcessedMediaStream> mStream;
   // The MediaInputPort connecting mInputStream to mStream. Valid until we end.
   // Owned by us.
   RefPtr<MediaInputPort> mPort;
   // The TrackID of this track in mInputStream and mStream.
   const TrackID mTrackID;
--- a/dom/media/VideoStreamTrack.cpp
+++ b/dom/media/VideoStreamTrack.cpp
@@ -12,20 +12,19 @@
 #include "VideoOutput.h"
 
 namespace mozilla {
 namespace dom {
 
 VideoStreamTrack::VideoStreamTrack(nsPIDOMWindowInner* aWindow,
                                    MediaStream* aInputStream, TrackID aTrackID,
                                    MediaStreamTrackSource* aSource,
-                                   MediaStreamTrackState aReadyState,
                                    const MediaTrackConstraints& aConstraints)
-    : MediaStreamTrack(aWindow, aInputStream, aTrackID, aSource, aReadyState,
-                       aConstraints) {}
+    : MediaStreamTrack(aWindow, aInputStream, aTrackID, aSource, aConstraints) {
+}
 
 void VideoStreamTrack::Destroy() {
   mVideoOutputs.Clear();
   MediaStreamTrack::Destroy();
 }
 
 void VideoStreamTrack::AddVideoOutput(VideoFrameContainer* aSink) {
   if (Ended()) {
@@ -75,15 +74,10 @@ void VideoStreamTrack::RemoveVideoOutput
 void VideoStreamTrack::GetLabel(nsAString& aLabel, CallerType aCallerType) {
   if (nsContentUtils::ResistFingerprinting(aCallerType)) {
     aLabel.AssignLiteral("Internal Camera");
     return;
   }
   MediaStreamTrack::GetLabel(aLabel, aCallerType);
 }
 
-already_AddRefed<MediaStreamTrack> VideoStreamTrack::CloneInternal() {
-  return do_AddRef(new VideoStreamTrack(mWindow, mInputStream, mTrackID,
-                                        mSource, ReadyState(), mConstraints));
-}
-
 }  // namespace dom
 }  // namespace mozilla
--- a/dom/media/VideoStreamTrack.h
+++ b/dom/media/VideoStreamTrack.h
@@ -16,17 +16,16 @@ class VideoOutput;
 
 namespace dom {
 
 class VideoStreamTrack : public MediaStreamTrack {
  public:
   VideoStreamTrack(
       nsPIDOMWindowInner* aWindow, MediaStream* aInputStream, TrackID aTrackID,
       MediaStreamTrackSource* aSource,
-      MediaStreamTrackState aState = MediaStreamTrackState::Live,
       const MediaTrackConstraints& aConstraints = MediaTrackConstraints());
 
   void Destroy() override;
 
   VideoStreamTrack* AsVideoStreamTrack() override { return this; }
   const VideoStreamTrack* AsVideoStreamTrack() const override { return this; }
 
   void AddVideoOutput(VideoFrameContainer* aSink);
@@ -35,17 +34,21 @@ class VideoStreamTrack : public MediaStr
   void RemoveVideoOutput(VideoOutput* aOutput);
 
   // WebIDL
   void GetKind(nsAString& aKind) override { aKind.AssignLiteral("video"); }
 
   void GetLabel(nsAString& aLabel, CallerType aCallerType) override;
 
  protected:
-  already_AddRefed<MediaStreamTrack> CloneInternal() override;
+  already_AddRefed<MediaStreamTrack> CloneInternal() override {
+    return do_AddRef(
+        new VideoStreamTrack(mWindow, Ended() ? nullptr : mInputStream.get(),
+                             mTrackID, mSource, mConstraints));
+  }
 
  private:
   nsTArray<RefPtr<VideoOutput>> mVideoOutputs;
 };
 
 }  // namespace dom
 }  // namespace mozilla