Bug 926598: fix some this-in-initializer warnings and remove tabs in MediaPipeline r=ekr
authorRandell Jesup <rjesup@jesup.org>
Wed, 16 Oct 2013 16:12:09 -0400
changeset 164889 6eec00ce41937887b891932b2008b8ada65d6f1f
parent 164888 e282e8a9712a1a1fb6034ed74d188a65c9acf8c9
child 164890 1850054aca10e97833160551b7c5726609c20262
push id3066
push userakeybl@mozilla.com
push dateMon, 09 Dec 2013 19:58:46 +0000
treeherdermozilla-beta@a31a0dce83aa [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersekr
bugs926598
milestone27.0a1
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
Bug 926598: fix some this-in-initializer warnings and remove tabs in MediaPipeline 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
@@ -1,8 +1,9 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 // Original author: ekr@rtfm.com
 
 #include "logging.h"
 #include "MediaPipeline.h"
@@ -143,25 +144,25 @@ nsresult MediaPipeline::TransportReady_s
   MOZ_ASSERT(!description_.empty());
   bool rtcp = !(flow == rtp_transport_);
   State *state = rtcp ? &rtcp_state_ : &rtp_state_;
 
   // TODO(ekr@rtfm.com): implement some kind of notification on
   // failure. bug 852665.
   if (*state != MP_CONNECTING) {
     MOZ_MTLOG(ML_ERROR, "Transport ready for flow in wrong state:" <<
-	      description_ << ": " << (rtcp ? "rtcp" : "rtp"));
+              description_ << ": " << (rtcp ? "rtcp" : "rtp"));
     return NS_ERROR_FAILURE;
   }
 
   nsresult res;
 
   MOZ_MTLOG(ML_DEBUG, "Transport ready for pipeline " <<
-	    static_cast<void *>(this) << " flow " << description_ << ": " <<
-	    (rtcp ? "rtcp" : "rtp"));
+            static_cast<void *>(this) << " flow " << description_ << ": " <<
+            (rtcp ? "rtcp" : "rtp"));
 
   // Now instantiate the SRTP objects
   TransportLayerDtls *dtls = static_cast<TransportLayerDtls *>(
       flow->GetLayer(TransportLayerDtls::ID()));
   MOZ_ASSERT(dtls);  // DTLS is mandatory
 
   uint16_t cipher_suite;
   res = dtls->GetSrtpCipher(&cipher_suite);
--- a/media/webrtc/signaling/src/mediapipeline/MediaPipeline.h
+++ b/media/webrtc/signaling/src/mediapipeline/MediaPipeline.h
@@ -1,8 +1,9 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 // Original author: ekr@rtfm.com
 
 #ifndef mediapipeline_h__
 #define mediapipeline_h__
@@ -78,17 +79,16 @@ class MediaPipeline : public sigslot::ha
         track_id_(track_id),
         conduit_(conduit),
         rtp_transport_(rtp_transport),
         rtp_state_(MP_CONNECTING),
         rtcp_transport_(rtcp_transport),
         rtcp_state_(MP_CONNECTING),
         main_thread_(main_thread),
         sts_thread_(sts_thread),
-        transport_(new PipelineTransport(this)),
         rtp_send_srtp_(),
         rtcp_send_srtp_(),
         rtp_recv_srtp_(),
         rtcp_recv_srtp_(),
         rtp_packets_sent_(0),
         rtcp_packets_sent_(0),
         rtp_packets_received_(0),
         rtcp_packets_received_(0),
@@ -97,16 +97,18 @@ class MediaPipeline : public sigslot::ha
       // To indicate rtcp-mux rtcp_transport should be NULL.
       // Therefore it's an error to send in the same flow for
       // both rtp and rtcp.
       MOZ_ASSERT(rtp_transport_ != rtcp_transport_);
 
       if (!rtcp_transport_) {
         rtcp_transport_ = rtp_transport;
       }
