Bug 855595: Add Listener as well as track for unittests. Also clean up warnings r=ekr
authorRandell Jesup <rjesup@jesup.org>
Thu, 28 Mar 2013 22:28:49 -0400
changeset 126672 231da3d51bf92acce23a1ac2ecf28e00b6936727
parent 126671 2c10a759015fcd3796fa0f21897de39207ee01a2
child 126673 89e99ecdf29f75eca977a57c62810f3c495d71bf
push idunknown
push userunknown
push dateunknown
reviewersekr
bugs855595
milestone22.0a1
Bug 855595: Add Listener as well as track for unittests. Also clean up warnings r=ekr
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
@@ -845,21 +845,16 @@ nsresult MediaPipelineReceiveAudio::Init
   description_ += "]";
 
   listener_->AddSelf(new AudioSegment());
 
   return MediaPipelineReceive::Init();
 }
 
 
-void GenericReceiveListener::AddSelf(MediaSegment* segment) {
-  RefPtr<TrackAddedCallback> callback = new GenericReceiveCallback(this);
-  AddTrackAndListener(source_, track_id_, track_rate_, this, segment, callback);
-}
-
 // Add a track and listener on the MSG thread using the MSG command queue
 static void AddTrackAndListener(MediaStream* source,
                                 TrackID track_id, TrackRate track_rate,
                                 MediaStreamListener* listener, MediaSegment* segment,
                                 const RefPtr<TrackAddedCallback>& completed) {
   // This both adds the listener and the track
 #ifdef MOZILLA_INTERNAL_API
   class Message : public ControlMessage {
@@ -911,20 +906,26 @@ static void AddTrackAndListener(MediaStr
     nsRefPtr<MediaStreamListener> listener_;
     const RefPtr<TrackAddedCallback> completed_;
   };
 
   MOZ_ASSERT(listener);
 
   source->GraphImpl()->AppendMessage(new Message(source, track_id, track_rate, segment, listener, completed));
 #else
+  source->AddListener(listener);
   source->AsSourceStream()->AddTrack(track_id, track_rate, 0, segment);
 #endif
 }
 
+void GenericReceiveListener::AddSelf(MediaSegment* segment) {
+  RefPtr<TrackAddedCallback> callback = new GenericReceiveCallback(this);
+  AddTrackAndListener(source_, track_id_, track_rate_, this, segment, callback);
+}
+
 MediaPipelineReceiveAudio::PipelineListener::PipelineListener(
     SourceMediaStream * source, TrackID track_id,
     const RefPtr<MediaSessionConduit>& conduit)
   : GenericReceiveListener(source, track_id, 16000), // XXX rate assumption
     conduit_(conduit)
 {
   MOZ_ASSERT(track_rate_%100 == 0);
 }
--- a/media/webrtc/signaling/src/mediapipeline/MediaPipeline.h
+++ b/media/webrtc/signaling/src/mediapipeline/MediaPipeline.h
@@ -277,22 +277,16 @@ class GenericReceiveCallback : public Tr
   void TrackAdded(TrackTicks time) {
     listener_->SetPlayedTicks(time);
   }
 
  private:
   RefPtr<GenericReceiveListener> listener_;
 };
 
-// Add a track and listener on the MSG thread using the MSG command queue
-static void AddTrackAndListener(MediaStream* source,
-                                TrackID track_id, TrackRate track_rate,
-                                MediaStreamListener* listener, MediaSegment* segment,
-                                const RefPtr<TrackAddedCallback>& completed);
-
 class ConduitDeleteEvent: public nsRunnable
 {
 public:
   ConduitDeleteEvent(TemporaryRef<MediaSessionConduit> aConduit) :
     mConduit(aConduit) {}
 
   /* we exist solely to proxy release of the conduit */
   NS_IMETHOD Run() { return NS_OK; }