Bug 1208371 - Forward declare MediaStreamTrack in MediaPipeline.h. r=bwc
authorAndreas Pehrson <pehrsons@gmail.com>
Fri, 22 Jan 2016 11:33:43 +0800
changeset 348494 d599fc36575d5a02aca3b161728bce0bc8e2324b
parent 348493 b8f87a9c54d893808c484fa80b0e09ef08d0ec7b
child 348495 f0d3d4e374e508b95fb12eea3caf742b4fb9685c
push id14828
push userpehrsons@gmail.com
push dateThu, 07 Apr 2016 12:57:27 +0000
reviewersbwc
bugs1208371
milestone48.0a1
Bug 1208371 - Forward declare MediaStreamTrack in MediaPipeline.h. r=bwc MozReview-Commit-ID: C6PCMIEJVQD
media/webrtc/signaling/src/mediapipeline/MediaPipeline.cpp
media/webrtc/signaling/src/mediapipeline/MediaPipeline.h
--- a/media/webrtc/signaling/src/mediapipeline/MediaPipeline.cpp
+++ b/media/webrtc/signaling/src/mediapipeline/MediaPipeline.cpp
@@ -670,16 +670,22 @@ void MediaPipelineTransmit::AttachToTrac
   domtrack_->AddListener(listener_);
 
 #ifndef MOZILLA_INTERNAL_API
   // this enables the unit tests that can't fiddle with principals and the like
   listener_->SetEnabled(true);
 #endif
 }
 
+bool
+MediaPipelineTransmit::IsVideo() const
+{
+  return !!domtrack_->AsVideoStreamTrack();
+}
+
 #if !defined(MOZILLA_EXTERNAL_LINKAGE)
 void MediaPipelineTransmit::UpdateSinkIdentity_m(MediaStreamTrack* track,
                                                  nsIPrincipal* principal,
                                                  const PeerIdentity* sinkIdentity) {
   ASSERT_ON_THREAD(main_thread_);
 
   if (track != nullptr && track != domtrack_) {
     // If a track is specified, then it might not be for this pipeline,
@@ -699,16 +705,28 @@ void MediaPipelineTransmit::UpdateSinkId
       enableTrack = (*sinkIdentity == *trackIdentity);
     }
   }
 
   listener_->SetEnabled(enableTrack);
 }
 #endif
 
+void
+MediaPipelineTransmit::DetachMedia()
+{
+  ASSERT_ON_THREAD(main_thread_);
+  if (domtrack_) {
+    domtrack_->RemoveDirectListener(listener_);
+    domtrack_->RemoveListener(listener_);
+    domtrack_ = nullptr;
+  }
+  // Let the listener be destroyed with the pipeline (or later).
+}
+
 nsresult MediaPipelineTransmit::TransportReady_s(TransportInfo &info) {
   ASSERT_ON_THREAD(sts_thread_);
   // Call base ready function.
   MediaPipeline::TransportReady_s(info);
 
   // Should not be set for a transmitter
   if (&info == &rtp_) {
     listener_->SetActive(true);
--- a/media/webrtc/signaling/src/mediapipeline/MediaPipeline.h
+++ b/media/webrtc/signaling/src/mediapipeline/MediaPipeline.h
@@ -9,17 +9,16 @@
 #define mediapipeline_h__
 
 #include "sigslot.h"
 
 #ifdef USE_FAKE_MEDIA_STREAMS
 #include "FakeMediaStreams.h"
 #else
 #include "DOMMediaStream.h"
-#include "MediaStreamTrack.h"
 #include "MediaStreamGraph.h"
 #include "VideoUtils.h"
 #endif
 #include "MediaConduitInterface.h"
 #include "MediaPipelineFilter.h"
 #include "AudioSegment.h"
 #include "mozilla/ReentrantMonitor.h"
 #include "mozilla/Atomics.h"
@@ -403,37 +402,29 @@ public:
   {}
 
   // Initialize (stuff here may fail)
   virtual nsresult Init() override;
 
   virtual void AttachToTrack(const std::string& track_id);
 
   // written and used from MainThread
-  virtual bool IsVideo() const override { return !!domtrack_->AsVideoStreamTrack(); }
+  virtual bool IsVideo() const override;
 
 #if !defined(MOZILLA_EXTERNAL_LINKAGE)
   // When the principal of the domtrack changes, it calls through to here
   // so that we can determine whether to enable track transmission.
   // `track` has to be null or equal `domtrack_` for us to apply the update.
   virtual void UpdateSinkIdentity_m(dom::MediaStreamTrack* track,
                                     nsIPrincipal* principal,
                                     const PeerIdentity* sinkIdentity);
 #endif
 
   // Called on the main thread.
-  virtual void DetachMedia() override {
-    ASSERT_ON_THREAD(main_thread_);
-    if (domtrack_) {
-      domtrack_->RemoveDirectListener(listener_);
-      domtrack_->RemoveListener(listener_);
-      domtrack_ = nullptr;
-    }
-    // Let the listener be destroyed with the pipeline (or later).
-  }
+  virtual void DetachMedia() override;
 
   // Override MediaPipeline::TransportReady.
   virtual nsresult TransportReady_s(TransportInfo &info) override;
 
   // Replace a track with a different one
   // In non-compliance with the likely final spec, allow the new
   // track to be part of a different stream (since we don't support
   // multiple tracks of a type in a stream yet).  bug 1056650