+      // PipelineTransport() will access this->sts_thread_; moved here for safety
+      transport_ = new PipelineTransport(this);
   }
 
   virtual ~MediaPipeline();
 
   // Must be called on the STS thread.  Must be called after ShutdownMedia_m().
   void ShutdownTransport_s();
 
   // Must be called on the main thread.
@@ -140,17 +142,17 @@ class MediaPipeline : public sigslot::ha
   virtual void DetachMediaStream() {}
 
   // Separate class to allow ref counting
   class PipelineTransport : public TransportInterface {
    public:
     // Implement the TransportInterface functions
     PipelineTransport(MediaPipeline *pipeline)
         : pipeline_(pipeline),
-	  sts_thread_(pipeline->sts_thread_) {}
+          sts_thread_(pipeline->sts_thread_) {}
 
     void Detach() { pipeline_ = NULL; }
     MediaPipeline *pipeline() const { return pipeline_; }
 
     virtual nsresult SendRtpPacket(const void* data, int len);
     virtual nsresult SendRtcpPacket(const void* data, int len);
 
    private:
@@ -178,22 +180,22 @@ class MediaPipeline : public sigslot::ha
                          size_t len);
   void RtcpPacketReceived(TransportLayer *layer, const unsigned char *data,
                           size_t len);
   void PacketReceived(TransportLayer *layer, const unsigned char *data,
                       size_t len);
 
   Direction direction_;
   RefPtr<MediaStream> stream_;  // A pointer to the stream we are servicing.
-  		      		// Written on the main thread.
-  		      		// Used on STS and MediaStreamGraph threads.
+                                // Written on the main thread.
+                                // Used on STS and MediaStreamGraph threads.
   TrackID track_id_;            // The track on the stream.
                                 // Written and used as the stream_;
   RefPtr<MediaSessionConduit> conduit_;  // Our conduit. Written on the main
-  			      		 // thread. Read on STS thread.
+                                         // thread. Read on STS thread.
 
   // The transport objects. Read/written on STS thread.
   RefPtr<TransportFlow> rtp_transport_;
   State rtp_state_;
   RefPtr<TransportFlow> rtcp_transport_;
   State rtcp_state_;
 
   // Pointers to the threads we need. Initialized at creation
@@ -380,20 +382,20 @@ class MediaPipelineTransmit : public Med
    private:
     void NewData(MediaStreamGraph* graph, TrackID tid,
                  TrackRate rate,
                  TrackTicks offset,
                  uint32_t events,
                  const MediaSegment& media);
 
     virtual void ProcessAudioChunk(AudioSessionConduit *conduit,
-				   TrackRate rate, AudioChunk& chunk);
+                                   TrackRate rate, AudioChunk& chunk);
 #ifdef MOZILLA_INTERNAL_API
     virtual void ProcessVideoChunk(VideoSessionConduit *conduit,
-				   TrackRate rate, VideoChunk& chunk);
+                                   TrackRate rate, VideoChunk& chunk);
 #endif
     RefPtr<MediaSessionConduit> conduit_;
     volatile bool active_;
     bool direct_connect_;
 
     int32_t last_img_; // serial number of last Image
 
     // These vars handle breaking audio samples into exact 10ms chunks:
@@ -512,17 +514,17 @@ class MediaPipelineReceiveVideo : public
                             MediaStream *stream,
                             TrackID track_id,
                             RefPtr<VideoSessionConduit> conduit,
                             RefPtr<TransportFlow> rtp_transport,
                             RefPtr<TransportFlow> rtcp_transport) :
       MediaPipelineReceive(pc, main_thread, sts_thread,
                            stream, track_id, conduit, rtp_transport,
                            rtcp_transport),
-      renderer_(new PipelineRenderer(this)),
+      renderer_(new PipelineRenderer(MOZ_THIS_IN_INITIALIZER_LIST())),
       listener_(new PipelineListener(stream->AsSourceStream(), track_id)) {
   }
 
   // Called on the main thread.
   virtual void DetachMediaStream() {
     ASSERT_ON_THREAD(main_thread_);
 
     listener_->EndTrack();