Refactor the internal API to the rtp/rtcp module.
Combination of previous CLs in revisions 2211, 2212, 2214, 2215, 2216.
Review URL: https://webrtc-codereview.appspot.com/570008

git-svn-id: http://webrtc.googlecode.com/svn/trunk@2231 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/src/modules/interface/module.h b/src/modules/interface/module.h
index 37e5027..55f8491 100644
--- a/src/modules/interface/module.h
+++ b/src/modules/interface/module.h
@@ -19,9 +19,6 @@
 
 class Module {
  public:
-  // Change the unique identifier of this object.
-  virtual int32_t ChangeUniqueId(const int32_t id) = 0;
-
   // Returns the number of milliseconds until the module want a worker
   // thread to call Process.
   virtual int32_t TimeUntilNextProcess() = 0;
diff --git a/src/modules/rtp_rtcp/interface/rtp_rtcp.h b/src/modules/rtp_rtcp/interface/rtp_rtcp.h
index eb6c8e3..c1f9a4a 100644
--- a/src/modules/rtp_rtcp/interface/rtp_rtcp.h
+++ b/src/modules/rtp_rtcp/interface/rtp_rtcp.h
@@ -13,122 +13,75 @@
 
 #include <vector>
 
-#include "module.h"
-#include "rtp_rtcp_defines.h"
+#include "modules/interface/module.h"
+#include "modules/rtp_rtcp/interface/rtp_rtcp_defines.h"
 
 namespace webrtc {
 // forward declaration
 class Transport;
 
-class RtpRtcp : public Module
-{
-public:
-    /*
-    *   create a RTP/RTCP module object using the system clock
-    *
-    *   id      - unique identifier of this RTP/RTCP module object
-    *   audio   - true for a audio version of the RTP/RTCP module object false will create a video version
+class RtpRtcp : public Module {
+ public:
+  struct Configuration {
+    Configuration()
+        : id(-1),
+          audio(false),
+          clock(NULL),
+          default_module(NULL),
+          incoming_data(NULL),
+          incoming_messages(NULL),
+          outgoing_transport(NULL),
+          rtcp_feedback(NULL),
+          intra_frame_callback(NULL),
+          bandwidth_callback(NULL),
+          audio_messages(NULL),
+          bitrate_observer(NULL) {
+    }
+   /*  id                   - Unique identifier of this RTP/RTCP module object
+    *  audio                - True for a audio version of the RTP/RTCP module
+    *                         object false will create a video version
+    *  clock                - The clock to use to read time. If NULL object
+    *                         will be using the system clock.
+    *  incoming_data        - Callback object that will receive the incoming
+    *                         data
+    *  incoming_messages    - Callback object that will receive the incoming
+    *                         RTP messages.
+    *  outgoing_transport   - Transport object that will be called when packets
+    *                         are ready to be sent out on the network
+    *  rtcp_feedback        - Callback object that will receive the incoming
+    *                         RTP messages.
+    *  intra_frame_callback - Called when the receiver request a intra frame.
+    *  bandwidth_callback   - Called when we receive a changed estimate from
+    *                         the receiver of out stream.
+    *  audio_messages       - Telehone events.
+    *  bitrate_observer     - Called when the estimate of the incoming RTP
+    *                         stream changes.
     */
-    static RtpRtcp* CreateRtpRtcp(const WebRtc_Word32 id,
-                                  const bool audio);
+    int32_t id;
+    bool audio;
+    RtpRtcpClock* clock;
+    RtpRtcp* default_module;
+    RtpData* incoming_data;
+    RtpFeedback* incoming_messages;
+    Transport* outgoing_transport;
+    RtcpFeedback* rtcp_feedback;
+    RtcpIntraFrameObserver* intra_frame_callback;
+    RtcpBandwidthObserver* bandwidth_callback;
+    RtpAudioFeedback* audio_messages;
+    RtpRemoteBitrateObserver* bitrate_observer;
+  };
+  /*
+   *   Create a RTP/RTCP module object using the system clock.
+   *
+   *   configuration  - Configuration of the RTP/RTCP module.
+   */
+  static RtpRtcp* CreateRtpRtcp(const RtpRtcp::Configuration& configuration);
 
-    /*
-    *   create a RTP/RTCP module object
-    *
-    *   id      - unique identifier of this RTP/RTCP module object
-    *   audio   - true for a audio version of the RTP/RTCP module object
-    *             false will create a video version
-    *   clock   - the clock to use to read time; must not be NULL
-    */
-    static RtpRtcp* CreateRtpRtcp(const WebRtc_Word32 id,
-                                  const bool audio,
-                                  RtpRtcpClock* clock);
-
-    /*
-    *   destroy a RTP/RTCP module object
-    *
-    *   module  - object to destroy
-    */
-    static void DestroyRtpRtcp(RtpRtcp* module);
-
-    /*
-    *   Change the unique identifier of this object
-    *
-    *   id      - new unique identifier of this RTP/RTCP module object
-    */
-    virtual WebRtc_Word32 ChangeUniqueId(const WebRtc_Word32 id) = 0;
-
-    /*
-    *   De-muxing functionality for conferencing
-    *
-    *   register a module that will act as a default module for this module
-    *   used for feedback messages back to the encoder when one encoded stream
-    *   is sent to multiple destinations
-    *
-    *   module  - default module
-    */
-    virtual WebRtc_Word32 RegisterDefaultModule(RtpRtcp* module) = 0;
-
-    /*
-    *   unregister the default module
-    *   will stop the demuxing feedback
-    */
-    virtual WebRtc_Word32 DeRegisterDefaultModule() = 0;
-
-    /*
-    *   returns true if a default module is registered, false otherwise
-    */
-    virtual bool DefaultModuleRegistered() = 0;
-
-    /*
-    *   returns number of registered child modules
-    */
-    virtual WebRtc_UWord32 NumberChildModules() = 0;
-
-    /*
-    *   Lip-sync between voice-video
-    *
-    *   module  - audio module
-    *
-    *   Note: only allowed on a video module
-    */
-    virtual WebRtc_Word32 RegisterSyncModule(RtpRtcp* module) = 0;
-
-    /*
-    *   Turn off lip-sync between voice-video
-    */
-    virtual WebRtc_Word32 DeRegisterSyncModule() = 0;
-
-    /**************************************************************************
-    *
-    *   Receiver functions
-    *
-    ***************************************************************************/
-
-    /*
-    *   Initialize receive side
-    *
-    *   return -1 on failure else 0
-    */
-    virtual WebRtc_Word32 InitReceiver() = 0;
-
-    /*
-    *   Used by the module to deliver the incoming data to the codec module
-    *
-    *   incomingDataCallback    - callback object that will receive the incoming data
-    *
-    *   return -1 on failure else 0
-    */
-    virtual WebRtc_Word32 RegisterIncomingDataCallback(RtpData* incomingDataCallback) = 0;
-
-    /*
-    *   Used by the module to deliver messages to the codec module/appliation
-    *
-    *   incomingMessagesCallback    - callback object that will receive the incoming messages
-    *
-    *   return -1 on failure else 0
-    */
-    virtual WebRtc_Word32 RegisterIncomingRTPCallback(RtpFeedback* incomingMessagesCallback) = 0;
+  /**************************************************************************
+   *
+   *   Receiver functions
+   *
+   ***************************************************************************/
 
     /*
     *   configure a RTP packet timeout value
@@ -138,30 +91,35 @@
     *
     *   return -1 on failure else 0
     */
-    virtual WebRtc_Word32 SetPacketTimeout(const WebRtc_UWord32 RTPtimeoutMS,
-                                         const WebRtc_UWord32 RTCPtimeoutMS) = 0;
+    virtual WebRtc_Word32 SetPacketTimeout(
+        const WebRtc_UWord32 RTPtimeoutMS,
+        const WebRtc_UWord32 RTCPtimeoutMS) = 0;
 
     /*
     *   Set periodic dead or alive notification
     *
     *   enable              - turn periodic dead or alive notification on/off
-    *   sampleTimeSeconds   - sample interval in seconds for dead or alive notifications
+    *   sampleTimeSeconds   - sample interval in seconds for dead or alive
+    *                         notifications
     *
     *   return -1 on failure else 0
     */
-    virtual WebRtc_Word32 SetPeriodicDeadOrAliveStatus(const bool enable,
-                                                     const WebRtc_UWord8 sampleTimeSeconds) = 0;
+    virtual WebRtc_Word32 SetPeriodicDeadOrAliveStatus(
+        const bool enable,
+        const WebRtc_UWord8 sampleTimeSeconds) = 0;
 
     /*
     *   Get periodic dead or alive notification status
     *
     *   enable              - periodic dead or alive notification on/off
-    *   sampleTimeSeconds   - sample interval in seconds for dead or alive notifications
+    *   sampleTimeSeconds   - sample interval in seconds for dead or alive
+    *                         notifications
     *
     *   return -1 on failure else 0
     */
-    virtual WebRtc_Word32 PeriodicDeadOrAliveStatus(bool &enable,
-                                                  WebRtc_UWord8 &sampleTimeSeconds) = 0;
+    virtual WebRtc_Word32 PeriodicDeadOrAliveStatus(
+        bool& enable,
+        WebRtc_UWord8& sampleTimeSeconds) = 0;
 
     /*
     *   set voice codec name and payload type
@@ -231,7 +189,8 @@
     *
     *   return -1 on failure else 0
     */
-    virtual WebRtc_Word32 EstimatedRemoteTimeStamp(WebRtc_UWord32& timestamp) const = 0;
+    virtual WebRtc_Word32 EstimatedRemoteTimeStamp(
+        WebRtc_UWord32& timestamp) const = 0;
 
     /*
     *   Get incoming SSRC
@@ -245,7 +204,8 @@
     *
     *   return -1 on failure else the number of valid entries in the list
     */
-    virtual WebRtc_Word32 RemoteCSRCs( WebRtc_UWord32 arrOfCSRC[kRtpCsrcSize]) const  = 0;
+    virtual WebRtc_Word32 RemoteCSRCs(
+        WebRtc_UWord32 arrOfCSRC[kRtpCsrcSize]) const  = 0;
 
     /*
     *   get the currently configured SSRC filter
@@ -289,20 +249,6 @@
     virtual WebRtc_Word32 IncomingPacket(const WebRtc_UWord8* incomingPacket,
                                          const WebRtc_UWord16 packetLength) = 0;
 
-
-    /*
-    *    Option when not using the RegisterSyncModule function
-    *
-    *    Inform the module about the received audion NTP
-    *
-    *   return -1 on failure else 0
-    */
-    virtual WebRtc_Word32 IncomingAudioNTP(
-        const WebRtc_UWord32 audioReceivedNTPsecs,
-        const WebRtc_UWord32 audioReceivedNTPfrac,
-        const WebRtc_UWord32 audioRTCPArrivalTimeSecs,
-        const WebRtc_UWord32 audioRTCPArrivalTimeFrac) = 0;
-
     /**************************************************************************
     *
     *   Sender
@@ -310,22 +256,6 @@
     ***************************************************************************/
 
     /*
-    *   Initialize send side
-    *
-    *   return -1 on failure else 0
-    */
-    virtual WebRtc_Word32 InitSender() = 0;
-
-    /*
-    *   Used by the module to send RTP and RTCP packet to the network module
-    *
-    *   outgoingTransport   - transport object that will be called when packets are ready to be sent out on the network
-    *
-    *   return -1 on failure else 0
-    */
-    virtual WebRtc_Word32 RegisterSendTransport(Transport* outgoingTransport) = 0;
-
-    /*
     *   set MTU
     *
     *   size    -  Max transfer unit in bytes, default is 1500
@@ -340,18 +270,21 @@
     *
     *   TCP                     - true for TCP false UDP
     *   IPv6                    - true for IP version 6 false for version 4
-    *   authenticationOverhead  - number of bytes to leave for an authentication header
+    *   authenticationOverhead  - number of bytes to leave for an
+    *                             authentication header
     *
     *   return -1 on failure else 0
     */
-    virtual WebRtc_Word32 SetTransportOverhead(const bool TCP,
-                                             const bool IPV6,
-                                             const WebRtc_UWord8 authenticationOverhead = 0) = 0;
+    virtual WebRtc_Word32 SetTransportOverhead(
+        const bool TCP,
+        const bool IPV6,
+        const WebRtc_UWord8 authenticationOverhead = 0) = 0;
 
     /*
     *   Get max payload length
     *
-    *   A combination of the configuration MaxTransferUnit and TransportOverhead.
+    *   A combination of the configuration MaxTransferUnit and
+    *   TransportOverhead.
     *   Does not account FEC/ULP/RED overhead if FEC is enabled.
     *   Does not account for RTP headers
     */
@@ -360,7 +293,8 @@
     /*
     *   Get max data payload length
     *
-    *   A combination of the configuration MaxTransferUnit, headers and TransportOverhead.
+    *   A combination of the configuration MaxTransferUnit, headers and
+    *   TransportOverhead.
     *   Takes into account FEC/ULP/RED overhead if FEC is enabled.
     *   Takes into account RTP headers
     */
@@ -490,7 +424,6 @@
                                            const bool setSSRC,
                                            const WebRtc_UWord32 SSRC) = 0;
 
-
     /*
     * Get status of sending RTX (RFC 4588) on a specific SSRC.
     */
@@ -540,14 +473,16 @@
         WebRtc_UWord32* available_bandwidth) const = 0;
 
     /*
-    *   Used by the codec module to deliver a video or audio frame for packetization
+    *   Used by the codec module to deliver a video or audio frame for
+    *   packetization.
     *
     *   frameType       - type of frame to send
     *   payloadType     - payload type of frame to send
     *   timestamp       - timestamp of frame to send
     *   payloadData     - payload buffer of frame to send
     *   payloadSize     - size of payload buffer to send
-    *   fragmentation   - fragmentation offset data for fragmented frames such as layers or RED
+    *   fragmentation   - fragmentation offset data for fragmented frames such
+    *                     as layers or RED
     *
     *   return -1 on failure else 0
     */
@@ -567,16 +502,6 @@
     ***************************************************************************/
 
     /*
-    *   Register a callback objects that will receive callbacks for video
-    *   related events such as an incoming key frame request and events that
-    *   could indicate bandwidth overuse.
-    */
-    virtual void RegisterRtcpObservers(
-        RtcpIntraFrameObserver* intraFrameCallback,
-        RtcpBandwidthObserver* bandwidthCallback,
-        RtcpFeedback* callback) = 0;
-
-    /*
     *    Get RTCP status
     */
     virtual RTCPMethod RTCP() const = 0;
@@ -664,18 +589,21 @@
     *
     *   return -1 on failure else 0
     */
-    virtual WebRtc_Word32 SendRTCP(WebRtc_UWord32 rtcpPacketType = kRtcpReport) = 0;
+    virtual WebRtc_Word32 SendRTCP(
+        WebRtc_UWord32 rtcpPacketType = kRtcpReport) = 0;
 
     /*
     *    Good state of RTP receiver inform sender
     */
-    virtual WebRtc_Word32 SendRTCPReferencePictureSelection(const WebRtc_UWord64 pictureID) = 0;
+    virtual WebRtc_Word32 SendRTCPReferencePictureSelection(
+        const WebRtc_UWord64 pictureID) = 0;
 
     /*
     *    Send a RTCP Slice Loss Indication (SLI)
     *    6 least significant bits of pictureID
     */
-    virtual WebRtc_Word32 SendRTCPSliceLossIndication(const WebRtc_UWord8 pictureID) = 0;
+    virtual WebRtc_Word32 SendRTCPSliceLossIndication(
+        const WebRtc_UWord8 pictureID) = 0;
 
     /*
     *   Reset RTP statistics
@@ -689,11 +617,12 @@
     *
     *   return -1 on failure else 0
     */
-    virtual WebRtc_Word32 StatisticsRTP(WebRtc_UWord8  *fraction_lost,  // scale 0 to 255
-                                      WebRtc_UWord32 *cum_lost,       // number of lost packets
-                                      WebRtc_UWord32 *ext_max,        // highest sequence number received
-                                      WebRtc_UWord32 *jitter,
-                                      WebRtc_UWord32 *max_jitter = NULL) const = 0;
+    virtual WebRtc_Word32 StatisticsRTP(
+        WebRtc_UWord8* fraction_lost,  // scale 0 to 255
+        WebRtc_UWord32* cum_lost,      // number of lost packets
+        WebRtc_UWord32* ext_max,       // highest sequence number received
+        WebRtc_UWord32* jitter,
+        WebRtc_UWord32* max_jitter = NULL) const = 0;
 
     /*
     *   Reset RTP data counters for the receiving side
@@ -714,10 +643,11 @@
     *
     *   return -1 on failure else 0
     */
-    virtual WebRtc_Word32 DataCountersRTP(WebRtc_UWord32 *bytesSent,
-                                        WebRtc_UWord32 *packetsSent,
-                                        WebRtc_UWord32 *bytesReceived,
-                                        WebRtc_UWord32 *packetsReceived) const = 0;
+    virtual WebRtc_Word32 DataCountersRTP(
+        WebRtc_UWord32* bytesSent,
+        WebRtc_UWord32* packetsSent,
+        WebRtc_UWord32* bytesReceived,
+        WebRtc_UWord32* packetsReceived) const = 0;
     /*
     *   Get received RTCP sender info
     *
@@ -753,16 +683,18 @@
     *
     *   return -1 on failure else 0
     */
-    virtual WebRtc_Word32 SetRTCPApplicationSpecificData(const WebRtc_UWord8 subType,
-                                                       const WebRtc_UWord32 name,
-                                                       const WebRtc_UWord8* data,
-                                                       const WebRtc_UWord16 length) = 0;
+    virtual WebRtc_Word32 SetRTCPApplicationSpecificData(
+        const WebRtc_UWord8 subType,
+        const WebRtc_UWord32 name,
+        const WebRtc_UWord8* data,
+        const WebRtc_UWord16 length) = 0;
     /*
     *   (XR) VOIP metric
     *
     *   return -1 on failure else 0
     */
-    virtual WebRtc_Word32 SetRTCPVoIPMetrics(const RTCPVoIPMetric* VoIPMetric) = 0;
+    virtual WebRtc_Word32 SetRTCPVoIPMetrics(
+        const RTCPVoIPMetric* VoIPMetric) = 0;
 
     /*
     *  (REMB) Receiver Estimated Max Bitrate
@@ -775,11 +707,6 @@
                                       const WebRtc_UWord8 numberOfSSRC,
                                       const WebRtc_UWord32* SSRC) = 0;
 
-    // Registers an observer to call when the estimate of the incoming channel
-    // changes.
-    virtual bool SetRemoteBitrateObserver(
-        RtpRemoteBitrateObserver* observer) = 0;
-
     /*
     *   (IJ) Extended jitter report.
     */
@@ -839,11 +766,14 @@
                                    const WebRtc_UWord16 size) = 0;
 
     /*
-    *   Store the sent packets, needed to answer to a Negative acknowledgement requests
+    *   Store the sent packets, needed to answer to a Negative acknowledgement
+    *   requests
     *
     *   return -1 on failure else 0
     */
-    virtual WebRtc_Word32 SetStorePacketsStatus(const bool enable, const WebRtc_UWord16 numberToStore = 200) = 0;
+    virtual WebRtc_Word32 SetStorePacketsStatus(
+        const bool enable,
+        const WebRtc_UWord16 numberToStore = 200) = 0;
 
     /**************************************************************************
     *
@@ -852,27 +782,23 @@
     ***************************************************************************/
 
     /*
-    *   RegisterAudioCallback
+    *   set audio packet size, used to determine when it's time to send a DTMF
+    *   packet in silence (CNG)
     *
     *   return -1 on failure else 0
     */
-    virtual WebRtc_Word32 RegisterAudioCallback(RtpAudioFeedback* messagesCallback) = 0;
-
-    /*
-    *   set audio packet size, used to determine when it's time to send a DTMF packet in silence (CNG)
-    *
-    *   return -1 on failure else 0
-    */
-    virtual WebRtc_Word32 SetAudioPacketSize(const WebRtc_UWord16 packetSizeSamples) = 0;
+    virtual WebRtc_Word32 SetAudioPacketSize(
+        const WebRtc_UWord16 packetSizeSamples) = 0;
 
     /*
     *   Outband TelephoneEvent(DTMF) detection
     *
     *   return -1 on failure else 0
     */
-    virtual WebRtc_Word32 SetTelephoneEventStatus(const bool enable,
-                                                const bool forwardToDecoder,
-                                                const bool detectEndOfTone = false) = 0;
+    virtual WebRtc_Word32 SetTelephoneEventStatus(
+        const bool enable,
+        const bool forwardToDecoder,
+        const bool detectEndOfTone = false) = 0;
 
     /*
     *   Is outband TelephoneEvent(DTMF) turned on/off?
@@ -888,55 +814,61 @@
     /*
     *   SendTelephoneEventActive
     *
-    *   return true if we currently send a telephone event and 100 ms after an event is sent
-    *   used to prevent teh telephone event tone to be recorded by the microphone and send inband
-    *   just after the tone has ended
+    *   return true if we currently send a telephone event and 100 ms after an
+    *   event is sent used to prevent the telephone event tone to be recorded
+    *   by the microphone and send inband just after the tone has ended.
     */
-    virtual bool SendTelephoneEventActive(WebRtc_Word8& telephoneEvent) const = 0;
+    virtual bool SendTelephoneEventActive(
+        WebRtc_Word8& telephoneEvent) const = 0;
 
     /*
     *   Send a TelephoneEvent tone using RFC 2833 (4733)
     *
     *   return -1 on failure else 0
     */
-      virtual WebRtc_Word32 SendTelephoneEventOutband(const WebRtc_UWord8 key,
-                                                  const WebRtc_UWord16 time_ms,
-                                                  const WebRtc_UWord8 level) = 0;
+    virtual WebRtc_Word32 SendTelephoneEventOutband(
+        const WebRtc_UWord8 key,
+        const WebRtc_UWord16 time_ms,
+        const WebRtc_UWord8 level) = 0;
 
     /*
     *   Set payload type for Redundant Audio Data RFC 2198
     *
     *   return -1 on failure else 0
     */
-    virtual WebRtc_Word32 SetSendREDPayloadType(const WebRtc_Word8 payloadType) = 0;
+    virtual WebRtc_Word32 SetSendREDPayloadType(
+        const WebRtc_Word8 payloadType) = 0;
 
     /*
     *   Get payload type for Redundant Audio Data RFC 2198
     *
     *   return -1 on failure else 0
     */
-     virtual WebRtc_Word32 SendREDPayloadType(WebRtc_Word8& payloadType) const = 0;
+     virtual WebRtc_Word32 SendREDPayloadType(
+         WebRtc_Word8& payloadType) const = 0;
 
      /*
      * Set status and ID for header-extension-for-audio-level-indication.
-     * See https://datatracker.ietf.org/doc/draft-lennox-avt-rtp-audio-level-exthdr/
-     * for more details.
+     * See http://tools.ietf.org/html/rfc6464 for more details.
      *
      * return -1 on failure else 0
      */
-     virtual WebRtc_Word32 SetRTPAudioLevelIndicationStatus(const bool enable,
-                                                          const WebRtc_UWord8 ID) = 0;
+     virtual WebRtc_Word32 SetRTPAudioLevelIndicationStatus(
+         const bool enable,
+         const WebRtc_UWord8 ID) = 0;
 
      /*
      * Get status and ID for header-extension-for-audio-level-indication.
      *
      * return -1 on failure else 0
      */
-     virtual WebRtc_Word32 GetRTPAudioLevelIndicationStatus(bool& enable,
-                                                          WebRtc_UWord8& ID) const = 0;
+     virtual WebRtc_Word32 GetRTPAudioLevelIndicationStatus(
+         bool& enable,
+         WebRtc_UWord8& ID) const = 0;
 
      /*
-     * Store the audio level in dBov for header-extension-for-audio-level-indication.
+     * Store the audio level in dBov for header-extension-for-audio-level-
+     * indication.
      * This API shall be called before transmision of an RTP packet to ensure
      * that the |level| part of the extended RTP header is updated.
      *
@@ -967,9 +899,10 @@
     *
     *   return -1 on failure else 0
     */
-    virtual WebRtc_Word32 SetGenericFECStatus(const bool enable,
-                                            const WebRtc_UWord8 payloadTypeRED,
-                                            const WebRtc_UWord8 payloadTypeFEC) = 0;
+    virtual WebRtc_Word32 SetGenericFECStatus(
+        const bool enable,
+        const WebRtc_UWord8 payloadTypeRED,
+        const WebRtc_UWord8 payloadTypeFEC) = 0;
 
     /*
     *   Get generic FEC setting
@@ -977,8 +910,8 @@
     *   return -1 on failure else 0
     */
     virtual WebRtc_Word32 GenericFECStatus(bool& enable,
-                                         WebRtc_UWord8& payloadTypeRED,
-                                         WebRtc_UWord8& payloadTypeFEC) = 0;
+                                           WebRtc_UWord8& payloadTypeRED,
+                                           WebRtc_UWord8& payloadTypeFEC) = 0;
 
 
     virtual WebRtc_Word32 SetFecParameters(
@@ -990,7 +923,8 @@
     *
     *   return -1 on failure else 0
     */
-    virtual WebRtc_Word32 SetKeyFrameRequestMethod(const KeyFrameRequestMethod method) = 0;
+    virtual WebRtc_Word32 SetKeyFrameRequestMethod(
+        const KeyFrameRequestMethod method) = 0;
 
     /*
     *   send a request for a keyframe
diff --git a/src/modules/rtp_rtcp/interface/rtp_rtcp_defines.h b/src/modules/rtp_rtcp/interface/rtp_rtcp_defines.h
index 3b6b4a8..110b08c 100644
--- a/src/modules/rtp_rtcp/interface/rtp_rtcp_defines.h
+++ b/src/modules/rtp_rtcp/interface/rtp_rtcp_defines.h
@@ -139,10 +139,6 @@
 class RtcpFeedback
 {
 public:
-    // if audioVideoOffset > 0 video is behind audio
-    virtual void OnLipSyncUpdate(const WebRtc_Word32 /*id*/,
-                                 const WebRtc_Word32 /*audioVideoOffset*/)  {};
-
     virtual void OnApplicationDataReceived(const WebRtc_Word32 /*id*/,
                                            const WebRtc_UWord8 /*subType*/,
                                            const WebRtc_UWord32 /*name*/,
diff --git a/src/modules/rtp_rtcp/source/Bitrate.h b/src/modules/rtp_rtcp/source/Bitrate.h
index ab5637b..3859aaa 100644
--- a/src/modules/rtp_rtcp/source/Bitrate.h
+++ b/src/modules/rtp_rtcp/source/Bitrate.h
@@ -1,5 +1,5 @@
 /*
- *  Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
+ *  Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
  *
  *  Use of this source code is governed by a BSD-style license
  *  that can be found in the LICENSE file in the root of the source
@@ -25,9 +25,6 @@
 public:
     Bitrate(RtpRtcpClock* clock);
 
-    // initialize members
-    void Init();
-
     // calculate rates
     void Process();
 
diff --git a/src/modules/rtp_rtcp/source/bitrate.cc b/src/modules/rtp_rtcp/source/bitrate.cc
index be0c7dd..0fbb7ad 100644
--- a/src/modules/rtp_rtcp/source/bitrate.cc
+++ b/src/modules/rtp_rtcp/source/bitrate.cc
@@ -1,5 +1,5 @@
 /*
- *  Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
+ *  Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
  *
  *  Use of this source code is governed by a BSD-style license
  *  that can be found in the LICENSE file in the root of the source
@@ -29,21 +29,6 @@
 }
 
 void
-Bitrate::Init()
-{
-    _packetRate = 0;
-    _bitrate = 0;
-    _timeLastRateUpdate = 0;
-    _bytesCount = 0;
-    _packetCount = 0;
-    _bitrateNextIdx = 0;
-
-    memset(_packetRateArray, 0, sizeof(_packetRateArray));
-    memset(_bitrateDiffMS, 0, sizeof(_bitrateDiffMS));
-    memset(_bitrateArray, 0, sizeof(_bitrateArray));
-}
-
-void
 Bitrate::Update(const WebRtc_Word32 bytes)
 {
     _bytesCount += bytes;
diff --git a/src/modules/rtp_rtcp/source/rtcp_format_remb_unittest.cc b/src/modules/rtp_rtcp/source/rtcp_format_remb_unittest.cc
index 9fdd6ca..d937f35 100644
--- a/src/modules/rtp_rtcp/source/rtcp_format_remb_unittest.cc
+++ b/src/modules/rtp_rtcp/source/rtcp_format_remb_unittest.cc
@@ -70,7 +70,11 @@
 
 void RtcpFormatRembTest::SetUp() {
   system_clock_ = ModuleRTPUtility::GetSystemClock();
-  dummy_rtp_rtcp_impl_ = new ModuleRtpRtcpImpl(0, false, system_clock_);
+  RtpRtcp::Configuration configuration;
+  configuration.id = 0;
+  configuration.audio = false;
+  configuration.clock = system_clock_;
+  dummy_rtp_rtcp_impl_ = new ModuleRtpRtcpImpl(configuration);
   rtcp_sender_ = new RTCPSender(0, false, system_clock_, dummy_rtp_rtcp_impl_);
   rtcp_receiver_ = new RTCPReceiver(0, system_clock_, dummy_rtp_rtcp_impl_);
   test_transport_ = new TestTransport(rtcp_receiver_);
diff --git a/src/modules/rtp_rtcp/source/rtcp_receiver.cc b/src/modules/rtp_rtcp/source/rtcp_receiver.cc
index 2fc7c83..d9365e9 100644
--- a/src/modules/rtp_rtcp/source/rtcp_receiver.cc
+++ b/src/modules/rtp_rtcp/source/rtcp_receiver.cc
@@ -165,9 +165,6 @@
       GetReportBlockInformation(remoteSSRC);
 
   if (reportBlock == NULL) {
-    WEBRTC_TRACE(kTraceError, kTraceRtpRtcp, _id,
-                 "\tfailed to GetReportBlockInformation(%u)",
-                 remoteSSRC);
     return -1;
   }
   if (RTT) {
@@ -202,16 +199,6 @@
   return 0;
 }
 
-void
-RTCPReceiver::UpdateLipSync(const WebRtc_Word32 audioVideoOffset) const
-{
-    CriticalSectionScoped lock(_criticalSectionFeedbacks);
-    if(_cbRtcpFeedback)
-    {
-        _cbRtcpFeedback->OnLipSyncUpdate(_id,audioVideoOffset);
-    }
-};
-
 WebRtc_Word32
 RTCPReceiver::NTP(WebRtc_UWord32 *ReceivedNTPsecs,
                   WebRtc_UWord32 *ReceivedNTPfrac,
@@ -1247,9 +1234,6 @@
     // Might trigger a OnReceivedBandwidthEstimateUpdate.
     UpdateTMMBR();
   }
-  if (rtcpPacketInformation.rtcpPacketTypeFlags & kRtcpSr) {
-    _rtpRtcp.OnReceivedNTP();
-  }
   if (rtcpPacketInformation.rtcpPacketTypeFlags & kRtcpSrReq) {
     _rtpRtcp.OnRequestSendReport();
   }
diff --git a/src/modules/rtp_rtcp/source/rtcp_receiver.h b/src/modules/rtp_rtcp/source/rtcp_receiver.h
index 294e67d..df2d18b4 100644
--- a/src/modules/rtp_rtcp/source/rtcp_receiver.h
+++ b/src/modules/rtp_rtcp/source/rtcp_receiver.h
@@ -76,8 +76,6 @@
 
     WebRtc_Word32 ResetRTT(const WebRtc_UWord32 remoteSSRC);
 
-    void UpdateLipSync(const WebRtc_Word32 audioVideoOffset) const;
-
     WebRtc_Word32 SenderInfoReceived(RTCPSenderInfo* senderInfo) const;
 
     // get statistics
diff --git a/src/modules/rtp_rtcp/source/rtcp_receiver_unittest.cc b/src/modules/rtp_rtcp/source/rtcp_receiver_unittest.cc
index 5bfdb73..9598a43 100644
--- a/src/modules/rtp_rtcp/source/rtcp_receiver_unittest.cc
+++ b/src/modules/rtp_rtcp/source/rtcp_receiver_unittest.cc
@@ -151,10 +151,12 @@
 class TestTransport : public Transport,
                       public RtpData {
  public:
-  explicit TestTransport(RTCPReceiver* rtcp_receiver) :
-    rtcp_receiver_(rtcp_receiver) {
+  explicit TestTransport()
+      : rtcp_receiver_(NULL) {
   }
-
+  void SetRTCPReceiver(RTCPReceiver* rtcp_receiver) {
+    rtcp_receiver_ = rtcp_receiver;
+  }
   virtual int SendPacket(int /*ch*/, const void* /*data*/, int /*len*/) {
     ADD_FAILURE();  // FAIL() gives a compile error.
     return -1;
@@ -180,10 +182,15 @@
   RtcpReceiverTest() {
     // system_clock_ = ModuleRTPUtility::GetSystemClock();
     system_clock_ = new FakeSystemClock();
-    rtp_rtcp_impl_ = new ModuleRtpRtcpImpl(0, false, system_clock_);
+    test_transport_ = new TestTransport();
+    RtpRtcp::Configuration configuration;
+    configuration.id = 0;
+    configuration.audio = false;
+    configuration.clock = system_clock_;
+    configuration.outgoing_transport = test_transport_;
+    rtp_rtcp_impl_ = new ModuleRtpRtcpImpl(configuration);
     rtcp_receiver_ = new RTCPReceiver(0, system_clock_, rtp_rtcp_impl_);
-    test_transport_ = new TestTransport(rtcp_receiver_);
-    EXPECT_EQ(0, rtp_rtcp_impl_->RegisterIncomingDataCallback(test_transport_));
+    test_transport_->SetRTCPReceiver(rtcp_receiver_);
   }
   ~RtcpReceiverTest() {
     delete rtcp_receiver_;
diff --git a/src/modules/rtp_rtcp/source/rtcp_sender_unittest.cc b/src/modules/rtp_rtcp/source/rtcp_sender_unittest.cc
index 2d86682..17fbafc 100644
--- a/src/modules/rtp_rtcp/source/rtcp_sender_unittest.cc
+++ b/src/modules/rtp_rtcp/source/rtcp_sender_unittest.cc
@@ -59,10 +59,12 @@
 class TestTransport : public Transport,
                       public RtpData {
  public:
-  TestTransport(RTCPReceiver* rtcp_receiver) :
-    rtcp_receiver_(rtcp_receiver) {
+  TestTransport()
+      : rtcp_receiver_(NULL) {
   }
-
+  void SetRTCPReceiver(RTCPReceiver* rtcp_receiver) {
+    rtcp_receiver_ = rtcp_receiver;
+  }
   virtual int SendPacket(int /*ch*/, const void* /*data*/, int /*len*/) {
     return -1;
   }
@@ -83,8 +85,9 @@
 
   virtual int OnReceivedPayloadData(const WebRtc_UWord8* payloadData,
                                     const WebRtc_UWord16 payloadSize,
-                                    const WebRtcRTPHeader* rtpHeader)
-                                    {return 0;}
+                                    const WebRtcRTPHeader* rtpHeader) {
+    return 0;
+  }
   RTCPReceiver* rtcp_receiver_;
   RTCPHelp::RTCPPacketInformation rtcp_packet_info_;
 };
@@ -93,14 +96,22 @@
  protected:
   RtcpSenderTest() {
     system_clock_ = ModuleRTPUtility::GetSystemClock();
-    rtp_rtcp_impl_ = new ModuleRtpRtcpImpl(0, false, system_clock_);
+    test_transport_ = new TestTransport();
+
+    RtpRtcp::Configuration configuration;
+    configuration.id = 0;
+    configuration.audio = false;
+    configuration.clock = system_clock_;
+    configuration.incoming_data = test_transport_;
+    configuration.outgoing_transport = test_transport_;
+
+    rtp_rtcp_impl_ = new ModuleRtpRtcpImpl(configuration);
     rtcp_sender_ = new RTCPSender(0, false, system_clock_, rtp_rtcp_impl_);
     rtcp_receiver_ = new RTCPReceiver(0, system_clock_, rtp_rtcp_impl_);
-    test_transport_ = new TestTransport(rtcp_receiver_);
+    test_transport_->SetRTCPReceiver(rtcp_receiver_);
     // Initialize
     EXPECT_EQ(0, rtcp_sender_->Init());
     EXPECT_EQ(0, rtcp_sender_->RegisterSendTransport(test_transport_));
-    EXPECT_EQ(0, rtp_rtcp_impl_->RegisterIncomingDataCallback(test_transport_));
   }
   ~RtcpSenderTest() {
     delete rtcp_sender_;
diff --git a/src/modules/rtp_rtcp/source/rtp_receiver.cc b/src/modules/rtp_rtcp/source/rtp_receiver.cc
index ef5e721..40eb6b0 100644
--- a/src/modules/rtp_rtcp/source/rtp_receiver.cc
+++ b/src/modules/rtp_rtcp/source/rtp_receiver.cc
@@ -123,75 +123,6 @@
   WEBRTC_TRACE(kTraceMemory, kTraceRtpRtcp, _id, "%s deleted", __FUNCTION__);
 }
 
-void RTPReceiver::Init() {
-  CriticalSectionScoped lock(_criticalSectionRTPReceiver);
-
-  _lastReceiveTime = 0;
-  _lastReceivedPayloadLength = 0;
-  _packetTimeOutMS = 0;
-  _lastReceivedPayloadType = -1;
-  _lastReceivedMediaPayloadType = -1;
-  _redPayloadType = -1;
-
-  memset(&_lastReceivedAudioSpecific, 0, sizeof(_lastReceivedAudioSpecific));
-  _lastReceivedAudioSpecific.channels = 1;
-
-  _lastReceivedVideoSpecific.videoCodecType = kRtpNoVideo;
-  _lastReceivedVideoSpecific.maxRate = 0;
-  _SSRC = 0;
-  _numCSRCs = 0;
-  _numEnergy = 0;
-  _jitterQ4 = 0;
-  _jitterMaxQ4 = 0;
-  _cumulativeLoss = 0;
-  _jitterQ4TransmissionTimeOffset = 0;
-  _useSSRCFilter = false;
-  _SSRCFilter = 0;
-
-  _localTimeLastReceivedTimestamp = 0;
-  _lastReceivedTimestamp = 0;
-  _lastReceivedSequenceNumber = 0;
-  _lastReceivedTransmissionTimeOffset = 0;
-
-  _receivedSeqFirst = 0;
-  _receivedSeqMax = 0;
-  _receivedSeqWraps = 0;
-
-  _receivedPacketOH = 12; // RTP header
-  _receivedByteCount = 0;
-  _receivedOldPacketCount = 0;
-  _receivedInorderPacketCount = 0;
-
-  _lastReportInorderPackets = 0;
-  _lastReportOldPackets = 0;
-  _lastReportSeqMax = 0;
-  _lastReportFractionLost = 0;
-  _lastReportCumulativeLost = 0;
-  _lastReportExtendedHighSeqNum = 0;
-  _lastReportJitter = 0;
-  _lastReportJitterTransmissionTimeOffset = 0;
-
-  _rtpHeaderExtensionMap.Erase();
-
-  while (!_payloadTypeMap.empty()) {
-    std::map<WebRtc_Word8, Payload*>::iterator it = _payloadTypeMap.begin();
-    delete it->second;
-    _payloadTypeMap.erase(it);
-  }
-
-  Bitrate::Init();
-  RTPReceiverAudio::Init();
-  RTPReceiverVideo::Init();
-}
-
-void
-RTPReceiver::ChangeUniqueId(const WebRtc_Word32 id)
-{
-    _id = id;
-    RTPReceiverAudio::ChangeUniqueId(id);
-    RTPReceiverVideo::ChangeUniqueId(id);
-}
-
 RtpVideoCodecTypes
 RTPReceiver::VideoCodecType() const
 {
diff --git a/src/modules/rtp_rtcp/source/rtp_receiver.h b/src/modules/rtp_rtcp/source/rtp_receiver.h
index f283676..d6ecfaa 100644
--- a/src/modules/rtp_rtcp/source/rtp_receiver.h
+++ b/src/modules/rtp_rtcp/source/rtp_receiver.h
@@ -39,10 +39,6 @@
 
     virtual ~RTPReceiver();
 
-    virtual void ChangeUniqueId(const WebRtc_Word32 id);
-
-    void Init();
-
     RtpVideoCodecTypes VideoCodecType() const;
     WebRtc_UWord32 MaxConfiguredBitrate() const;
 
diff --git a/src/modules/rtp_rtcp/source/rtp_receiver_audio.cc b/src/modules/rtp_rtcp/source/rtp_receiver_audio.cc
index 1b870e2..a57da75 100644
--- a/src/modules/rtp_rtcp/source/rtp_receiver_audio.cc
+++ b/src/modules/rtp_rtcp/source/rtp_receiver_audio.cc
@@ -40,30 +40,6 @@
     delete _criticalSectionFeedback;
 }
 
-WebRtc_Word32 RTPReceiverAudio::Init() {
-  _lastReceivedFrequency = 8000;
-  _telephoneEvent = false;
-  _telephoneEventForwardToDecoder = false;
-  _telephoneEventDetectEndOfTone = false;
-  _telephoneEventPayloadType = -1;
-
-  _telephoneEventReported.clear();
-
-  _cngNBPayloadType = -1;
-  _cngWBPayloadType = -1;
-  _cngSWBPayloadType = -1;
-  _cngPayloadType = -1;
-  _G722PayloadType = -1;
-  _lastReceivedG722 = false;
-  return 0;
-}
-
-void
-RTPReceiverAudio::ChangeUniqueId(const WebRtc_Word32 id)
-{
-    _id = id;
-}
-
 WebRtc_Word32
 RTPReceiverAudio::RegisterIncomingAudioCallback(RtpAudioFeedback* incomingMessagesCallback)
 {
diff --git a/src/modules/rtp_rtcp/source/rtp_receiver_audio.h b/src/modules/rtp_rtcp/source/rtp_receiver_audio.h
index 89cd062..0b0ba30 100644
--- a/src/modules/rtp_rtcp/source/rtp_receiver_audio.h
+++ b/src/modules/rtp_rtcp/source/rtp_receiver_audio.h
@@ -27,10 +27,6 @@
     RTPReceiverAudio(const WebRtc_Word32 id);
     virtual ~RTPReceiverAudio();
 
-    virtual void ChangeUniqueId(const WebRtc_Word32 id);
-
-    WebRtc_Word32 Init();
-
     WebRtc_Word32 RegisterIncomingAudioCallback(RtpAudioFeedback* incomingMessagesCallback);
 
     ModuleRTPUtility::Payload* RegisterReceiveAudioPayload(
diff --git a/src/modules/rtp_rtcp/source/rtp_receiver_video.cc b/src/modules/rtp_rtcp/source/rtp_receiver_video.cc
index c5f99bd..94d49e0 100644
--- a/src/modules/rtp_rtcp/source/rtp_receiver_video.cc
+++ b/src/modules/rtp_rtcp/source/rtp_receiver_video.cc
@@ -58,16 +58,6 @@
     delete _receiveFEC;
 }
 
-void RTPReceiverVideo::Init() {
-  _currentFecFrameDecoded = false;
-  _packetOverHead = 28;
-  ResetOverUseDetector();
-}
-
-void RTPReceiverVideo::ChangeUniqueId(const WebRtc_Word32 id) {
-  _id = id;
-}
-
 ModuleRTPUtility::Payload* RTPReceiverVideo::RegisterReceiveVideoPayload(
     const char payloadName[RTP_PAYLOAD_NAME_SIZE],
     const WebRtc_Word8 payloadType,
diff --git a/src/modules/rtp_rtcp/source/rtp_receiver_video.h b/src/modules/rtp_rtcp/source/rtp_receiver_video.h
index f2e223e..ce32293 100644
--- a/src/modules/rtp_rtcp/source/rtp_receiver_video.h
+++ b/src/modules/rtp_rtcp/source/rtp_receiver_video.h
@@ -32,10 +32,6 @@
 
   virtual ~RTPReceiverVideo();
 
-  virtual void ChangeUniqueId(const WebRtc_Word32 id);
-
-  void Init();
-
   ModuleRTPUtility::Payload* RegisterReceiveVideoPayload(
       const char payloadName[RTP_PAYLOAD_NAME_SIZE],
       const WebRtc_Word8 payloadType,
diff --git a/src/modules/rtp_rtcp/source/rtp_rtcp_impl.cc b/src/modules/rtp_rtcp/source/rtp_rtcp_impl.cc
index 8906e20..e2ab811 100644
--- a/src/modules/rtp_rtcp/source/rtp_rtcp_impl.cc
+++ b/src/modules/rtp_rtcp/source/rtp_rtcp_impl.cc
@@ -36,222 +36,103 @@
 
 const WebRtc_UWord16 kDefaultRtt = 200;
 
-RtpRtcp* RtpRtcp::CreateRtpRtcp(const WebRtc_Word32 id,
-                                bool audio) {
-  if(audio) {
-    WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id, "CreateRtpRtcp(audio)");
+RtpRtcp* RtpRtcp::CreateRtpRtcp(const RtpRtcp::Configuration& configuration) {
+  if (configuration.clock) {
+    return new ModuleRtpRtcpImpl(configuration);
   } else {
-    WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id, "CreateRtpRtcp(video)");
-  }
-  // ModuleRTPUtility::GetSystemClock() creates a new instance of a system
-  // clock implementation. The OwnsClock() function informs the module that
-  // it is responsible for deleting the instance.
-  ModuleRtpRtcpImpl* rtp_rtcp_instance = new ModuleRtpRtcpImpl(id,
-      audio, ModuleRTPUtility::GetSystemClock());
-  rtp_rtcp_instance->OwnsClock();
-  return rtp_rtcp_instance;
-}
-
-RtpRtcp* RtpRtcp::CreateRtpRtcp(const WebRtc_Word32 id,
-                                const bool audio,
-                                RtpRtcpClock* clock) {
-  if (audio) {
-    WEBRTC_TRACE(kTraceModuleCall,
-                 kTraceRtpRtcp,
-                 id,
-                 "CreateRtpRtcp(audio)");
-  } else {
-    WEBRTC_TRACE(kTraceModuleCall,
-                 kTraceRtpRtcp,
-                 id,
-                 "CreateRtpRtcp(video)");
-  }
-  return new ModuleRtpRtcpImpl(id, audio, clock);
-}
-
-void RtpRtcp::DestroyRtpRtcp(RtpRtcp* module) {
-  if (module) {
-    WEBRTC_TRACE(kTraceModuleCall,
-                 kTraceRtpRtcp,
-                 static_cast<ModuleRtpRtcpImpl*>(module)->Id(),
-                 "DestroyRtpRtcp()");
-    delete static_cast<ModuleRtpRtcpImpl*>(module);
+    RtpRtcp::Configuration configuration_copy;
+    memcpy(&configuration_copy, &configuration,
+           sizeof(RtpRtcp::Configuration));
+    configuration_copy.clock = ModuleRTPUtility::GetSystemClock();
+    ModuleRtpRtcpImpl* rtp_rtcp_instance =
+        new ModuleRtpRtcpImpl(configuration_copy);
+    rtp_rtcp_instance->OwnsClock();
+    return rtp_rtcp_instance;
   }
 }
 
-ModuleRtpRtcpImpl::ModuleRtpRtcpImpl(const WebRtc_Word32 id,
-                                     const bool audio,
-                                     RtpRtcpClock* clock):
-  _rtpSender(id, audio, clock),
-  _rtpReceiver(id, audio, clock, this),
-  _rtcpSender(id, audio, clock, this),
-  _rtcpReceiver(id, clock, this),
-  _owns_clock(false),
-  _clock(*clock),
-  _id(id),
-  _audio(audio),
-  _collisionDetected(false),
-  _lastProcessTime(clock->GetTimeInMS()),
-  _lastBitrateProcessTime(clock->GetTimeInMS()),
-  _lastPacketTimeoutProcessTime(clock->GetTimeInMS()),
-  _packetOverHead(28), // IPV4 UDP
-  _criticalSectionModulePtrs(CriticalSectionWrapper::CreateCriticalSection()),
-  _criticalSectionModulePtrsFeedback(
-    CriticalSectionWrapper::CreateCriticalSection()),
-  _defaultModule(NULL),
-  _audioModule(NULL),
-  _videoModule(NULL),
-  _deadOrAliveActive(false),
-  _deadOrAliveTimeoutMS(0),
-  _deadOrAliveLastTimer(0),
-  _receivedNTPsecsAudio(0),
-  _receivedNTPfracAudio(0),
-  _RTCPArrivalTimeSecsAudio(0),
-  _RTCPArrivalTimeFracAudio(0),
-  _nackMethod(kNackOff),
-  _nackLastTimeSent(0),
-  _nackLastSeqNumberSent(0),
-  _simulcast(false),
-  _keyFrameReqMethod(kKeyFrameReqFirRtp)
+ModuleRtpRtcpImpl::ModuleRtpRtcpImpl(const Configuration& configuration)
+    : _rtpSender(configuration.id, configuration.audio, configuration.clock),
+      _rtpReceiver(configuration.id, configuration.audio, configuration.clock,
+                   this),
+      _rtcpSender(configuration.id, configuration.audio, configuration.clock,
+                  this),
+      _rtcpReceiver(configuration.id, configuration.clock, this),
+      _owns_clock(false),
+      _clock(*configuration.clock),
+      _id(configuration.id),
+      _audio(configuration.audio),
+      _collisionDetected(false),
+      _lastProcessTime(configuration.clock->GetTimeInMS()),
+      _lastBitrateProcessTime(configuration.clock->GetTimeInMS()),
+      _lastPacketTimeoutProcessTime(configuration.clock->GetTimeInMS()),
+      _packetOverHead(28),  // IPV4 UDP
+      _criticalSectionModulePtrs(
+          CriticalSectionWrapper::CreateCriticalSection()),
+      _criticalSectionModulePtrsFeedback(
+          CriticalSectionWrapper::CreateCriticalSection()),
+      _defaultModule(
+          static_cast<ModuleRtpRtcpImpl*>(configuration.default_module)),
+      _deadOrAliveActive(false),
+      _deadOrAliveTimeoutMS(0),
+      _deadOrAliveLastTimer(0),
+      _nackMethod(kNackOff),
+      _nackLastTimeSent(0),
+      _nackLastSeqNumberSent(0),
+      _simulcast(false),
+      _keyFrameReqMethod(kKeyFrameReqFirRtp)
 #ifdef MATLAB
-  , _plot1(NULL)
+       , _plot1(NULL)
 #endif
 {
   _sendVideoCodec.codecType = kVideoCodecUnknown;
+
+  if (_defaultModule) {
+    _defaultModule->RegisterChildModule(this);
+  }
+  // TODO(pwestin) move to constructors of each rtp/rtcp sender/receiver object.
+  _rtpReceiver.RegisterIncomingDataCallback(configuration.incoming_data);
+  _rtpReceiver.RegisterIncomingRTPCallback(configuration.incoming_messages);
+  _rtcpReceiver.RegisterRtcpObservers(configuration.intra_frame_callback,
+                                      configuration.bandwidth_callback,
+                                      configuration.rtcp_feedback);
+  _rtpSender.RegisterAudioCallback(configuration.audio_messages);
+  _rtpReceiver.RegisterIncomingAudioCallback(configuration.audio_messages);
+
+  _rtpSender.RegisterSendTransport(configuration.outgoing_transport);
+  _rtcpSender.RegisterSendTransport(configuration.outgoing_transport);
+
+  _rtcpSender.SetRemoteBitrateObserver(configuration.bitrate_observer);
+
   // make sure that RTCP objects are aware of our SSRC
   WebRtc_UWord32 SSRC = _rtpSender.SSRC();
   _rtcpSender.SetSSRC(SSRC);
 
-  WEBRTC_TRACE(kTraceMemory, kTraceRtpRtcp, id, "%s created", __FUNCTION__);
+  WEBRTC_TRACE(kTraceMemory, kTraceRtpRtcp, _id, "%s created", __FUNCTION__);
 }
 
 ModuleRtpRtcpImpl::~ModuleRtpRtcpImpl() {
   WEBRTC_TRACE(kTraceMemory, kTraceRtpRtcp, _id, "%s deleted", __FUNCTION__);
 
-  // make sure to unregister this module from other modules
+  // All child modules MUST be deleted before deleting the default.
+  assert(_childModules.empty());
 
-  const bool defaultInstance(_childModules.empty() ? false : true);
-
-  if (defaultInstance) {
-    // deregister for the default module
-    // will go in to the child modules and remove it self
-    std::list<ModuleRtpRtcpImpl*>::iterator it = _childModules.begin();
-    while (it != _childModules.end()) {
-      RtpRtcp* module = *it;
-      _childModules.erase(it);
-      if (module) {
-        module->DeRegisterDefaultModule();
-      }
-      it = _childModules.begin();
-    }
-  } else {
-    // deregister for the child modules
-    // will go in to the default and remove it self
-    DeRegisterDefaultModule();
+  // Deregister for the child modules
+  // will go in to the default and remove it self
+  if (_defaultModule) {
+    _defaultModule->DeRegisterChildModule(this);
   }
-
-  if (_audio) {
-    DeRegisterVideoModule();
-  } else {
-    DeRegisterSyncModule();
-  }
-
 #ifdef MATLAB
   if (_plot1) {
     eng.DeletePlot(_plot1);
     _plot1 = NULL;
   }
 #endif
-
-  delete _criticalSectionModulePtrs;
-  delete _criticalSectionModulePtrsFeedback;
   if (_owns_clock) {
     delete &_clock;
   }
 }
 
-WebRtc_Word32 ModuleRtpRtcpImpl::ChangeUniqueId(const WebRtc_Word32 id) {
-  WEBRTC_TRACE(kTraceModuleCall,
-               kTraceRtpRtcp,
-               _id,
-               "ChangeUniqueId(new id:%d)", id);
-
-  _id = id;
-
-  _rtpReceiver.ChangeUniqueId(id);
-  _rtcpReceiver.ChangeUniqueId(id);
-  _rtpSender.ChangeUniqueId(id);
-  _rtcpSender.ChangeUniqueId(id);
-  return 0;
-}
-
-// default encoder that we need to multiplex out
-WebRtc_Word32 ModuleRtpRtcpImpl::RegisterDefaultModule(RtpRtcp* module) {
-  WEBRTC_TRACE(kTraceModuleCall,
-               kTraceRtpRtcp,
-               _id,
-               "RegisterDefaultModule(module:0x%x)", module);
-
-  if (module == NULL) {
-    return -1;
-  }
-  if (module == this) {
-    WEBRTC_TRACE(kTraceError,
-                 kTraceRtpRtcp,
-                 _id,
-                 "RegisterDefaultModule can't register self as default");
-    return -1;
-  }
-  CriticalSectionScoped lock(_criticalSectionModulePtrs);
-
-  if (_defaultModule) {
-    _defaultModule->DeRegisterChildModule(this);
-  }
-  _defaultModule = (ModuleRtpRtcpImpl*)module;
-  _defaultModule->RegisterChildModule(this);
-  return 0;
-}
-
-WebRtc_Word32 ModuleRtpRtcpImpl::DeRegisterDefaultModule() {
-  WEBRTC_TRACE(kTraceModuleCall,
-               kTraceRtpRtcp,
-               _id,
-               "DeRegisterDefaultModule()");
-
-  CriticalSectionScoped lock(_criticalSectionModulePtrs);
-  if (_defaultModule) {
-    _defaultModule->DeRegisterChildModule(this);
-    _defaultModule = NULL;
-  }
-  return 0;
-}
-
-bool ModuleRtpRtcpImpl::DefaultModuleRegistered() {
-  WEBRTC_TRACE(kTraceModuleCall,
-               kTraceRtpRtcp,
-               _id,
-               "DefaultModuleRegistered()");
-
-  CriticalSectionScoped lock(_criticalSectionModulePtrs);
-  if (_defaultModule) {
-    return true;
-  }
-  return false;
-}
-
-WebRtc_UWord32 ModuleRtpRtcpImpl::NumberChildModules() {
-  WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, _id, "NumberChildModules");
-
-  CriticalSectionScoped lock(_criticalSectionModulePtrs);
-  CriticalSectionScoped doubleLock(_criticalSectionModulePtrsFeedback);
-  // we use two locks for protecting _childModules one
-  // (_criticalSectionModulePtrsFeedback) for incoming  messages
-  // (BitrateSent and UpdateTMMBR) and _criticalSectionModulePtrs for
-  //  all outgoing messages sending packets etc
-
-  return _childModules.size();
-}
-
 void ModuleRtpRtcpImpl::RegisterChildModule(RtpRtcp* module) {
   WEBRTC_TRACE(kTraceModuleCall,
                kTraceRtpRtcp,
@@ -259,9 +140,9 @@
                "RegisterChildModule(module:0x%x)",
                module);
 
-  CriticalSectionScoped lock(_criticalSectionModulePtrs);
+  CriticalSectionScoped lock(_criticalSectionModulePtrs.get());
 
-  CriticalSectionScoped doubleLock(_criticalSectionModulePtrsFeedback);
+  CriticalSectionScoped doubleLock(_criticalSectionModulePtrsFeedback.get());
   // we use two locks for protecting _childModules one
   // (_criticalSectionModulePtrsFeedback) for incoming
   // messages (BitrateSent) and _criticalSectionModulePtrs
@@ -275,9 +156,9 @@
                _id,
                "DeRegisterChildModule(module:0x%x)", removeModule);
 
-  CriticalSectionScoped lock(_criticalSectionModulePtrs);
+  CriticalSectionScoped lock(_criticalSectionModulePtrs.get());
 
-  CriticalSectionScoped doubleLock(_criticalSectionModulePtrsFeedback);
+  CriticalSectionScoped doubleLock(_criticalSectionModulePtrsFeedback.get());
 
   std::list<ModuleRtpRtcpImpl*>::iterator it = _childModules.begin();
   while (it != _childModules.end()) {
@@ -290,76 +171,6 @@
   }
 }
 
-// Lip-sync between voice-video engine,
-WebRtc_Word32 ModuleRtpRtcpImpl::RegisterSyncModule(RtpRtcp* audioModule) {
-  WEBRTC_TRACE(kTraceModuleCall,
-               kTraceRtpRtcp,
-               _id,
-               "RegisterSyncModule(module:0x%x)",
-               audioModule);
-
-  if (audioModule == NULL) {
-    return -1;
-  }
-  if (_audio) {
-    return -1;
-  }
-  CriticalSectionScoped lock(_criticalSectionModulePtrs);
-  _audioModule = (ModuleRtpRtcpImpl*)audioModule;
-  return _audioModule->RegisterVideoModule(this);
-}
-
-WebRtc_Word32 ModuleRtpRtcpImpl::DeRegisterSyncModule() {
-  WEBRTC_TRACE(kTraceModuleCall,
-               kTraceRtpRtcp,
-               _id,
-               "DeRegisterSyncModule()");
-
-  CriticalSectionScoped lock(_criticalSectionModulePtrs);
-  if (_audioModule) {
-    ModuleRtpRtcpImpl* audioModule = _audioModule;
-    _audioModule = NULL;
-    _receivedNTPsecsAudio = 0;
-    _receivedNTPfracAudio = 0;
-    _RTCPArrivalTimeSecsAudio = 0;
-    _RTCPArrivalTimeFracAudio = 0;
-    audioModule->DeRegisterVideoModule();
-  }
-  return 0;
-}
-
-WebRtc_Word32 ModuleRtpRtcpImpl::RegisterVideoModule(RtpRtcp* videoModule) {
-  WEBRTC_TRACE(kTraceModuleCall,
-               kTraceRtpRtcp,
-               _id,
-               "RegisterVideoModule(module:0x%x)",
-               videoModule);
-
-  if (videoModule == NULL) {
-    return -1;
-  }
-  if (!_audio) {
-    return -1;
-  }
-  CriticalSectionScoped lock(_criticalSectionModulePtrs);
-  _videoModule = (ModuleRtpRtcpImpl*)videoModule;
-  return 0;
-}
-
-void ModuleRtpRtcpImpl::DeRegisterVideoModule() {
-  WEBRTC_TRACE(kTraceModuleCall,
-               kTraceRtpRtcp,
-               _id,
-               "DeRegisterVideoModule()");
-
-  CriticalSectionScoped lock(_criticalSectionModulePtrs);
-  if (_videoModule) {
-    ModuleRtpRtcpImpl* videoModule = _videoModule;
-    _videoModule = NULL;
-    videoModule->DeRegisterSyncModule();
-  }
-}
-
 // returns the number of milliseconds until the module want a worker thread
 // to call Process
 WebRtc_Word32 ModuleRtpRtcpImpl::TimeUntilNextProcess() {
@@ -436,20 +247,6 @@
 *   Receiver
 */
 
-WebRtc_Word32 ModuleRtpRtcpImpl::InitReceiver() {
-  WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, _id, "InitReceiver()");
-
-  _packetOverHead = 28; // default is IPV4 UDP
-  _receivedNTPsecsAudio = 0;
-  _receivedNTPfracAudio = 0;
-  _RTCPArrivalTimeSecsAudio = 0;
-  _RTCPArrivalTimeFracAudio = 0;
-
-  _rtpReceiver.Init();
-  _rtpReceiver.SetPacketOverHead(_packetOverHead);
-  return 0;
-}
-
 void ModuleRtpRtcpImpl::ProcessDeadOrAliveTimer() {
   if (_deadOrAliveActive) {
     const WebRtc_UWord32 now = _clock.GetTimeInMS();
@@ -687,7 +484,6 @@
                _id,
                "IncomingPacket(packetLength:%u)",
                incomingPacketLength);
-
   // minimum RTP is 12 bytes
   // minimum RTCP is 8 bytes (RTCP BYE)
   if (incomingPacketLength < 8 || incomingPacket == NULL) {
@@ -754,85 +550,10 @@
   }
 }
 
-WebRtc_Word32 ModuleRtpRtcpImpl::IncomingAudioNTP(
-  const WebRtc_UWord32 audioReceivedNTPsecs,
-  const WebRtc_UWord32 audioReceivedNTPfrac,
-  const WebRtc_UWord32 audioRTCPArrivalTimeSecs,
-  const WebRtc_UWord32 audioRTCPArrivalTimeFrac) {
-  _receivedNTPsecsAudio = audioReceivedNTPsecs;
-  _receivedNTPfracAudio = audioReceivedNTPfrac;
-  _RTCPArrivalTimeSecsAudio = audioRTCPArrivalTimeSecs;
-  _RTCPArrivalTimeFracAudio = audioRTCPArrivalTimeFrac;
-  return 0;
-}
-
-WebRtc_Word32 ModuleRtpRtcpImpl::RegisterIncomingDataCallback(
-  RtpData* incomingDataCallback) {
-  WEBRTC_TRACE(kTraceModuleCall,
-               kTraceRtpRtcp,
-               _id,
-               "RegisterIncomingDataCallback(incomingDataCallback:0x%x)",
-               incomingDataCallback);
-
-  return _rtpReceiver.RegisterIncomingDataCallback(incomingDataCallback);
-}
-
-WebRtc_Word32 ModuleRtpRtcpImpl::RegisterIncomingRTPCallback(
-  RtpFeedback* incomingMessagesCallback) {
-  WEBRTC_TRACE(kTraceModuleCall,
-               kTraceRtpRtcp,
-               _id,
-               "RegisterIncomingRTPCallback(incomingMessagesCallback:0x%x)",
-               incomingMessagesCallback);
-
-  return _rtpReceiver.RegisterIncomingRTPCallback(incomingMessagesCallback);
-}
-
-void ModuleRtpRtcpImpl::RegisterRtcpObservers(
-    RtcpIntraFrameObserver* intra_frame_callback,
-    RtcpBandwidthObserver* bandwidth_callback,
-    RtcpFeedback* feedback_callback) {
-  _rtcpReceiver.RegisterRtcpObservers(intra_frame_callback, bandwidth_callback,
-                                      feedback_callback);
-}
-
-WebRtc_Word32 ModuleRtpRtcpImpl::RegisterAudioCallback(
-  RtpAudioFeedback* messagesCallback) {
-  WEBRTC_TRACE(kTraceModuleCall,
-               kTraceRtpRtcp,
-               _id,
-               "RegisterAudioCallback(messagesCallback:0x%x)",
-               messagesCallback);
-
-  if (_rtpSender.RegisterAudioCallback(messagesCallback) == 0) {
-    return _rtpReceiver.RegisterIncomingAudioCallback(messagesCallback);
-  }
-  return -1;
-}
-
 /**
 *   Sender
 */
 
-WebRtc_Word32 ModuleRtpRtcpImpl::InitSender() {
-  WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, _id, "InitSender()");
-
-  _collisionDetected = false;
-
-  // if we are already receiving inform our sender to avoid collision
-  if (_rtpSender.Init(_rtpReceiver.SSRC()) != 0) {
-    return -1;
-  }
-  WebRtc_Word32 retVal = _rtcpSender.Init();
-
-  // make sure that RTCP objects are aware of our SSRC
-  // (it could have changed due to collision)
-  WebRtc_UWord32 SSRC = _rtpSender.SSRC();
-  _rtcpReceiver.SetSSRC(SSRC);
-  _rtcpSender.SetSSRC(SSRC);
-  return retVal;
-}
-
 WebRtc_Word32 ModuleRtpRtcpImpl::RegisterSendPayload(
   const CodecInst& voiceCodec) {
   WEBRTC_TRACE(kTraceModuleCall,
@@ -962,7 +683,7 @@
 
   if (defaultInstance) {
     // for default we need to update all child modules too
-    CriticalSectionScoped lock(_criticalSectionModulePtrs);
+    CriticalSectionScoped lock(_criticalSectionModulePtrs.get());
 
     std::list<ModuleRtpRtcpImpl*>::iterator it = _childModules.begin();
     while (it != _childModules.end()) {
@@ -1060,7 +781,7 @@
     return _rtpSender.SendingMedia();
   }
 
-  CriticalSectionScoped lock(_criticalSectionModulePtrs);
+  CriticalSectionScoped lock(_criticalSectionModulePtrs.get());
   std::list<ModuleRtpRtcpImpl*>::const_iterator it = _childModules.begin();
   while (it != _childModules.end()) {
     RTPSender& rtpSender = (*it)->_rtpSender;
@@ -1072,19 +793,6 @@
   return false;
 }
 
-WebRtc_Word32 ModuleRtpRtcpImpl::RegisterSendTransport(
-  Transport* outgoingTransport) {
-  WEBRTC_TRACE(kTraceModuleCall,
-               kTraceRtpRtcp,
-               _id,
-               "RegisterSendTransport(0x%x)", outgoingTransport);
-
-  if (_rtpSender.RegisterSendTransport(outgoingTransport) == 0) {
-    return _rtcpSender.RegisterSendTransport(outgoingTransport);
-  }
-  return -1;
-}
-
 WebRtc_Word32 ModuleRtpRtcpImpl::SendOutgoingData(
     FrameType frameType,
     WebRtc_Word8 payloadType,
@@ -1121,7 +829,7 @@
       return -1;
     }
     int idx = 0;
-    CriticalSectionScoped lock(_criticalSectionModulePtrs);
+    CriticalSectionScoped lock(_criticalSectionModulePtrs.get());
     std::list<ModuleRtpRtcpImpl*>::iterator it = _childModules.begin();
     for (; idx < rtpVideoHdr->simulcastIdx; idx++) {
       it++;
@@ -1144,7 +852,7 @@
                                       NULL,
                                       &(rtpVideoHdr->codecHeader));
   } else {
-    CriticalSectionScoped lock(_criticalSectionModulePtrs);
+    CriticalSectionScoped lock(_criticalSectionModulePtrs.get());
     // TODO(pwestin) remove codecInfo from SendOutgoingData
     VideoCodecInformation* codecInfo = NULL;
 
@@ -1198,7 +906,7 @@
   const bool defaultInstance(_childModules.empty() ? false : true);
   if (defaultInstance) {
     // for default we need to update all child modules too
-    CriticalSectionScoped lock(_criticalSectionModulePtrs);
+    CriticalSectionScoped lock(_criticalSectionModulePtrs.get());
     std::list<ModuleRtpRtcpImpl*>::const_iterator it =
       _childModules.begin();
     while (it != _childModules.end()) {
@@ -1563,11 +1271,6 @@
   return _rtcpSender.SetREMBData(bitrate, numberOfSSRC, SSRC);
 }
 
-bool ModuleRtpRtcpImpl::SetRemoteBitrateObserver(
-  RtpRemoteBitrateObserver* observer) {
-  return _rtcpSender.SetRemoteBitrateObserver(observer);
-}
-
 /*
  *   (IJ) Extended jitter report.
  */
@@ -1655,7 +1358,7 @@
   const bool defaultInstance(_childModules.empty() ? false : true);
   if (defaultInstance) {
     // for default we need to check all child modules too
-    CriticalSectionScoped lock(_criticalSectionModulePtrs);
+    CriticalSectionScoped lock(_criticalSectionModulePtrs.get());
     std::list<ModuleRtpRtcpImpl*>::const_iterator it =
       _childModules.begin();
     while (it != _childModules.end()) {
@@ -1918,7 +1621,7 @@
 
   const bool haveChildModules(_childModules.empty() ? false : true);
   if (haveChildModules) {
-    CriticalSectionScoped lock(_criticalSectionModulePtrs);
+    CriticalSectionScoped lock(_criticalSectionModulePtrs.get());
     if (_simulcast) {
       uint32_t bitrate_remainder = bitrate;
       std::list<ModuleRtpRtcpImpl*>::iterator it = _childModules.begin();
@@ -1994,7 +1697,7 @@
   const bool defaultInstance(_childModules.empty() ? false : true);
 
   if (defaultInstance) {
-    CriticalSectionScoped lock(_criticalSectionModulePtrs);
+    CriticalSectionScoped lock(_criticalSectionModulePtrs.get());
 
     std::list<ModuleRtpRtcpImpl*>::iterator it = _childModules.begin();
     while (it != _childModules.end()) {
@@ -2041,7 +1744,7 @@
   const bool defaultInstance(_childModules.empty() ? false : true);
   if (defaultInstance) {
     // for default we need to check all child modules too
-    CriticalSectionScoped lock(_criticalSectionModulePtrs);
+    CriticalSectionScoped lock(_criticalSectionModulePtrs.get());
     std::list<ModuleRtpRtcpImpl*>::iterator it = _childModules.begin();
     while (it != _childModules.end()) {
       RtpRtcp* module = *it;
@@ -2075,7 +1778,7 @@
   const bool defaultInstance(_childModules.empty() ? false : true);
   if (defaultInstance)  {
     // for default we need to update all child modules too
-    CriticalSectionScoped lock(_criticalSectionModulePtrs);
+    CriticalSectionScoped lock(_criticalSectionModulePtrs.get());
 
     std::list<ModuleRtpRtcpImpl*>::iterator it = _childModules.begin();
     while (it != _childModules.end()) {
@@ -2128,7 +1831,7 @@
 
   if (defaultInstance) {
     // for default we need to update the send bitrate
-    CriticalSectionScoped lock(_criticalSectionModulePtrsFeedback);
+    CriticalSectionScoped lock(_criticalSectionModulePtrsFeedback.get());
 
     if (totalRate != NULL)
       *totalRate = 0;
@@ -2183,66 +1886,6 @@
   return 0;
 }
 
-// for lip sync
-void ModuleRtpRtcpImpl::OnReceivedNTP() {
-  // don't do anything if we are the audio module
-  // video module is responsible for sync
-  if (!_audio) {
-    WebRtc_Word32 diff = 0;
-    WebRtc_UWord32 receivedNTPsecs = 0;
-    WebRtc_UWord32 receivedNTPfrac = 0;
-    WebRtc_UWord32 RTCPArrivalTimeSecs = 0;
-    WebRtc_UWord32 RTCPArrivalTimeFrac = 0;
-
-    if (0 == _rtcpReceiver.NTP(&receivedNTPsecs,
-                               &receivedNTPfrac,
-                               &RTCPArrivalTimeSecs,
-                               &RTCPArrivalTimeFrac)) {
-      CriticalSectionScoped lock(_criticalSectionModulePtrs);
-
-      if (_audioModule) {
-        if (0 != _audioModule->RemoteNTP(&_receivedNTPsecsAudio,
-                                         &_receivedNTPfracAudio,
-                                         &_RTCPArrivalTimeSecsAudio,
-                                         &_RTCPArrivalTimeFracAudio)) {
-          // failed ot get audio NTP
-          return;
-        }
-      }
-      if (_receivedNTPfracAudio != 0) {
-        // ReceivedNTPxxx is NTP at sender side when sent.
-        // RTCPArrivalTimexxx is NTP at receiver side when received.
-        // can't use ConvertNTPTimeToMS since calculation can be
-        //  negative
-
-        WebRtc_Word32 NTPdiff = (WebRtc_Word32)
-                                ((_receivedNTPsecsAudio - receivedNTPsecs) *
-                                 1000); // ms
-        NTPdiff += (WebRtc_Word32)
-                   (_receivedNTPfracAudio / FracMS - receivedNTPfrac / FracMS);
-
-        WebRtc_Word32 RTCPdiff =
-            static_cast<WebRtc_Word32> ((_RTCPArrivalTimeSecsAudio -
-                                         RTCPArrivalTimeSecs) * 1000);
-        RTCPdiff += (WebRtc_Word32)
-                    (_RTCPArrivalTimeFracAudio / FracMS -
-                     RTCPArrivalTimeFrac / FracMS);
-
-        diff = NTPdiff - RTCPdiff;
-        // if diff is + video is behind
-        if (diff < -1000 || diff > 1000) {
-          // unresonable ignore value.
-          diff = 0;
-          return;
-        }
-      }
-    }
-    // export via callback
-    // after release of critsect
-    _rtcpReceiver.UpdateLipSync(diff);
-  }
-}
-
 RateControlRegion ModuleRtpRtcpImpl::OnOverUseStateUpdate(
   const RateControlInput& rateControlInput) {
 
diff --git a/src/modules/rtp_rtcp/source/rtp_rtcp_impl.h b/src/modules/rtp_rtcp/source/rtp_rtcp_impl.h
index f71c9d2..8724d78 100644
--- a/src/modules/rtp_rtcp/source/rtp_rtcp_impl.h
+++ b/src/modules/rtp_rtcp/source/rtp_rtcp_impl.h
@@ -13,11 +13,12 @@
 
 #include <list>
 
-#include "rtcp_receiver.h"
-#include "rtcp_sender.h"
-#include "rtp_receiver.h"
-#include "rtp_rtcp.h"
-#include "rtp_sender.h"
+#include "modules/rtp_rtcp/interface/rtp_rtcp.h"
+#include "modules/rtp_rtcp/source/rtcp_receiver.h"
+#include "modules/rtp_rtcp/source/rtcp_sender.h"
+#include "modules/rtp_rtcp/source/rtp_receiver.h"
+#include "modules/rtp_rtcp/source/rtp_sender.h"
+#include "system_wrappers/interface/scoped_ptr.h"
 
 #ifdef MATLAB
 class MatlabPlot;
@@ -25,34 +26,12 @@
 
 namespace webrtc {
 
-class ModuleRtpRtcpImpl : public RtpRtcp
-{
-public:
-    ModuleRtpRtcpImpl(const WebRtc_Word32 id,
-                      const bool audio,
-                      RtpRtcpClock* clock);
+class ModuleRtpRtcpImpl : public RtpRtcp {
+ public:
+    explicit ModuleRtpRtcpImpl(const RtpRtcp::Configuration& configuration);
 
     virtual ~ModuleRtpRtcpImpl();
 
-    // get Module ID
-    WebRtc_Word32 Id()   {return _id;}
-
-    virtual WebRtc_Word32 ChangeUniqueId(const WebRtc_Word32 id);
-
-    // De-muxing functionality for
-    virtual WebRtc_Word32 RegisterDefaultModule(RtpRtcp* module);
-    virtual WebRtc_Word32 DeRegisterDefaultModule();
-    virtual bool DefaultModuleRegistered();
-
-    virtual WebRtc_UWord32 NumberChildModules();
-
-    // Lip-sync between voice-video
-    virtual WebRtc_Word32 RegisterSyncModule(RtpRtcp* module);
-    virtual WebRtc_Word32 DeRegisterSyncModule();
-
-    virtual WebRtc_Word32 RegisterVideoModule(RtpRtcp* videoModule);
-    virtual void DeRegisterVideoModule();
-
     // returns the number of milliseconds until the module want a worker thread to call Process
     virtual WebRtc_Word32 TimeUntilNextProcess();
 
@@ -62,8 +41,6 @@
     /**
     *   Receiver
     */
-    virtual WebRtc_Word32 InitReceiver();
-
     // configure a timeout value
     virtual WebRtc_Word32 SetPacketTimeout(const WebRtc_UWord32 RTPtimeoutMS,
                                            const WebRtc_UWord32 RTCPtimeoutMS);
@@ -125,31 +102,9 @@
     virtual WebRtc_Word32 IncomingPacket( const WebRtc_UWord8* incomingPacket,
                                         const WebRtc_UWord16 packetLength);
 
-    virtual WebRtc_Word32 IncomingAudioNTP(const WebRtc_UWord32 audioReceivedNTPsecs,
-                                         const WebRtc_UWord32 audioReceivedNTPfrac,
-                                         const WebRtc_UWord32 audioRTCPArrivalTimeSecs,
-                                         const WebRtc_UWord32 audioRTCPArrivalTimeFrac);
-
-    // Used by the module to deliver the incoming data to the codec module
-    virtual WebRtc_Word32 RegisterIncomingDataCallback(
-        RtpData* incomingDataCallback);
-
-    // Used by the module to deliver messages to the codec module/appliation
-    virtual WebRtc_Word32 RegisterIncomingRTPCallback(
-        RtpFeedback* incomingMessagesCallback);
-
-    virtual void RegisterRtcpObservers(
-        RtcpIntraFrameObserver* intraFrameCallback,
-        RtcpBandwidthObserver* bandwidthCallback,
-        RtcpFeedback* callback);
-
-    virtual WebRtc_Word32 RegisterAudioCallback(RtpAudioFeedback* messagesCallback);
-
     /**
     *   Sender
     */
-    virtual WebRtc_Word32 InitSender();
-
     virtual WebRtc_Word32 RegisterSendPayload(const CodecInst& voiceCodec);
 
     virtual WebRtc_Word32 RegisterSendPayload(const VideoCodec& videoCodec);
@@ -216,9 +171,6 @@
 
     virtual bool SendingMedia() const;
 
-    // Used by the module to send RTP and RTCP packet to the network module
-    virtual WebRtc_Word32 RegisterSendTransport(Transport* outgoingTransport);
-
     // Used by the codec module to deliver a video or audio frame for packetization
     virtual WebRtc_Word32 SendOutgoingData(
         const FrameType frameType,
@@ -325,7 +277,6 @@
                                       const WebRtc_UWord8 numberOfSSRC,
                                       const WebRtc_UWord32* SSRC);
 
-    virtual bool SetRemoteBitrateObserver(RtpRemoteBitrateObserver* observer);
     /*
     *   (IJ) Extended jitter report.
     */
@@ -482,8 +433,6 @@
     // good state of RTP receiver inform sender
     virtual WebRtc_Word32 SendRTCPReferencePictureSelection(const WebRtc_UWord64 pictureID);
 
-    void OnReceivedNTP() ;
-
     void OnReceivedTMMBR();
 
     // bad state of RTP receiver request a keyframe
@@ -539,23 +488,15 @@
     WebRtc_UWord32            _lastPacketTimeoutProcessTime;
     WebRtc_UWord16            _packetOverHead;
 
-    CriticalSectionWrapper*       _criticalSectionModulePtrs;
-    CriticalSectionWrapper*       _criticalSectionModulePtrsFeedback;
+    scoped_ptr<CriticalSectionWrapper> _criticalSectionModulePtrs;
+    scoped_ptr<CriticalSectionWrapper> _criticalSectionModulePtrsFeedback;
     ModuleRtpRtcpImpl*            _defaultModule;
-    ModuleRtpRtcpImpl*            _audioModule;
-    ModuleRtpRtcpImpl*            _videoModule;
     std::list<ModuleRtpRtcpImpl*> _childModules;
 
     // Dead or alive
     bool                  _deadOrAliveActive;
     WebRtc_UWord32        _deadOrAliveTimeoutMS;
     WebRtc_UWord32        _deadOrAliveLastTimer;
-
-    WebRtc_UWord32        _receivedNTPsecsAudio;
-    WebRtc_UWord32        _receivedNTPfracAudio;
-    WebRtc_UWord32        _RTCPArrivalTimeSecsAudio;
-    WebRtc_UWord32        _RTCPArrivalTimeFracAudio;
-
     // send side
     NACKMethod            _nackMethod;
     WebRtc_UWord32        _nackLastTimeSent;
diff --git a/src/modules/rtp_rtcp/source/rtp_sender.cc b/src/modules/rtp_rtcp/source/rtp_sender.cc
index e877692b..945171c 100644
--- a/src/modules/rtp_rtcp/source/rtp_sender.cc
+++ b/src/modules/rtp_rtcp/source/rtp_sender.cc
@@ -117,7 +117,7 @@
 
   WEBRTC_TRACE(kTraceMemory, kTraceRtpRtcp, _id, "%s deleted", __FUNCTION__);
 }
-
+/*
 WebRtc_Word32
 RTPSender::Init(const WebRtc_UWord32 remoteSSRC)
 {
@@ -173,19 +173,7 @@
     }
     return(0);
 }
-
-void
-RTPSender::ChangeUniqueId(const WebRtc_Word32 id)
-{
-    _id = id;
-    if(_audioConfigured)
-    {
-        _audio->ChangeUniqueId(id);
-    } else
-    {
-        _video->ChangeUniqueId(id);
-    }
-}
+*/
 
 void RTPSender::SetTargetSendBitrate(const WebRtc_UWord32 bits) {
   _targetSendBitrate = static_cast<uint16_t>(bits / 1000);
diff --git a/src/modules/rtp_rtcp/source/rtp_sender.h b/src/modules/rtp_rtcp/source/rtp_sender.h
index 3906e8c..37eec48 100644
--- a/src/modules/rtp_rtcp/source/rtp_sender.h
+++ b/src/modules/rtp_rtcp/source/rtp_sender.h
@@ -68,9 +68,6 @@
     RTPSender(const WebRtc_Word32 id, const bool audio, RtpRtcpClock* clock);
     virtual ~RTPSender();
 
-    WebRtc_Word32 Init(const WebRtc_UWord32 remoteSSRC);
-    void ChangeUniqueId(const WebRtc_Word32 id);
-
     void ProcessBitrate();
     void ProcessSendToNetwork();
 
diff --git a/src/modules/rtp_rtcp/source/rtp_sender_audio.cc b/src/modules/rtp_rtcp/source/rtp_sender_audio.cc
index ee3c414..361aea5 100644
--- a/src/modules/rtp_rtcp/source/rtp_sender_audio.cc
+++ b/src/modules/rtp_rtcp/source/rtp_sender_audio.cc
@@ -51,30 +51,6 @@
 }
 
 WebRtc_Word32
-RTPSenderAudio::Init()
-{
-    CriticalSectionScoped cs(_sendAudioCritsect);
-
-    _dtmfPayloadType = -1;
-    _inbandVADactive = false;
-    _cngNBPayloadType = -1;
-    _cngWBPayloadType = -1;
-    _cngSWBPayloadType = -1;
-    _lastPayloadType = -1;
-    _REDPayloadType = -1;
-    _dtmfTimeLastSent = 0;
-    _dtmfTimestampLastSent = 0;
-    ResetDTMF();
-    return 0;
-}
-
-void
-RTPSenderAudio::ChangeUniqueId(const WebRtc_Word32 id)
-{
-    _id = id;
-}
-
-WebRtc_Word32
 RTPSenderAudio::RegisterAudioCallback(RtpAudioFeedback* messagesCallback)
 {
     CriticalSectionScoped cs(_audioFeedbackCritsect);
diff --git a/src/modules/rtp_rtcp/source/rtp_sender_audio.h b/src/modules/rtp_rtcp/source/rtp_sender_audio.h
index 5fda2ef..1ea2fab 100644
--- a/src/modules/rtp_rtcp/source/rtp_sender_audio.h
+++ b/src/modules/rtp_rtcp/source/rtp_sender_audio.h
@@ -28,10 +28,6 @@
                    RTPSenderInterface* rtpSender);
     virtual ~RTPSenderAudio();
 
-    void ChangeUniqueId(const WebRtc_Word32 id);
-
-    WebRtc_Word32 Init();
-
     WebRtc_Word32 RegisterAudioPayload(
         const char payloadName[RTP_PAYLOAD_NAME_SIZE],
         const WebRtc_Word8 payloadType,
diff --git a/src/modules/rtp_rtcp/source/rtp_sender_video.cc b/src/modules/rtp_rtcp/source/rtp_sender_video.cc
index 8f44973..f1e3c74 100644
--- a/src/modules/rtp_rtcp/source/rtp_sender_video.cc
+++ b/src/modules/rtp_rtcp/source/rtp_sender_video.cc
@@ -67,29 +67,6 @@
     delete _sendVideoCritsect;
 }
 
-WebRtc_Word32
-RTPSenderVideo::Init()
-{
-    CriticalSectionScoped cs(_sendVideoCritsect);
-
-    _retransmissionSettings = kRetransmitBaseLayer;
-    _fecEnabled = false;
-    _payloadTypeRED = -1;
-    _payloadTypeFEC = -1;
-    _numberFirstPartition = 0;
-    memset(&delta_fec_params_, 0, sizeof(delta_fec_params_));
-    memset(&key_fec_params_, 0, sizeof(key_fec_params_));
-    delta_fec_params_.max_fec_frames = key_fec_params_.max_fec_frames = 1;
-    _fecOverheadRate.Init();
-    return 0;
-}
-
-void
-RTPSenderVideo::ChangeUniqueId(const WebRtc_Word32 id)
-{
-    _id = id;
-}
-
 void
 RTPSenderVideo::SetVideoCodecType(RtpVideoCodecTypes videoType)
 {
diff --git a/src/modules/rtp_rtcp/source/rtp_sender_video.h b/src/modules/rtp_rtcp/source/rtp_sender_video.h
index 18f39ca..5c3f70c 100644
--- a/src/modules/rtp_rtcp/source/rtp_sender_video.h
+++ b/src/modules/rtp_rtcp/source/rtp_sender_video.h
@@ -37,10 +37,6 @@
                    RTPSenderInterface* rtpSender);
     virtual ~RTPSenderVideo();
 
-    WebRtc_Word32 Init();
-
-    virtual void ChangeUniqueId(const WebRtc_Word32 id);
-
     virtual RtpVideoCodecTypes VideoCodecType() const;
 
     WebRtc_UWord16 FECPacketOverhead() const;
diff --git a/src/modules/rtp_rtcp/test/testAPI/test_api.cc b/src/modules/rtp_rtcp/test/testAPI/test_api.cc
index 7c1a309..dd12c45 100644
--- a/src/modules/rtp_rtcp/test/testAPI/test_api.cc
+++ b/src/modules/rtp_rtcp/test/testAPI/test_api.cc
@@ -33,13 +33,15 @@
   ~RtpRtcpAPITest() {}
 
   virtual void SetUp() {
-    module = RtpRtcp::CreateRtpRtcp(test_id, true, &fake_clock);
-    EXPECT_EQ(0, module->InitReceiver());
-    EXPECT_EQ(0, module->InitSender());
+    RtpRtcp::Configuration configuration;
+    configuration.id = test_id;
+    configuration.audio = true;
+    configuration.clock = &fake_clock;
+    module = RtpRtcp::CreateRtpRtcp(configuration);
   }
 
   virtual void TearDown() {
-    RtpRtcp::DestroyRtpRtcp(module);
+    delete module;
   }
 
   int test_id;
diff --git a/src/modules/rtp_rtcp/test/testAPI/test_api.h b/src/modules/rtp_rtcp/test/testAPI/test_api.h
index c4ff916..ed9d75a 100644
--- a/src/modules/rtp_rtcp/test/testAPI/test_api.h
+++ b/src/modules/rtp_rtcp/test/testAPI/test_api.h
@@ -1,5 +1,5 @@
 /*
- *  Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
+ *  Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
  *
  *  Use of this source code is governed by a BSD-style license
  *  that can be found in the LICENSE file in the root of the source
@@ -40,10 +40,13 @@
 // with optional packet loss.
 class LoopBackTransport : public webrtc::Transport {
  public:
-  LoopBackTransport(RtpRtcp* rtpRtcpModule)
+  LoopBackTransport()
     : _count(0),
       _packetLoss(0),
-      _rtpRtcpModule(rtpRtcpModule) {
+      _rtpRtcpModule(NULL) {
+  }
+  void SetSendModule(RtpRtcp* rtpRtcpModule) {
+    _rtpRtcpModule = rtpRtcpModule;
   }
   void DropEveryNthPacket(int n) {
     _packetLoss = n;
diff --git a/src/modules/rtp_rtcp/test/testAPI/test_api_audio.cc b/src/modules/rtp_rtcp/test/testAPI/test_api_audio.cc
index e92f8b6..25b91a0 100644
--- a/src/modules/rtp_rtcp/test/testAPI/test_api_audio.cc
+++ b/src/modules/rtp_rtcp/test/testAPI/test_api_audio.cc
@@ -24,8 +24,6 @@
 
 class VerifyingAudioReceiver : public RtpData {
  public:
-  VerifyingAudioReceiver(RtpRtcp* rtpRtcpModule) {}
-
   virtual WebRtc_Word32 OnReceivedPayloadData(
       const WebRtc_UWord8* payloadData,
       const WebRtc_UWord16 payloadSize,
@@ -132,30 +130,41 @@
   ~RtpRtcpAudioTest() {}
 
   virtual void SetUp() {
-    module1 = RtpRtcp::CreateRtpRtcp(test_id, true, &fake_clock);
-    module2 = RtpRtcp::CreateRtpRtcp(test_id+1, true, &fake_clock);
-
-    EXPECT_EQ(0, module1->InitReceiver());
-    EXPECT_EQ(0, module1->InitSender());
-    EXPECT_EQ(0, module2->InitReceiver());
-    EXPECT_EQ(0, module2->InitSender());
-    data_receiver1 = new VerifyingAudioReceiver(module1);
-    EXPECT_EQ(0, module1->RegisterIncomingDataCallback(data_receiver1));
-    data_receiver2 = new VerifyingAudioReceiver(module2);
-    EXPECT_EQ(0, module2->RegisterIncomingDataCallback(data_receiver2));
-    transport1 = new LoopBackTransport(module2);
-    EXPECT_EQ(0, module1->RegisterSendTransport(transport1));
-    transport2 = new LoopBackTransport(module1);
-    EXPECT_EQ(0, module2->RegisterSendTransport(transport2));
+    audioFeedback = new AudioFeedback();
+    data_receiver1 = new VerifyingAudioReceiver();
+    data_receiver2 = new VerifyingAudioReceiver();
     rtp_callback = new RTPCallback();
-    EXPECT_EQ(0, module2->RegisterIncomingRTPCallback(rtp_callback));
+    transport1 = new LoopBackTransport();
+    transport2 = new LoopBackTransport();
+
+    RtpRtcp::Configuration configuration;
+    configuration.id = test_id;
+    configuration.audio = true;
+    configuration.clock = &fake_clock;
+    configuration.incoming_data = data_receiver1;
+    configuration.outgoing_transport = transport1;
+    configuration.audio_messages = audioFeedback;
+
+    module1 = RtpRtcp::CreateRtpRtcp(configuration);
+
+    configuration.id = test_id + 1;
+    configuration.incoming_data = data_receiver2;
+    configuration.incoming_messages = rtp_callback;
+    configuration.outgoing_transport = transport2;
+    configuration.audio_messages = audioFeedback;
+
+    module2 = RtpRtcp::CreateRtpRtcp(configuration);
+
+    transport1->SetSendModule(module2);
+    transport2->SetSendModule(module1);
   }
 
   virtual void TearDown() {
-    RtpRtcp::DestroyRtpRtcp(module1);
-    RtpRtcp::DestroyRtpRtcp(module2);
+    delete module1;
+    delete module2;
     delete transport1;
     delete transport2;
+    delete audioFeedback;
     delete data_receiver1;
     delete data_receiver2;
     delete rtp_callback;
@@ -168,6 +177,7 @@
   VerifyingAudioReceiver* data_receiver2;
   LoopBackTransport* transport1;
   LoopBackTransport* transport2;
+  AudioFeedback* audioFeedback;
   RTPCallback* rtp_callback;
   WebRtc_UWord32 test_ssrc;
   WebRtc_UWord32 test_timestamp;
@@ -283,9 +293,6 @@
   EXPECT_EQ(0, module1->SetStartTimestamp(test_timestamp));
   EXPECT_EQ(0, module1->SetSendingStatus(true));
 
-  AudioFeedback* audioFeedback = new AudioFeedback();
-  EXPECT_EQ(0, module2->RegisterAudioCallback(audioFeedback));
-
   // Prepare for DTMF.
   voiceCodec.pltype = 97;
   voiceCodec.plfreq = 8000;
diff --git a/src/modules/rtp_rtcp/test/testAPI/test_api_nack.cc b/src/modules/rtp_rtcp/test/testAPI/test_api_nack.cc
index ec4d2bb..ad4dd6a 100644
--- a/src/modules/rtp_rtcp/test/testAPI/test_api_nack.cc
+++ b/src/modules/rtp_rtcp/test/testAPI/test_api_nack.cc
@@ -50,12 +50,15 @@
 
 class NackLoopBackTransport : public webrtc::Transport {
  public:
-  NackLoopBackTransport(RtpRtcp* rtp_rtcp_module, uint32_t rtx_ssrc)
+  NackLoopBackTransport(uint32_t rtx_ssrc)
     : count_(0),
       packet_loss_(0),
       rtx_ssrc_(rtx_ssrc),
       count_rtx_ssrc_(0),
-      module_(rtp_rtcp_module) {
+      module_(NULL) {
+  }
+  void SetSendModule(RtpRtcp* rtpRtcpModule) {
+    module_ = rtpRtcpModule;
   }
   void DropEveryNthPacket(int n) {
     packet_loss_ = n;
@@ -95,9 +98,17 @@
   ~RtpRtcpNackTest() {}
 
   virtual void SetUp() {
-    video_module_ = RtpRtcp::CreateRtpRtcp(kTestId, false, &fake_clock);
-    EXPECT_EQ(0, video_module_->InitReceiver());
-    EXPECT_EQ(0, video_module_->InitSender());
+    transport_ = new NackLoopBackTransport(kTestSsrc + 1);
+    nack_receiver_ = new VerifyingNackReceiver();
+
+    RtpRtcp::Configuration configuration;
+    configuration.id = kTestId;
+    configuration.audio = false;
+    configuration.clock = &fake_clock;
+    configuration.incoming_data = nack_receiver_;
+    configuration.outgoing_transport = transport_;
+    video_module_ = RtpRtcp::CreateRtpRtcp(configuration);
+
     EXPECT_EQ(0, video_module_->SetRTCPStatus(kRtcpCompound));
     EXPECT_EQ(0, video_module_->SetSSRC(kTestSsrc));
     EXPECT_EQ(0, video_module_->SetNACKStatus(kNackRtcp));
@@ -106,11 +117,7 @@
     EXPECT_EQ(0, video_module_->SetSequenceNumber(kTestSequenceNumber));
     EXPECT_EQ(0, video_module_->SetStartTimestamp(111111));
 
-    transport_ = new NackLoopBackTransport(video_module_, kTestSsrc + 1);
-    EXPECT_EQ(0, video_module_->RegisterSendTransport(transport_));
-
-    nack_receiver_ = new VerifyingNackReceiver();
-    EXPECT_EQ(0, video_module_->RegisterIncomingDataCallback(nack_receiver_));
+    transport_->SetSendModule(video_module_);
 
     VideoCodec video_codec;
     memset(&video_codec, 0, sizeof(video_codec));
@@ -128,7 +135,7 @@
   }
 
   virtual void TearDown() {
-    RtpRtcp::DestroyRtpRtcp(video_module_);
+    delete video_module_;
     delete transport_;
     delete nack_receiver_;
   }
diff --git a/src/modules/rtp_rtcp/test/testAPI/test_api_rtcp.cc b/src/modules/rtp_rtcp/test/testAPI/test_api_rtcp.cc
index 9773620..bdf3c6b 100644
--- a/src/modules/rtp_rtcp/test/testAPI/test_api_rtcp.cc
+++ b/src/modules/rtp_rtcp/test/testAPI/test_api_rtcp.cc
@@ -24,7 +24,7 @@
 
 class RtcpCallback : public RtcpFeedback, public RtcpIntraFrameObserver {
  public:
-  RtcpCallback(RtpRtcp* module) {
+  void SetModule(RtpRtcp* module) {
     _rtpRtcpModule = module;
   };
   virtual void OnRTCPPacketTimeout(const WebRtc_Word32 id) {
@@ -85,32 +85,32 @@
   ~RtpRtcpRtcpTest() {}
 
   virtual void SetUp() {
-    module1 = RtpRtcp::CreateRtpRtcp(test_id, true, &fake_clock);
-    module2 = RtpRtcp::CreateRtpRtcp(test_id+1, true, &fake_clock);
-
-    EXPECT_EQ(0, module1->InitReceiver());
-    EXPECT_EQ(0, module1->InitSender());
-    EXPECT_EQ(0, module2->InitReceiver());
-    EXPECT_EQ(0, module2->InitSender());
     receiver = new RtpReceiver();
-    EXPECT_EQ(0, module2->RegisterIncomingDataCallback(receiver));
-    transport1 = new LoopBackTransport(module2);
-    EXPECT_EQ(0, module1->RegisterSendTransport(transport1));
-    transport2 = new LoopBackTransport(module1);
-    EXPECT_EQ(0, module2->RegisterSendTransport(transport2));
-  }
+    transport1 = new LoopBackTransport();
+    transport2 = new LoopBackTransport();
+    myRTCPFeedback1 = new RtcpCallback();
+    myRTCPFeedback2 = new RtcpCallback();
 
-  virtual void TearDown() {
-    RtpRtcp::DestroyRtpRtcp(module1);
-    RtpRtcp::DestroyRtpRtcp(module2);
-    delete transport1;
-    delete transport2;
-    delete receiver;
-  }
+    RtpRtcp::Configuration configuration;
+    configuration.id = test_id;
+    configuration.audio = false;
+    configuration.clock = &fake_clock;
+    configuration.outgoing_transport = transport1;
+    configuration.rtcp_feedback = myRTCPFeedback1;
+    configuration.intra_frame_callback = myRTCPFeedback1;
 
-  void SetUpCallFromModule1(RtcpCallback* feedback1, RtcpCallback* feedback2 ) {
-    module1->RegisterRtcpObservers(feedback1, NULL, feedback1);
-    module2->RegisterRtcpObservers(feedback2, NULL, feedback2);
+    module1 = RtpRtcp::CreateRtpRtcp(configuration);
+
+    configuration.id = test_id + 1;
+    configuration.outgoing_transport = transport2;
+    configuration.rtcp_feedback = myRTCPFeedback2;
+    configuration.intra_frame_callback = myRTCPFeedback2;
+    module2 = RtpRtcp::CreateRtpRtcp(configuration);
+
+    transport1->SetSendModule(module2);
+    transport2->SetSendModule(module1);
+    myRTCPFeedback1->SetModule(module1);
+    myRTCPFeedback2->SetModule(module2);
 
     EXPECT_EQ(0, module1->SetRTCPStatus(kRtcpCompound));
     EXPECT_EQ(0, module2->SetRTCPStatus(kRtcpCompound));
@@ -143,12 +143,23 @@
                                            0, test, 8));
   }
 
+  virtual void TearDown() {
+    delete module1;
+    delete module2;
+    delete transport1;
+    delete transport2;
+    delete receiver;
+  }
+
   int test_id;
   RtpRtcp* module1;
   RtpRtcp* module2;
   RtpReceiver* receiver;
   LoopBackTransport* transport1;
   LoopBackTransport* transport2;
+  RtcpCallback* myRTCPFeedback1;
+  RtcpCallback* myRTCPFeedback2;
+
   WebRtc_UWord32 test_ssrc;
   WebRtc_UWord32 test_timestamp;
   WebRtc_UWord16 test_sequence_number;
@@ -157,20 +168,11 @@
 };
 
 TEST_F(RtpRtcpRtcpTest, RTCP_PLI_RPSI) {
-  RtcpCallback* myRTCPFeedback1 = new RtcpCallback(module1);
-  RtcpCallback* myRTCPFeedback2 = new RtcpCallback(module2);
-
-  SetUpCallFromModule1(myRTCPFeedback1, myRTCPFeedback2);
-
   EXPECT_EQ(0, module1->SendRTCPReferencePictureSelection(kTestPictureId));
   EXPECT_EQ(0, module1->SendRTCPSliceLossIndication(156));
 }
 
 TEST_F(RtpRtcpRtcpTest, RTCP_CNAME) {
-  RtcpCallback* myRTCPFeedback1 = new RtcpCallback(module1);
-  RtcpCallback* myRTCPFeedback2 = new RtcpCallback(module2);
-
-  SetUpCallFromModule1(myRTCPFeedback1, myRTCPFeedback2);
   WebRtc_UWord32 testOfCSRC[webrtc::kRtpCsrcSize];
   EXPECT_EQ(2, module2->RemoteCSRCs(testOfCSRC));
   EXPECT_EQ(test_CSRC[0], testOfCSRC[0]);
@@ -210,10 +212,6 @@
 }
 
 TEST_F(RtpRtcpRtcpTest, RTCP) {
-  RtcpCallback* myRTCPFeedback1 = new RtcpCallback(module1);
-  RtcpCallback* myRTCPFeedback2 = new RtcpCallback(module2);
-
-  SetUpCallFromModule1(myRTCPFeedback1, myRTCPFeedback2);
   RTCPReportBlock reportBlock;
   reportBlock.cumulativeLost = 1;
   reportBlock.delaySinceLastSR = 2;
@@ -316,10 +314,6 @@
 TEST_F(RtpRtcpRtcpTest, RemoteRTCPStatRemote) {
   std::vector<RTCPReportBlock> report_blocks;
 
-  RtcpCallback feedback1(module1);
-  RtcpCallback feedback2(module2);
-
-  SetUpCallFromModule1(&feedback1, &feedback2);
   EXPECT_EQ(0, module1->RemoteRTCPStat(&report_blocks));
   EXPECT_EQ(0u, report_blocks.size());
 
diff --git a/src/modules/rtp_rtcp/test/testAPI/test_api_video.cc b/src/modules/rtp_rtcp/test/testAPI/test_api_video.cc
index 7a06ef7..c5b134a 100644
--- a/src/modules/rtp_rtcp/test/testAPI/test_api_video.cc
+++ b/src/modules/rtp_rtcp/test/testAPI/test_api_video.cc
@@ -1,5 +1,5 @@
 /*
- *  Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
+ *  Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
  *
  *  Use of this source code is governed by a BSD-style license
  *  that can be found in the LICENSE file in the root of the source
@@ -31,20 +31,24 @@
   ~RtpRtcpVideoTest() {}
 
   virtual void SetUp() {
-    video_module = RtpRtcp::CreateRtpRtcp(test_id, false, &fake_clock);
-    EXPECT_EQ(0, video_module->InitReceiver());
-    EXPECT_EQ(0, video_module->InitSender());
+    transport = new LoopBackTransport();
+    receiver = new RtpReceiver();
+    RtpRtcp::Configuration configuration;
+    configuration.id = test_id;
+    configuration.audio = false;
+    configuration.clock = &fake_clock;
+    configuration.incoming_data = receiver;
+    configuration.outgoing_transport = transport;
+
+    video_module = RtpRtcp::CreateRtpRtcp(configuration);
+
     EXPECT_EQ(0, video_module->SetRTCPStatus(kRtcpCompound));
     EXPECT_EQ(0, video_module->SetSSRC(test_ssrc));
     EXPECT_EQ(0, video_module->SetNACKStatus(kNackRtcp));
     EXPECT_EQ(0, video_module->SetStorePacketsStatus(true));
     EXPECT_EQ(0, video_module->SetSendingStatus(true));
 
-    transport = new LoopBackTransport(video_module);
-    EXPECT_EQ(0, video_module->RegisterSendTransport(transport));
-
-    receiver = new RtpReceiver();
-    EXPECT_EQ(0, video_module->RegisterIncomingDataCallback(receiver));
+    transport->SetSendModule(video_module);
 
     VideoCodec video_codec;
     memset(&video_codec, 0, sizeof(video_codec));
@@ -62,7 +66,7 @@
   }
 
   virtual void TearDown() {
-    RtpRtcp::DestroyRtpRtcp(video_module);
+    delete video_module;
     delete transport;
     delete receiver;
   }
diff --git a/src/modules/video_coding/main/test/generic_codec_test.cc b/src/modules/video_coding/main/test/generic_codec_test.cc
index 56b3c86..8d12325 100644
--- a/src/modules/video_coding/main/test/generic_codec_test.cc
+++ b/src/modules/video_coding/main/test/generic_codec_test.cc
@@ -1,5 +1,5 @@
 /*
- *  Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
+ *  Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
  *
  *  Use of this source code is governed by a BSD-style license
  *  that can be found in the LICENSE file in the root of the source
@@ -398,10 +398,14 @@
     /********************************/
     /* Encoder Packet Size Test     */
     /********************************/
-    RtpRtcp& rtpModule = *RtpRtcp::CreateRtpRtcp(1, false);
-    TEST(rtpModule.InitSender() == 0);
     RTPSendCallback_SizeTest sendCallback;
-    rtpModule.RegisterSendTransport(&sendCallback);
+
+    RtpRtcp::Configuration configuration;
+    configuration.id = 1;
+    configuration.audio = false;
+    configuration.outgoing_transport = &sendCallback;
+
+    RtpRtcp& rtpModule = *RtpRtcp::CreateRtpRtcp(configuration);
 
     VCMRTPEncodeCompleteCallback encCompleteCallback(&rtpModule);
     _vcm->InitializeSender();
@@ -485,7 +489,7 @@
         IncrementDebugClock(_frameRate);
     } // first frame encoded
 
-    RtpRtcp::DestroyRtpRtcp(&rtpModule);
+    delete &rtpModule;
     Print();
     delete tmpBuffer;
     delete _decodeCallback;
diff --git a/src/modules/video_coding/main/test/media_opt_test.cc b/src/modules/video_coding/main/test/media_opt_test.cc
index f7679197..b20fce8 100644
--- a/src/modules/video_coding/main/test/media_opt_test.cc
+++ b/src/modules/video_coding/main/test/media_opt_test.cc
@@ -1,5 +1,5 @@
 /*
- *  Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
+ *  Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
  *
  *  Use of this source code is governed by a BSD-style license
  *  that can be found in the LICENSE file in the root of the source
@@ -19,8 +19,6 @@
 #include <vector>
 
 #include "../source/event.h"
-#include "receiver_tests.h" // receive side callbacks
-#include "test_callbacks.h"
 #include "test_macros.h"
 #include "test_util.h" // send side callback
 #include "testsupport/metrics/video_metrics.h"
@@ -67,35 +65,34 @@
 }
 
 
-MediaOptTest::MediaOptTest(VideoCodingModule* vcm, TickTimeBase* clock):
-_vcm(vcm),
-_clock(clock),
-_width(0),
-_height(0),
-_lengthSourceFrame(0),
-_timeStamp(0),
-_frameRate(30.0f),
-_nackEnabled(false),
-_fecEnabled(false),
-_rttMS(0),
-_bitRate(300.0f),
-_lossRate(0.0f),
-_renderDelayMs(0),
-_frameCnt(0),
-_sumEncBytes(0),
-_numFramesDropped(0),
-_numberOfCores(4)
-{
-    _rtp = RtpRtcp::CreateRtpRtcp(1, false);
+MediaOptTest::MediaOptTest(VideoCodingModule* vcm, TickTimeBase* clock)
+    : _vcm(vcm),
+      _rtp(NULL),
+      _outgoingTransport(NULL),
+      _dataCallback(NULL),
+      _clock(clock),
+      _width(0),
+      _height(0),
+      _lengthSourceFrame(0),
+      _timeStamp(0),
+      _frameRate(30.0f),
+      _nackEnabled(false),
+      _fecEnabled(false),
+      _rttMS(0),
+      _bitRate(300.0f),
+      _lossRate(0.0f),
+      _renderDelayMs(0),
+      _frameCnt(0),
+      _sumEncBytes(0),
+      _numFramesDropped(0),
+      _numberOfCores(4) {
 }
 
-MediaOptTest::~MediaOptTest()
-{
-    RtpRtcp::DestroyRtpRtcp(_rtp);
+MediaOptTest::~MediaOptTest() {
+  delete _rtp;
 }
-void
-MediaOptTest::Setup(int testType, CmdArgs& args)
-{
+
+void MediaOptTest::Setup(int testType, CmdArgs& args) {
     /*TEST USER SETTINGS*/
     // test parameters
     _inname = args.inputFile;
@@ -168,7 +165,6 @@
    _lengthSourceFrame  = 3*_width*_height/2;
     _log.open((test::OutputPath() + "VCM_MediaOptLog.txt").c_str(),
               std::fstream::out | std::fstream::app);
-    return;
 }
 
 void
@@ -193,15 +189,6 @@
         printf("Cannot read file %s.\n", _actualSourcename.c_str());
         exit(1);
     }
-
-    if (_rtp->InitReceiver() < 0)
-    {
-        exit(1);
-    }
-    if (_rtp->InitSender() < 0)
-    {
-        exit(1);
-    }
     if (_vcm->InitializeReceiver() < 0)
     {
         exit(1);
@@ -210,6 +197,17 @@
     {
         exit(1);
     }
+    _outgoingTransport = new RTPSendCompleteCallback(_clock);
+    _dataCallback = new RtpDataCallback(_vcm);
+
+    RtpRtcp::Configuration configuration;
+    configuration.id = 1;
+    configuration.audio = false;
+    configuration.incoming_data = _dataCallback;
+    configuration.outgoing_transport = _outgoingTransport;
+    _rtp = RtpRtcp::CreateRtpRtcp(configuration);
+
+    _outgoingTransport->SetRtpModule(_rtp);
 
     // Registering codecs for the RTP module
 
@@ -262,8 +260,6 @@
 
     _vcm->SetRenderDelay(_renderDelayMs);
     _vcm->SetMinimumPlayoutDelay(minPlayoutDelayMs);
-
-    return;
 }
 // The following test shall be conducted under release tests
 
@@ -272,33 +268,23 @@
 WebRtc_Word32
 MediaOptTest::Perform()
 {
-    //Setup();
-    EventWrapper* waitEvent = EventWrapper::Create();
+    VCMDecodeCompleteCallback receiveCallback(_decodedFile);
 
-    // callback settings
     VCMRTPEncodeCompleteCallback* encodeCompleteCallback = new VCMRTPEncodeCompleteCallback(_rtp);
     _vcm->RegisterTransportCallback(encodeCompleteCallback);
     encodeCompleteCallback->SetCodecType(ConvertCodecType(_codecName.c_str()));
     encodeCompleteCallback->SetFrameDimensions(_width, _height);
-    // frame ready to be sent to network
-    RTPSendCompleteCallback* outgoingTransport =
-        new RTPSendCompleteCallback(_rtp, _clock);
-    _rtp->RegisterSendTransport(outgoingTransport);
-    //FrameReceiveCallback
-    VCMDecodeCompleteCallback receiveCallback(_decodedFile);
-    RtpDataCallback dataCallback(_vcm);
-    _rtp->RegisterIncomingDataCallback(&dataCallback);
 
+    // callback settings
     VideoProtectionCallback  protectionCallback;
     protectionCallback.RegisterRtpModule(_rtp);
     _vcm->RegisterProtectionCallback(&protectionCallback);
 
     // set error resilience / test parameters:
-    outgoingTransport->SetLossPct(_lossRate);
-    if (_nackFecEnabled == 1)
+    _outgoingTransport->SetLossPct(_lossRate);
+    if (_nackFecEnabled == 1) {
         _vcm->SetVideoProtection(kProtectionNackFEC, _nackFecEnabled);
-    else
-    {
+    } else {
         _vcm->SetVideoProtection(kProtectionNack, _nackEnabled);
         _vcm->SetVideoProtection(kProtectionFEC, _fecEnabled);
     }
@@ -349,13 +335,10 @@
         }
 
         _sumEncBytes += encBytes;
-         //waitEvent->Wait(33);
     }
 
     //END TEST
-    delete waitEvent;
     delete encodeCompleteCallback;
-    delete outgoingTransport;
     delete tmpBuffer;
 
 return 0;
@@ -441,17 +424,10 @@
 
                 printf("**FOR RUN: **%d %d %d %d \n",_nackEnabled,_fecEnabled,int(lossPctVec[j]),int(_bitRate));
                */
-                 if (_rtp != NULL)
-                 {
-                     RtpRtcp::DestroyRtpRtcp(_rtp);
-                 }
-                 _rtp = RtpRtcp::CreateRtpRtcp(1, false);
                  GeneralSetup();
                  Perform();
                  Print(1);
                  TearDown();
-                 RtpRtcp::DestroyRtpRtcp(_rtp);
-                 _rtp = NULL;
 
                  printf("\n");
                   //printf("**DONE WITH RUN: **%d %d %f %d \n",_nackEnabled,_fecEnabled,lossPctVec[j],int(_bitRate));
@@ -549,12 +525,15 @@
     TEST(psnr.average > 10); // low becuase of possible frame dropping (need to verify that OK for all packet loss values/ rates)
 }
 
-void
-MediaOptTest::TearDown()
-{
-    _log.close();
-    fclose(_sourceFile);
-    fclose(_decodedFile);
-    fclose(_actualSourceFile);
-    return;
+void MediaOptTest::TearDown() {
+  delete _rtp;
+  _rtp = NULL;
+  delete _outgoingTransport;
+  _outgoingTransport = NULL;
+  delete _dataCallback;
+  _dataCallback = NULL;
+  _log.close();
+  fclose(_sourceFile);
+  fclose(_decodedFile);
+  fclose(_actualSourceFile);
 }
diff --git a/src/modules/video_coding/main/test/media_opt_test.h b/src/modules/video_coding/main/test/media_opt_test.h
index 7d4e226..5f210e6 100644
--- a/src/modules/video_coding/main/test/media_opt_test.h
+++ b/src/modules/video_coding/main/test/media_opt_test.h
@@ -1,5 +1,5 @@
 /*
- *  Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
+ *  Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
  *
  *  Use of this source code is governed by a BSD-style license
  *  that can be found in the LICENSE file in the root of the source
@@ -15,7 +15,9 @@
 
 #include <string>
 
+#include "receiver_tests.h"  // receive side callbacks
 #include "rtp_rtcp.h"
+#include "test_callbacks.h"
 #include "test_util.h"
 #include "video_coding.h"
 #include "video_source.h"
@@ -52,6 +54,9 @@
 
     webrtc::VideoCodingModule*       _vcm;
     webrtc::RtpRtcp*                 _rtp;
+    webrtc::RTPSendCompleteCallback* _outgoingTransport;
+    RtpDataCallback*                 _dataCallback;
+
     webrtc::TickTimeBase*            _clock;
     std::string                      _inname;
     std::string                      _outname;
diff --git a/src/modules/video_coding/main/test/mt_rx_tx_test.cc b/src/modules/video_coding/main/test/mt_rx_tx_test.cc
index dc20b32..3eac939 100644
--- a/src/modules/video_coding/main/test/mt_rx_tx_test.cc
+++ b/src/modules/video_coding/main/test/mt_rx_tx_test.cc
@@ -138,17 +138,20 @@
         printf("Cannot read file %s.\n", outname.c_str());
         return -1;
     }
+    TickTimeBase clock;
+    VideoCodingModule* vcm = VideoCodingModule::Create(1, &clock);
+    RtpDataCallback dataCallback(vcm);
 
-    //RTP
-    RtpRtcp* rtp = RtpRtcp::CreateRtpRtcp(1, false);
-    if (rtp->InitReceiver() < 0)
-    {
-        return -1;
-    }
-    if (rtp->InitSender() < 0)
-    {
-        return -1;
-    }
+    RTPSendCompleteCallback* outgoingTransport =
+        new RTPSendCompleteCallback(&clock, "dump.rtp");
+
+    RtpRtcp::Configuration configuration;
+    configuration.id = 1;
+    configuration.audio = false;
+    configuration.incoming_data = &dataCallback;
+    configuration.outgoing_transport = outgoingTransport;
+    RtpRtcp* rtp = RtpRtcp::CreateRtpRtcp(configuration);
+
     // registering codecs for the RTP module
     VideoCodec videoCodec;
     strncpy(videoCodec.plName, "ULPFEC", 32);
@@ -170,8 +173,6 @@
     TEST(rtp->SetGenericFECStatus(fecEnabled, VCM_RED_PAYLOAD_TYPE, VCM_ULPFEC_PAYLOAD_TYPE) == 0);
 
     //VCM
-    TickTimeBase clock;
-    VideoCodingModule* vcm = VideoCodingModule::Create(1, &clock);
     if (vcm->InitializeReceiver() < 0)
     {
         return -1;
@@ -216,13 +217,8 @@
     encodeCompleteCallback->SetCodecType(ConvertCodecType(args.codecName.c_str()));
     encodeCompleteCallback->SetFrameDimensions(width, height);
     // frame ready to be sent to network
-    RTPSendCompleteCallback* outgoingTransport =
-        new RTPSendCompleteCallback(rtp, &clock, "dump.rtp");
-    rtp->RegisterSendTransport(outgoingTransport);
-    // FrameReceiveCallback
+
     VCMDecodeCompleteCallback receiveCallback(decodedFile);
-    RtpDataCallback dataCallback(vcm);
-    rtp->RegisterIncomingDataCallback(&dataCallback);
     vcm->RegisterReceiveCallback(&receiveCallback);
 
     VideoProtectionCallback protectionCallback;
@@ -351,7 +347,7 @@
     delete encodeCompleteCallback;
     delete outgoingTransport;
     VideoCodingModule::Destroy(vcm);
-    RtpRtcp::DestroyRtpRtcp(rtp);
+    delete rtp;
     rtp = NULL;
     vcm = NULL;
     Trace::ReturnTrace();
diff --git a/src/modules/video_coding/main/test/mt_test_common.cc b/src/modules/video_coding/main/test/mt_test_common.cc
index e3ebd97..ece0d9c 100644
--- a/src/modules/video_coding/main/test/mt_test_common.cc
+++ b/src/modules/video_coding/main/test/mt_test_common.cc
@@ -17,12 +17,8 @@
 
 namespace webrtc {
 
-TransportCallback::TransportCallback(webrtc::RtpRtcp* rtp,
-                                     TickTimeBase* clock,
-                                     const char* filename):
-RTPSendCompleteCallback(rtp, clock, filename)
-{
-    //
+TransportCallback::TransportCallback(TickTimeBase* clock, const char* filename)
+    : RTPSendCompleteCallback(clock, filename) {
 }
 
 TransportCallback::~TransportCallback()
diff --git a/src/modules/video_coding/main/test/mt_test_common.h b/src/modules/video_coding/main/test/mt_test_common.h
index 438f0be..c17d269 100644
--- a/src/modules/video_coding/main/test/mt_test_common.h
+++ b/src/modules/video_coding/main/test/mt_test_common.h
@@ -1,5 +1,5 @@
 /*
- *  Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
+ *  Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
  *
  *  Use of this source code is governed by a BSD-style license
  *  that can be found in the LICENSE file in the root of the source
@@ -47,8 +47,7 @@
 {
  public:
     // constructor input: (receive side) rtp module to send encoded data to
-    TransportCallback(webrtc::RtpRtcp* rtp, TickTimeBase* clock,
-                      const char* filename = NULL);
+    TransportCallback(TickTimeBase* clock, const char* filename = NULL);
     virtual ~TransportCallback();
     // Add packets to list
     // Incorporate network conditions - delay and packet loss
diff --git a/src/modules/video_coding/main/test/receiver_tests.h b/src/modules/video_coding/main/test/receiver_tests.h
index 33d9f5f..cb45ca1 100644
--- a/src/modules/video_coding/main/test/receiver_tests.h
+++ b/src/modules/video_coding/main/test/receiver_tests.h
@@ -1,5 +1,5 @@
 /*
- *  Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
+ *  Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
  *
  *  Use of this source code is governed by a BSD-style license
  *  that can be found in the LICENSE file in the root of the source
diff --git a/src/modules/video_coding/main/test/rtp_player.cc b/src/modules/video_coding/main/test/rtp_player.cc
index 5361e31..9eacf34 100644
--- a/src/modules/video_coding/main/test/rtp_player.cc
+++ b/src/modules/video_coding/main/test/rtp_player.cc
@@ -140,7 +140,7 @@
                      TickTimeBase* clock)
 :
 _clock(clock),
-_rtpModule(*RtpRtcp::CreateRtpRtcp(1, false)),
+_rtpModule(NULL),
 _nextRtpTime(0),
 _dataCallback(callback),
 _firstPacket(true),
@@ -165,7 +165,7 @@
 
 RTPPlayer::~RTPPlayer()
 {
-    RtpRtcp::DestroyRtpRtcp(&_rtpModule);
+    delete _rtpModule;
     if (_rtpFile != NULL)
     {
         fclose(_rtpFile);
@@ -179,28 +179,26 @@
 
 WebRtc_Word32 RTPPlayer::Initialize(const PayloadTypeList* payloadList)
 {
+    RtpRtcp::Configuration configuration;
+    configuration.id = 1;
+    configuration.audio = false;
+    configuration.incoming_data = _dataCallback;
+    _rtpModule = RtpRtcp::CreateRtpRtcp(configuration);
+
     std::srand(321);
     for (int i=0; i < RAND_VEC_LENGTH; i++)
     {
         _randVec[i] = rand();
     }
     _randVecPos = 0;
-    WebRtc_Word32 ret = _rtpModule.SetNACKStatus(kNackOff);
+    WebRtc_Word32 ret = _rtpModule->SetNACKStatus(kNackOff);
     if (ret < 0)
     {
         return -1;
     }
-    ret = _rtpModule.InitReceiver();
-    if (ret < 0)
-    {
-        return -1;
-    }
+    _rtpModule->SetRTCPStatus(kRtcpNonCompound);
+    _rtpModule->SetTMMBRStatus(true);
 
-    _rtpModule.InitSender();
-    _rtpModule.SetRTCPStatus(kRtcpNonCompound);
-    _rtpModule.SetTMMBRStatus(true);
-
-    ret = _rtpModule.RegisterIncomingDataCallback(_dataCallback);
     if (ret < 0)
     {
         return -1;
@@ -214,7 +212,7 @@
             VideoCodec videoCodec;
             strncpy(videoCodec.plName, payloadType->name.c_str(), 32);
             videoCodec.plType = payloadType->payloadType;
-            if (_rtpModule.RegisterReceivePayload(videoCodec) < 0)
+            if (_rtpModule->RegisterReceivePayload(videoCodec) < 0)
             {
                 return -1;
             }
@@ -305,7 +303,7 @@
     // Send any packets from rtp file
     if (!_endOfFile && (TimeUntilNextPacket() == 0 || _firstPacket))
     {
-        _rtpModule.Process();
+        _rtpModule->Process();
         if (_firstPacket)
         {
             _firstPacketRtpTime = static_cast<WebRtc_Word64>(_nextRtpTime);
@@ -362,7 +360,7 @@
     }
     else if (rtpLen > 0)
     {
-        WebRtc_Word32 ret = _rtpModule.IncomingPacket(rtpData, rtpLen);
+        WebRtc_Word32 ret = _rtpModule->IncomingPacket(rtpData, rtpLen);
         if (ret < 0)
         {
             return -1;
diff --git a/src/modules/video_coding/main/test/rtp_player.h b/src/modules/video_coding/main/test/rtp_player.h
index eac6ba8..9920d0c 100644
--- a/src/modules/video_coding/main/test/rtp_player.h
+++ b/src/modules/video_coding/main/test/rtp_player.h
@@ -95,7 +95,7 @@
     WebRtc_Word32 ReadHeader();
     webrtc::TickTimeBase* _clock;
     FILE*              _rtpFile;
-    webrtc::RtpRtcp&   _rtpModule;
+    webrtc::RtpRtcp*   _rtpModule;
     WebRtc_UWord32     _nextRtpTime;
     webrtc::RtpData*   _dataCallback;
     bool               _firstPacket;
diff --git a/src/modules/video_coding/main/test/test_callbacks.cc b/src/modules/video_coding/main/test/test_callbacks.cc
index da28073..348cbcc 100644
--- a/src/modules/video_coding/main/test/test_callbacks.cc
+++ b/src/modules/video_coding/main/test/test_callbacks.cc
@@ -195,12 +195,11 @@
     return _decodedBytes;
 }
 
-RTPSendCompleteCallback::RTPSendCompleteCallback(RtpRtcp* rtp,
-                                                 TickTimeBase* clock,
+RTPSendCompleteCallback::RTPSendCompleteCallback(TickTimeBase* clock,
                                                  const char* filename):
     _clock(clock),
     _sendCount(0),
-    _rtp(rtp),
+    _rtp(NULL),
     _lossPct(0),
     _burstLength(0),
     _networkDelayMs(0),
@@ -282,6 +281,7 @@
         }
 
         _rtpPackets.pop_front();
+        assert(_rtp);  // We must have a configured RTP module for this test.
         // Send to receive side
         if (_rtp->IncomingPacket((const WebRtc_UWord8*)packet->data,
                                  packet->length) < 0)
diff --git a/src/modules/video_coding/main/test/test_callbacks.h b/src/modules/video_coding/main/test/test_callbacks.h
index 2c25931..9f179e2 100644
--- a/src/modules/video_coding/main/test/test_callbacks.h
+++ b/src/modules/video_coding/main/test/test_callbacks.h
@@ -155,9 +155,11 @@
 {
 public:
     // Constructor input: (receive side) rtp module to send encoded data to
-    RTPSendCompleteCallback(RtpRtcp* rtp, TickTimeBase* clock,
+    RTPSendCompleteCallback(TickTimeBase* clock,
                             const char* filename = NULL);
     virtual ~RTPSendCompleteCallback();
+
+    void SetRtpModule(RtpRtcp* rtp_module) { _rtp = rtp_module; }
     // Send Packet to receive side RTP module
     virtual int SendPacket(int channel, const void *data, int len);
     // Send RTCP Packet to receive side RTP module
diff --git a/src/video_engine/vie_channel.cc b/src/video_engine/vie_channel.cc
index 6e242fb..fcd1e30 100644
--- a/src/video_engine/vie_channel.cc
+++ b/src/video_engine/vie_channel.cc
@@ -27,9 +27,6 @@
 #include "video_engine/include/vie_image_process.h"
 #include "video_engine/include/vie_rtp_rtcp.h"
 #include "video_engine/vie_defines.h"
-#include "video_engine/vie_receiver.h"
-#include "video_engine/vie_sender.h"
-#include "video_engine/vie_sync_module.h"
 
 namespace webrtc {
 
@@ -40,25 +37,25 @@
                        WebRtc_UWord32 number_of_cores,
                        ProcessThread& module_process_thread,
                        RtcpIntraFrameObserver* intra_frame_observer,
-                       RtcpBandwidthObserver* bandwidth_observer)
+                       RtcpBandwidthObserver* bandwidth_observer,
+                       RtpRemoteBitrateObserver* bitrate_observer,
+                       RtpRtcp* default_rtp_rtcp)
     : ViEFrameProviderBase(channel_id, engine_id),
       channel_id_(channel_id),
       engine_id_(engine_id),
       number_of_cores_(number_of_cores),
       num_socket_threads_(kViESocketThreads),
       callback_cs_(CriticalSectionWrapper::CreateCriticalSection()),
-      rtp_rtcp_(*RtpRtcp::CreateRtpRtcp(ViEModuleId(engine_id, channel_id),
-                                        false)),
-      default_rtp_rtcp_(NULL),
+      default_rtp_rtcp_(default_rtp_rtcp),
+      rtp_rtcp_(NULL),
 #ifndef WEBRTC_EXTERNAL_TRANSPORT
       socket_transport_(*UdpTransport::Create(
           ViEModuleId(engine_id, channel_id), num_socket_threads_)),
 #endif
       vcm_(*VideoCodingModule::Create(ViEModuleId(engine_id, channel_id))),
-      vie_receiver_(*(new ViEReceiver(engine_id, channel_id, rtp_rtcp_, vcm_))),
-      vie_sender_(*(new ViESender(engine_id, channel_id))),
-      vie_sync_(*(new ViESyncModule(ViEId(engine_id, channel_id), vcm_,
-                                    rtp_rtcp_))),
+      vie_receiver_(channel_id, &vcm_),
+      vie_sender_(channel_id),
+      vie_sync_(channel_id, &vcm_),
       module_process_thread_(module_process_thread),
       codec_observer_(NULL),
       do_key_frame_callbackRequest_(false),
@@ -82,62 +79,47 @@
   WEBRTC_TRACE(kTraceMemory, kTraceVideo, ViEId(engine_id, channel_id),
                "ViEChannel::ViEChannel(channel_id: %d, engine_id: %d)",
                channel_id, engine_id);
+
+  RtpRtcp::Configuration configuration;
+  configuration.id = ViEModuleId(engine_id, channel_id);
+  configuration.audio = false;
+  configuration.default_module = default_rtp_rtcp;
+  configuration.incoming_data = &vie_receiver_;
+  configuration.incoming_messages = this;
+  configuration.outgoing_transport = &vie_sender_;
+  configuration.rtcp_feedback = this;
+  configuration.intra_frame_callback = intra_frame_observer;
+  configuration.bandwidth_callback = bandwidth_observer;
+  configuration.bitrate_observer = bitrate_observer;
+
+  rtp_rtcp_.reset(RtpRtcp::CreateRtpRtcp(configuration));
+  vie_receiver_.SetRtpRtcpModule(rtp_rtcp_.get());
 }
 
 WebRtc_Word32 ViEChannel::Init() {
   WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_),
                "%s: channel_id: %d, engine_id: %d)", __FUNCTION__, channel_id_,
                engine_id_);
+
   // RTP/RTCP initialization.
-  if (rtp_rtcp_.InitSender() != 0) {
-    WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_),
-                 "%s: RTP::InitSender failure", __FUNCTION__);
-    return -1;
-  }
-  if (rtp_rtcp_.SetSendingMediaStatus(false) != 0) {
+  if (rtp_rtcp_->SetSendingMediaStatus(false) != 0) {
     WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_),
                  "%s: RTP::SetSendingMediaStatus failure", __FUNCTION__);
     return -1;
   }
-  if (rtp_rtcp_.InitReceiver() != 0) {
-    WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_),
-                 "%s: RTP::InitReceiver failure", __FUNCTION__);
-    return -1;
-  }
-  if (rtp_rtcp_.RegisterIncomingDataCallback(
-      static_cast<RtpData*>(&vie_receiver_)) != 0) {
-    WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_),
-                 "%s: RTP::RegisterIncomingDataCallback failure", __FUNCTION__);
-    return -1;
-  }
-  if (rtp_rtcp_.RegisterSendTransport(
-      static_cast<Transport*>(&vie_sender_)) != 0) {
-    WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_),
-                 "%s: RTP::RegisterSendTransport failure", __FUNCTION__);
-    return -1;
-  }
-  rtp_rtcp_.RegisterRtcpObservers(intra_frame_observer_,
-                                  bandwidth_observer_.get(),
-                                  this);
-
-  if (module_process_thread_.RegisterModule(&rtp_rtcp_) != 0) {
+  if (module_process_thread_.RegisterModule(rtp_rtcp_.get()) != 0) {
     WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_),
                  "%s: RTP::RegisterModule failure", __FUNCTION__);
     return -1;
   }
-  if (rtp_rtcp_.SetKeyFrameRequestMethod(kKeyFrameReqFirRtp) != 0) {
+  if (rtp_rtcp_->SetKeyFrameRequestMethod(kKeyFrameReqFirRtp) != 0) {
     WEBRTC_TRACE(kTraceWarning, kTraceVideo, ViEId(engine_id_, channel_id_),
                  "%s: RTP::SetKeyFrameRequestMethod failure", __FUNCTION__);
   }
-  if (rtp_rtcp_.SetRTCPStatus(kRtcpCompound) != 0) {
+  if (rtp_rtcp_->SetRTCPStatus(kRtcpCompound) != 0) {
     WEBRTC_TRACE(kTraceWarning, kTraceVideo, ViEId(engine_id_, channel_id_),
                  "%s: RTP::SetRTCPStatus failure", __FUNCTION__);
   }
-  if (rtp_rtcp_.RegisterIncomingRTPCallback(this) != 0) {
-    WEBRTC_TRACE(kTraceWarning, kTraceVideo, ViEId(engine_id_, channel_id_),
-                 "%s: RTP::RegisterIncomingRTPCallback failure", __FUNCTION__);
-    return -1;
-  }
   // VCM initialization
   if (vcm_.InitializeReceiver() != 0) {
     WEBRTC_TRACE(kTraceError, kTraceVideo,
@@ -171,11 +153,11 @@
 #ifdef VIDEOCODEC_VP8
   VideoCodec video_codec;
   if (vcm_.Codec(kVideoCodecVP8, &video_codec) == VCM_OK) {
-    rtp_rtcp_.RegisterSendPayload(video_codec);
-    rtp_rtcp_.RegisterReceivePayload(video_codec);
+    rtp_rtcp_->RegisterSendPayload(video_codec);
+    rtp_rtcp_->RegisterReceivePayload(video_codec);
     vcm_.RegisterReceiveCodec(&video_codec, number_of_cores_);
     vcm_.RegisterSendCodec(&video_codec, number_of_cores_,
-                           rtp_rtcp_.MaxDataPayloadLength());
+                           rtp_rtcp_->MaxDataPayloadLength());
   } else {
     assert(false);
   }
@@ -190,32 +172,23 @@
                channel_id_, engine_id_);
 
   // Make sure we don't get more callbacks from the RTP module.
-  rtp_rtcp_.RegisterIncomingRTPCallback(NULL);
-  rtp_rtcp_.RegisterSendTransport(NULL);
 #ifndef WEBRTC_EXTERNAL_TRANSPORT
   socket_transport_.StopReceiving();
 #endif
-  module_process_thread_.DeRegisterModule(&rtp_rtcp_);
+  module_process_thread_.DeRegisterModule(rtp_rtcp_.get());
   module_process_thread_.DeRegisterModule(&vcm_);
   module_process_thread_.DeRegisterModule(&vie_sync_);
   while (simulcast_rtp_rtcp_.size() > 0) {
     std::list<RtpRtcp*>::iterator it = simulcast_rtp_rtcp_.begin();
     RtpRtcp* rtp_rtcp = *it;
-    rtp_rtcp->RegisterSendTransport(NULL);
     module_process_thread_.DeRegisterModule(rtp_rtcp);
-    RtpRtcp::DestroyRtpRtcp(rtp_rtcp);
+    delete rtp_rtcp;
     simulcast_rtp_rtcp_.erase(it);
   }
   if (decode_thread_) {
     StopDecodeThread();
   }
-
-  delete &vie_receiver_;
-  delete &vie_sender_;
-  delete &vie_sync_;
-
   // Release modules.
-  RtpRtcp::DestroyRtpRtcp(&rtp_rtcp_);
 #ifndef WEBRTC_EXTERNAL_TRANSPORT
   UdpTransport::Destroy(&socket_transport_);
 #endif
@@ -243,9 +216,9 @@
   // Stop and Start the RTP module -> trigger new SSRC, if an SSRC hasn't been
   // set explicitly.
   bool restart_rtp = false;
-  if (rtp_rtcp_.Sending() && new_stream) {
+  if (rtp_rtcp_->Sending() && new_stream) {
     restart_rtp = true;
-    rtp_rtcp_.SetSendingStatus(false);
+    rtp_rtcp_->SetSendingStatus(false);
   }
   if (video_codec.numberOfSimulcastStreams > 0) {
     // Set correct bitrate to base layer.
@@ -253,36 +226,19 @@
     for (int i = simulcast_rtp_rtcp_.size();
          i < video_codec.numberOfSimulcastStreams - 1;
          i++) {
-      RtpRtcp* rtp_rtcp = RtpRtcp::CreateRtpRtcp(
-          ViEModuleId(engine_id_, channel_id_), false);
-      if (rtp_rtcp->RegisterDefaultModule(default_rtp_rtcp_)) {
-        WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_),
-                     "%s: could not register default module", __FUNCTION__);
-        return -1;
-      }
-      if (rtp_rtcp->InitSender() != 0) {
-        WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_),
-                     "%s: RTP::InitSender failure", __FUNCTION__);
-        return -1;
-      }
-      if (rtp_rtcp->InitReceiver() != 0) {
-        WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_),
-                     "%s: RTP::InitReceiver failure", __FUNCTION__);
-        return -1;
-      }
-      rtp_rtcp->RegisterRtcpObservers(intra_frame_observer_,
-                                      bandwidth_observer_.get(),
-                                      this);
+      RtpRtcp::Configuration configuration;
+      configuration.id = ViEModuleId(engine_id_, channel_id_);
+      configuration.audio = false;  // Video.
+      configuration.default_module = default_rtp_rtcp_;
+      configuration.outgoing_transport = &vie_sender_;
+      configuration.intra_frame_callback = intra_frame_observer_;
+      configuration.bandwidth_callback = bandwidth_observer_.get();
 
-      if (rtp_rtcp->RegisterSendTransport(
-          static_cast<Transport*>(&vie_sender_)) != 0) {
-        WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_),
-                     "%s: RTP::RegisterSendTransport failure", __FUNCTION__);
-        return -1;
-      }
+      RtpRtcp* rtp_rtcp = RtpRtcp::CreateRtpRtcp(configuration);
+
       // Silently ignore error.
       module_process_thread_.RegisterModule(rtp_rtcp);
-      if (rtp_rtcp->SetRTCPStatus(rtp_rtcp_.RTCP()) != 0) {
+      if (rtp_rtcp->SetRTCPStatus(rtp_rtcp_->RTCP()) != 0) {
         WEBRTC_TRACE(kTraceWarning, kTraceVideo, ViEId(engine_id_, channel_id_),
                      "%s: RTP::SetRTCPStatus failure", __FUNCTION__);
       }
@@ -293,9 +249,8 @@
          j > (video_codec.numberOfSimulcastStreams - 1);
          j--) {
       RtpRtcp* rtp_rtcp = simulcast_rtp_rtcp_.back();
-      rtp_rtcp->RegisterSendTransport(NULL);
       module_process_thread_.DeRegisterModule(rtp_rtcp);
-      RtpRtcp::DestroyRtpRtcp(rtp_rtcp);
+      delete rtp_rtcp;
       simulcast_rtp_rtcp_.pop_back();
     }
     WebRtc_UWord8 idx = 0;
@@ -324,9 +279,8 @@
       // Delete all simulcast rtp modules.
       while (!simulcast_rtp_rtcp_.empty()) {
         RtpRtcp* rtp_rtcp = simulcast_rtp_rtcp_.back();
-        rtp_rtcp->RegisterSendTransport(NULL);
         module_process_thread_.DeRegisterModule(rtp_rtcp);
-        RtpRtcp::DestroyRtpRtcp(rtp_rtcp);
+        delete rtp_rtcp;
         simulcast_rtp_rtcp_.pop_back();
       }
     }
@@ -337,25 +291,25 @@
   // This sets the wanted packetization mode.
   // if (video_codec.plType == kVideoCodecH264) {
   //   if (video_codec.codecSpecific.H264.packetization ==  kH264SingleMode) {
-  //     rtp_rtcp_.SetH264PacketizationMode(H264_SINGLE_NAL_MODE);
+  //     rtp_rtcp_->SetH264PacketizationMode(H264_SINGLE_NAL_MODE);
   //   } else {
-  //     rtp_rtcp_.SetH264PacketizationMode(H264_NON_INTERLEAVED_MODE);
+  //     rtp_rtcp_->SetH264PacketizationMode(H264_NON_INTERLEAVED_MODE);
   //   }
   //   if (video_codec.codecSpecific.H264.configParametersSize > 0) {
-  //     rtp_rtcp_.SetH264SendModeNALU_PPS_SPS(true);
+  //     rtp_rtcp_->SetH264SendModeNALU_PPS_SPS(true);
   //   }
   // }
 
   // Don't log this error, no way to check in advance if this pl_type is
   // registered or not...
-  rtp_rtcp_.DeRegisterSendPayload(video_codec.plType);
-  if (rtp_rtcp_.RegisterSendPayload(video_codec) != 0) {
+  rtp_rtcp_->DeRegisterSendPayload(video_codec.plType);
+  if (rtp_rtcp_->RegisterSendPayload(video_codec) != 0) {
     WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_),
                  "%s: could not register payload type", __FUNCTION__);
     return -1;
   }
   if (restart_rtp) {
-    rtp_rtcp_.SetSendingStatus(true);
+    rtp_rtcp_->SetSendingStatus(true);
   }
   return 0;
 }
@@ -366,11 +320,11 @@
                "%s", __FUNCTION__);
 
   WebRtc_Word8 old_pltype = -1;
-  if (rtp_rtcp_.ReceivePayloadType(video_codec, &old_pltype) != -1) {
-    rtp_rtcp_.DeRegisterReceivePayload(old_pltype);
+  if (rtp_rtcp_->ReceivePayloadType(video_codec, &old_pltype) != -1) {
+    rtp_rtcp_->DeRegisterReceivePayload(old_pltype);
   }
 
-  if (rtp_rtcp_.RegisterReceivePayload(video_codec) != 0) {
+  if (rtp_rtcp_->RegisterReceivePayload(video_codec) != 0) {
     WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_),
                  "%s: Could not register receive payload type", __FUNCTION__);
     return -1;
@@ -527,13 +481,13 @@
     RtpRtcp* rtp_rtcp = *it;
     rtp_rtcp->SetRTCPStatus(rtcp_mode);
   }
-  return rtp_rtcp_.SetRTCPStatus(rtcp_mode);
+  return rtp_rtcp_->SetRTCPStatus(rtcp_mode);
 }
 
 WebRtc_Word32 ViEChannel::GetRTCPMode(RTCPMethod& rtcp_mode) {
   WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_),
                "%s", __FUNCTION__);
-  rtcp_mode = rtp_rtcp_.RTCP();
+  rtcp_mode = rtp_rtcp_->RTCP();
   return 0;
 }
 
@@ -569,12 +523,12 @@
   if (enable) {
     // Turn on NACK.
     NACKMethod nackMethod = kNackRtcp;
-    if (rtp_rtcp_.RTCP() == kRtcpOff) {
+    if (rtp_rtcp_->RTCP() == kRtcpOff) {
       WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_),
                    "%s: Could not enable NACK, RTPC not on ", __FUNCTION__);
       return -1;
     }
-    if (rtp_rtcp_.SetNACKStatus(nackMethod) != 0) {
+    if (rtp_rtcp_->SetNACKStatus(nackMethod) != 0) {
       WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_),
                    "%s: Could not set NACK method %d", __FUNCTION__,
                    nackMethod);
@@ -582,7 +536,7 @@
     }
     WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_),
                  "%s: Using NACK method %d", __FUNCTION__, nackMethod);
-    rtp_rtcp_.SetStorePacketsStatus(true, kNackHistorySize);
+    rtp_rtcp_->SetStorePacketsStatus(true, kNackHistorySize);
 
     vcm_.RegisterPacketRequestCallback(this);
 
@@ -599,9 +553,9 @@
       RtpRtcp* rtp_rtcp = *it;
       rtp_rtcp->SetStorePacketsStatus(false);
     }
-    rtp_rtcp_.SetStorePacketsStatus(false);
+    rtp_rtcp_->SetStorePacketsStatus(false);
     vcm_.RegisterPacketRequestCallback(NULL);
-    if (rtp_rtcp_.SetNACKStatus(kNackOff) != 0) {
+    if (rtp_rtcp_->SetNACKStatus(kNackOff) != 0) {
       WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_),
                    "%s: Could not turn off NACK", __FUNCTION__);
       return -1;
@@ -629,7 +583,7 @@
                "%s(enable: %d, payload_typeRED: %u, payload_typeFEC: %u)",
                __FUNCTION__, enable, payload_typeRED, payload_typeFEC);
 
-  if (rtp_rtcp_.SetGenericFECStatus(enable, payload_typeRED,
+  if (rtp_rtcp_->SetGenericFECStatus(enable, payload_typeRED,
                                     payload_typeFEC) != 0) {
     WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_),
                  "%s: Could not change FEC status to %d", __FUNCTION__,
@@ -669,13 +623,13 @@
     const KeyFrameRequestMethod method) {
   WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_),
                "%s: %d", __FUNCTION__, method);
-  return rtp_rtcp_.SetKeyFrameRequestMethod(method);
+  return rtp_rtcp_->SetKeyFrameRequestMethod(method);
 }
 
 bool ViEChannel::EnableRemb(bool enable) {
   WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_),
                "ViEChannel::EnableRemb: %d", enable);
-  if (rtp_rtcp_.SetREMBStatus(enable) != 0)
+  if (rtp_rtcp_->SetREMBStatus(enable) != 0)
     return false;
   return true;
 }
@@ -683,7 +637,7 @@
 WebRtc_Word32 ViEChannel::EnableTMMBR(const bool enable) {
   WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_),
                "%s: %d", __FUNCTION__, enable);
-  return rtp_rtcp_.SetTMMBRStatus(enable);
+  return rtp_rtcp_->SetTMMBRStatus(enable);
 }
 
 WebRtc_Word32 ViEChannel::EnableKeyFrameRequestCallback(const bool enable) {
@@ -709,7 +663,7 @@
                "%s(usage:%d, SSRC: 0x%x, idx:%u)",
                __FUNCTION__, usage, SSRC, simulcast_idx);
   if (simulcast_idx == 0) {
-    return rtp_rtcp_.SetSSRC(SSRC);
+    return rtp_rtcp_->SetSSRC(SSRC);
   }
   if (simulcast_idx > simulcast_rtp_rtcp_.size()) {
       return -1;
@@ -735,13 +689,13 @@
                "%s(usage:%d, SSRC: 0x%x)",
                __FUNCTION__, usage, SSRC);
 
-  return rtp_rtcp_.SetRTXReceiveStatus(true, SSRC);
+  return rtp_rtcp_->SetRTXReceiveStatus(true, SSRC);
 }
 
 WebRtc_Word32 ViEChannel::GetLocalSSRC(WebRtc_UWord32& SSRC) {
   WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_),
                "%s", __FUNCTION__);
-  SSRC = rtp_rtcp_.SSRC();
+  SSRC = rtp_rtcp_->SSRC();
   return 0;
 }
 
@@ -749,7 +703,7 @@
   WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_), "%s",
                __FUNCTION__);
 
-  SSRC = rtp_rtcp_.RemoteSSRC();
+  SSRC = rtp_rtcp_->RemoteSSRC();
   return 0;
 }
 
@@ -760,7 +714,7 @@
   WebRtc_UWord32 arrayCSRC[kRtpCsrcSize];
   memset(arrayCSRC, 0, sizeof(arrayCSRC));
 
-  WebRtc_Word32 num_csrcs = rtp_rtcp_.RemoteCSRCs(arrayCSRC);
+  WebRtc_Word32 num_csrcs = rtp_rtcp_->RemoteCSRCs(arrayCSRC);
   if (num_csrcs > 0) {
     memcpy(CSRCs, arrayCSRC, num_csrcs * sizeof(WebRtc_UWord32));
     for (int idx = 0; idx < num_csrcs; idx++) {
@@ -779,37 +733,37 @@
   WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_), "%s",
                __FUNCTION__);
 
-  if (rtp_rtcp_.Sending()) {
+  if (rtp_rtcp_->Sending()) {
     WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_),
                  "%s: already sending", __FUNCTION__);
     return -1;
   }
-  return rtp_rtcp_.SetSequenceNumber(sequence_number);
+  return rtp_rtcp_->SetSequenceNumber(sequence_number);
 }
 
 WebRtc_Word32 ViEChannel::SetRTCPCName(const char rtcp_cname[]) {
   WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_),
                "%s", __FUNCTION__);
-  if (rtp_rtcp_.Sending()) {
+  if (rtp_rtcp_->Sending()) {
     WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_),
                  "%s: already sending", __FUNCTION__);
     return -1;
   }
-  return rtp_rtcp_.SetCNAME(rtcp_cname);
+  return rtp_rtcp_->SetCNAME(rtcp_cname);
 }
 
 WebRtc_Word32 ViEChannel::GetRTCPCName(char rtcp_cname[]) {
   WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_),
                "%s", __FUNCTION__);
-  return rtp_rtcp_.CNAME(rtcp_cname);
+  return rtp_rtcp_->CNAME(rtcp_cname);
 }
 
 WebRtc_Word32 ViEChannel::GetRemoteRTCPCName(char rtcp_cname[]) {
   WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_), "%s",
                __FUNCTION__);
 
-  WebRtc_UWord32 remoteSSRC = rtp_rtcp_.RemoteSSRC();
-  return rtp_rtcp_.RemoteCNAME(remoteSSRC, rtcp_cname);
+  WebRtc_UWord32 remoteSSRC = rtp_rtcp_->RemoteSSRC();
+  return rtp_rtcp_->RemoteCNAME(remoteSSRC, rtcp_cname);
 }
 
 WebRtc_Word32 ViEChannel::RegisterRtpObserver(ViERTPObserver* observer) {
@@ -867,7 +821,7 @@
     WebRtc_UWord16 data_length_in_bytes) {
   WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_), "%s",
                __FUNCTION__);
-  if (!rtp_rtcp_.Sending()) {
+  if (!rtp_rtcp_->Sending()) {
     WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_),
                  "%s: not sending", __FUNCTION__);
     return -1;
@@ -882,14 +836,14 @@
                  "%s: input length error", __FUNCTION__);
     return -1;
   }
-  RTCPMethod rtcp_method = rtp_rtcp_.RTCP();
+  RTCPMethod rtcp_method = rtp_rtcp_->RTCP();
   if (rtcp_method == kRtcpOff) {
     WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_),
                  "%s: RTCP not enabled", __FUNCTION__);
     return -1;
   }
   // Create and send packet.
-  if (rtp_rtcp_.SetRTCPApplicationSpecificData(sub_type, name, data,
+  if (rtp_rtcp_->SetRTCPApplicationSpecificData(sub_type, name, data,
                                                data_length_in_bytes) != 0) {
     WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_),
                  "%s: Could not send RTCP application data", __FUNCTION__);
@@ -913,14 +867,14 @@
   //      it++) {
   //   RtpRtcp* rtp_rtcp = *it;
   // }
-  WebRtc_UWord32 remoteSSRC = rtp_rtcp_.RemoteSSRC();
+  WebRtc_UWord32 remoteSSRC = rtp_rtcp_->RemoteSSRC();
 
   // Get all RTCP receiver report blocks that have been received on this
   // channel. If we receive RTP packets from a remote source we know the
   // remote SSRC and use the report block from him.
   // Otherwise use the first report block.
   std::vector<RTCPReportBlock> remote_stats;
-  if (rtp_rtcp_.RemoteRTCPStat(&remote_stats) != 0 || remote_stats.empty()) {
+  if (rtp_rtcp_->RemoteRTCPStat(&remote_stats) != 0 || remote_stats.empty()) {
     WEBRTC_TRACE(kTraceWarning, kTraceVideo, ViEId(engine_id_, channel_id_),
                  "%s: Could not get remote stats", __FUNCTION__);
     return -1;
@@ -947,7 +901,7 @@
 
   WebRtc_UWord16 dummy;
   WebRtc_UWord16 rtt = 0;
-  if (rtp_rtcp_.RTT(remoteSSRC, &rtt, &dummy, &dummy, &dummy) != 0) {
+  if (rtp_rtcp_->RTT(remoteSSRC, &rtt, &dummy, &dummy, &dummy) != 0) {
     WEBRTC_TRACE(kTraceWarning, kTraceVideo, ViEId(engine_id_, channel_id_),
                  "%s: Could not get RTT", __FUNCTION__);
     return -1;
@@ -966,7 +920,7 @@
                "%s", __FUNCTION__);
 
   WebRtc_UWord8 frac_lost = 0;
-  if (rtp_rtcp_.StatisticsRTP(&frac_lost, &cumulative_lost, &extended_max,
+  if (rtp_rtcp_->StatisticsRTP(&frac_lost, &cumulative_lost, &extended_max,
                               &jitter_samples) != 0) {
     WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_),
                  "%s: Could not get received RTP statistics", __FUNCTION__);
@@ -974,10 +928,10 @@
   }
   fraction_lost = frac_lost;
 
-  WebRtc_UWord32 remoteSSRC = rtp_rtcp_.RemoteSSRC();
+  WebRtc_UWord32 remoteSSRC = rtp_rtcp_->RemoteSSRC();
   WebRtc_UWord16 dummy = 0;
   WebRtc_UWord16 rtt = 0;
-  if (rtp_rtcp_.RTT(remoteSSRC, &rtt, &dummy, &dummy, &dummy) != 0) {
+  if (rtp_rtcp_->RTT(remoteSSRC, &rtt, &dummy, &dummy, &dummy) != 0) {
     WEBRTC_TRACE(kTraceStateInfo, kTraceVideo, ViEId(engine_id_, channel_id_),
                  "%s: Could not get RTT", __FUNCTION__);
   }
@@ -993,7 +947,7 @@
   WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_), "%s",
                __FUNCTION__);
 
-  if (rtp_rtcp_.DataCountersRTP(&bytes_sent,
+  if (rtp_rtcp_->DataCountersRTP(&bytes_sent,
                                 &packets_sent,
                                 &bytes_received,
                                 &packets_received) != 0) {
@@ -1021,7 +975,7 @@
   WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_), "%s",
                __FUNCTION__);
 
-  rtp_rtcp_.BitrateSent(&total_bitrate_sent,
+  rtp_rtcp_->BitrateSent(&total_bitrate_sent,
                         &video_bitrate_sent,
                         &fec_bitrate_sent,
                         &nackBitrateSent);
@@ -1041,7 +995,7 @@
 
 int ViEChannel::GetEstimatedReceiveBandwidth(
     WebRtc_UWord32* estimated_bandwidth) const {
-  return rtp_rtcp_.EstimatedReceiveBandwidth(estimated_bandwidth);
+  return rtp_rtcp_->EstimatedReceiveBandwidth(estimated_bandwidth);
 }
 
 WebRtc_Word32 ViEChannel::StartRTPDump(const char file_nameUTF8[1024],
@@ -1230,7 +1184,7 @@
     if ((UdpTransport::LocalHostAddress(local_host_address) == 0 &&
         local_host_address == current_ip_address) ||
         strncmp("127.0.0.1", ip_address, 9) == 0) {
-      rtp_rtcp_.SetSSRC(0xFFFFFFFF);
+      rtp_rtcp_->SetSSRC(0xFFFFFFFF);
       WEBRTC_TRACE(kTraceStateInfo, kTraceVideo, ViEId(engine_id_, channel_id_),
                    "Running in loopback. Forcing fixed SSRC");
     }
@@ -1263,7 +1217,7 @@
         }
       }
       if (local_host) {
-        rtp_rtcp_.SetSSRC(0xFFFFFFFF);
+        rtp_rtcp_->SetSSRC(0xFFFFFFFF);
         WEBRTC_TRACE(kTraceStateInfo, kTraceVideo,
                      ViEId(engine_id_, channel_id_),
                      "Running in loopback. Forcing fixed SSRC");
@@ -1338,15 +1292,15 @@
     }
   }
 #endif
-  rtp_rtcp_.SetSendingMediaStatus(true);
+  rtp_rtcp_->SetSendingMediaStatus(true);
 
-  if (rtp_rtcp_.Sending()) {
+  if (rtp_rtcp_->Sending()) {
     // Already sending.
     WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_),
                  "%s: Already sending", __FUNCTION__);
     return kViEBaseAlreadySending;
   }
-  if (rtp_rtcp_.SetSendingStatus(true) != 0) {
+  if (rtp_rtcp_->SetSendingStatus(true) != 0) {
     WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_),
                  "%s: Could not start sending RTP", __FUNCTION__);
     return -1;
@@ -1365,22 +1319,22 @@
   WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_), "%s",
                __FUNCTION__);
 
-  rtp_rtcp_.SetSendingMediaStatus(false);
+  rtp_rtcp_->SetSendingMediaStatus(false);
   for (std::list<RtpRtcp*>::iterator it = simulcast_rtp_rtcp_.begin();
        it != simulcast_rtp_rtcp_.end();
        it++) {
     RtpRtcp* rtp_rtcp = *it;
     rtp_rtcp->SetSendingMediaStatus(false);
   }
-  if (!rtp_rtcp_.Sending()) {
+  if (!rtp_rtcp_->Sending()) {
     WEBRTC_TRACE(kTraceWarning, kTraceVideo, ViEId(engine_id_, channel_id_),
                  "%s: Not sending", __FUNCTION__);
     return kViEBaseNotSending;
   }
 
   // Reset.
-  rtp_rtcp_.ResetSendDataCountersRTP();
-  if (rtp_rtcp_.SetSendingStatus(false) != 0) {
+  rtp_rtcp_->ResetSendDataCountersRTP();
+  if (rtp_rtcp_->SetSendingStatus(false) != 0) {
     WEBRTC_TRACE(kTraceWarning, kTraceVideo, ViEId(engine_id_, channel_id_),
                  "%s: could not stop RTP sending", __FUNCTION__);
     return -1;
@@ -1396,7 +1350,7 @@
 }
 
 bool ViEChannel::Sending() {
-  return rtp_rtcp_.Sending();
+  return rtp_rtcp_->Sending();
 }
 
 WebRtc_Word32 ViEChannel::StartReceive() {
@@ -1535,7 +1489,7 @@
     return -1;
   }
 #endif
-  if (rtp_rtcp_.Sending()) {
+  if (rtp_rtcp_->Sending()) {
     WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_),
                  "%s: Sending", __FUNCTION__);
     return -1;
@@ -1566,7 +1520,7 @@
                  "%s: no transport registered", __FUNCTION__);
     return -1;
   }
-  if (rtp_rtcp_.Sending()) {
+  if (rtp_rtcp_->Sending()) {
     WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_),
                  "%s: Sending", __FUNCTION__);
     return -1;
@@ -1833,7 +1787,7 @@
 WebRtc_Word32 ViEChannel::SetMTU(WebRtc_UWord16 mtu) {
   WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_), "%s",
                __FUNCTION__);
-  if (rtp_rtcp_.SetMaxTransferUnit(mtu) != 0) {
+  if (rtp_rtcp_->SetMaxTransferUnit(mtu) != 0) {
     // Logging done.
     return -1;
   }
@@ -1850,7 +1804,7 @@
 WebRtc_UWord16 ViEChannel::MaxDataPayloadLength() const {
   WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_),
                "%s", __FUNCTION__);
-  return rtp_rtcp_.MaxDataPayloadLength();
+  return rtp_rtcp_->MaxDataPayloadLength();
 }
 
 WebRtc_Word32 ViEChannel::SetPacketTimeoutNotification(
@@ -1859,13 +1813,13 @@
                __FUNCTION__);
   if (enable) {
     WebRtc_UWord32 timeout_ms = 1000 * timeout_seconds;
-    if (rtp_rtcp_.SetPacketTimeout(timeout_ms, 0) != 0) {
+    if (rtp_rtcp_->SetPacketTimeout(timeout_ms, 0) != 0) {
       WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_),
                    "%s", __FUNCTION__);
       return -1;
     }
   } else {
-    if (rtp_rtcp_.SetPacketTimeout(0, 0) != 0) {
+    if (rtp_rtcp_->SetPacketTimeout(0, 0) != 0) {
       WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_),
                    "%s", __FUNCTION__);
       return -1;
@@ -1920,9 +1874,9 @@
   WebRtc_UWord8 current_sampletime_seconds = 0;
 
   // Get old settings.
-  rtp_rtcp_.PeriodicDeadOrAliveStatus(enabled, current_sampletime_seconds);
+  rtp_rtcp_->PeriodicDeadOrAliveStatus(enabled, current_sampletime_seconds);
   // Set new settings.
-  if (rtp_rtcp_.SetPeriodicDeadOrAliveStatus(
+  if (rtp_rtcp_->SetPeriodicDeadOrAliveStatus(
         enable, static_cast<WebRtc_UWord8>(sample_time_seconds)) != 0) {
     WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_),
                  "%s: Could not set periodic dead-or-alive status",
@@ -1934,7 +1888,7 @@
     // Without this trick, the sample time would always be reset to default
     // (2 sec), each time dead-or-alive was disabled without sample-time
     // parameter.
-    rtp_rtcp_.SetPeriodicDeadOrAliveStatus(enable, current_sampletime_seconds);
+    rtp_rtcp_->SetPeriodicDeadOrAliveStatus(enable, current_sampletime_seconds);
   }
   return 0;
 }
@@ -1977,39 +1931,10 @@
   return 0;
 }
 
-WebRtc_Word32 ViEChannel::RegisterSendRtpRtcpModule(
-    RtpRtcp& send_rtp_rtcp_module) {
-  WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_), "%s",
-               __FUNCTION__);
-
-  WebRtc_Word32 ret_val = rtp_rtcp_.RegisterDefaultModule(
-      &send_rtp_rtcp_module);
-  if (ret_val == 0) {
-    // We need to store this for the SetSendCodec call.
-    default_rtp_rtcp_ = &send_rtp_rtcp_module;
-  }
-  return ret_val;
-}
-
-WebRtc_Word32 ViEChannel::DeregisterSendRtpRtcpModule() {
-  WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_), "%s",
-               __FUNCTION__);
-  default_rtp_rtcp_ = NULL;
-
-  for (std::list<RtpRtcp*>::const_iterator it = simulcast_rtp_rtcp_.begin();
-       it != simulcast_rtp_rtcp_.end();
-       it++) {
-    RtpRtcp* rtp_rtcp = *it;
-    rtp_rtcp->DeRegisterDefaultModule();
-  }
-  return rtp_rtcp_.DeRegisterDefaultModule();
-}
-
 RtpRtcp* ViEChannel::rtp_rtcp() {
-  return &rtp_rtcp_;
+  return rtp_rtcp_.get();
 }
 
-
 WebRtc_Word32 ViEChannel::FrameToRender(VideoFrame& video_frame) {
   CriticalSectionScoped cs(callback_cs_.get());
 
@@ -2046,9 +1971,9 @@
   file_recorder_.RecordVideoFrame(video_frame);
 
   WebRtc_UWord32 arr_ofCSRC[kRtpCsrcSize];
-  WebRtc_Word32 no_of_csrcs = rtp_rtcp_.RemoteCSRCs(arr_ofCSRC);
+  WebRtc_Word32 no_of_csrcs = rtp_rtcp_->RemoteCSRCs(arr_ofCSRC);
   if (no_of_csrcs <= 0) {
-    arr_ofCSRC[0] = rtp_rtcp_.RemoteSSRC();
+    arr_ofCSRC[0] = rtp_rtcp_->RemoteSSRC();
     no_of_csrcs = 1;
   }
   WEBRTC_TRACE(kTraceStream, kTraceVideo, ViEId(engine_id_, channel_id_),
@@ -2059,7 +1984,7 @@
 
 WebRtc_Word32 ViEChannel::ReceivedDecodedReferenceFrame(
   const WebRtc_UWord64 picture_id) {
-  return rtp_rtcp_.SendRTCPReferencePictureSelection(picture_id);
+  return rtp_rtcp_->SendRTCPReferencePictureSelection(picture_id);
 }
 
 WebRtc_Word32 ViEChannel::StoreReceivedFrame(
@@ -2088,19 +2013,19 @@
       codec_observer_->RequestNewKeyFrame(channel_id_);
     }
   }
-  return rtp_rtcp_.RequestKeyFrame();
+  return rtp_rtcp_->RequestKeyFrame();
 }
 
 WebRtc_Word32 ViEChannel::SliceLossIndicationRequest(
   const WebRtc_UWord64 picture_id) {
-  return rtp_rtcp_.SendRTCPSliceLossIndication((WebRtc_UWord8) picture_id);
+  return rtp_rtcp_->SendRTCPSliceLossIndication((WebRtc_UWord8) picture_id);
 }
 
 WebRtc_Word32 ViEChannel::ResendPackets(const WebRtc_UWord16* sequence_numbers,
                                         WebRtc_UWord16 length) {
   WEBRTC_TRACE(kTraceStream, kTraceVideo, ViEId(engine_id_, channel_id_),
                "%s(length: %d)", __FUNCTION__, length);
-  return rtp_rtcp_.SendNACK(sequence_numbers, length);
+  return rtp_rtcp_->SendNACK(sequence_numbers, length);
 }
 
 bool ViEChannel::ChannelDecodeThreadFunction(void* obj) {
@@ -2117,11 +2042,11 @@
     WebRtc_UWord16 minRTT;
     WebRtc_UWord16 maxRTT;
 
-    if (rtp_rtcp_.RTT(rtp_rtcp_.RemoteSSRC(), &RTT, &avgRTT, &minRTT, &maxRTT)
+    if (rtp_rtcp_->RTT(rtp_rtcp_->RemoteSSRC(), &RTT, &avgRTT, &minRTT, &maxRTT)
         == 0) {
       vcm_.SetReceiveChannelParameters(RTT);
       vcm_rttreported_ = TickTime::Now();
-    } else if (!rtp_rtcp_.Sending() &&
+    } else if (!rtp_rtcp_->Sending() &&
                (TickTime::Now() - vcm_rttreported_).Milliseconds() > 5000) {
       // Wait at least 5 seconds before faking a 200 ms RTT. This is to
       // make sure we have a chance to start sending before we decide to fake.
@@ -2239,7 +2164,8 @@
   } else {
     module_process_thread_.DeRegisterModule(&vie_sync_);
   }
-  return vie_sync_.SetVoiceChannel(ve_channel_id, ve_sync_interface);
+  return vie_sync_.ConfigureSync(ve_channel_id, ve_sync_interface,
+                                 rtp_rtcp_.get());
 }
 
 WebRtc_Word32 ViEChannel::VoiceChannel() {
@@ -2284,16 +2210,6 @@
   vcm_.RegisterFrameStorageCallback(NULL);
 }
 
-void ViEChannel::OnLipSyncUpdate(const WebRtc_Word32 id,
-                                 const WebRtc_Word32 audio_video_offset) {
-  if (channel_id_ != ChannelId(id)) {
-    WEBRTC_TRACE(kTraceStream, kTraceVideo, ViEId(engine_id_, channel_id_),
-                 "%s, incorrect id", __FUNCTION__, id);
-    return;
-  }
-  vie_sync_.SetNetworkDelay(audio_video_offset);
-}
-
 void ViEChannel::OnApplicationDataReceived(const WebRtc_Word32 id,
                                            const WebRtc_UWord8 sub_type,
                                            const WebRtc_UWord32 name,
diff --git a/src/video_engine/vie_channel.h b/src/video_engine/vie_channel.h
index d347d61..fe4c73e 100644
--- a/src/video_engine/vie_channel.h
+++ b/src/video_engine/vie_channel.h
@@ -26,6 +26,9 @@
 #include "video_engine/vie_defines.h"
 #include "video_engine/vie_file_recorder.h"
 #include "video_engine/vie_frame_provider_base.h"
+#include "video_engine/vie_receiver.h"
+#include "video_engine/vie_sender.h"
+#include "video_engine/vie_sync_module.h"
 
 namespace webrtc {
 
@@ -40,11 +43,8 @@
 class ViEDecoderObserver;
 class ViEEffectFilter;
 class ViENetworkObserver;
-class ViEReceiver;
 class ViERTCPObserver;
 class ViERTPObserver;
-class ViESender;
-class ViESyncModule;
 class VoEVideoSync;
 
 class ViEChannel
@@ -62,7 +62,9 @@
              WebRtc_UWord32 number_of_cores,
              ProcessThread& module_process_thread,
              RtcpIntraFrameObserver* intra_frame_observer,
-             RtcpBandwidthObserver* bandwidth_observer);
+             RtcpBandwidthObserver* bandwidth_observer,
+             RtpRemoteBitrateObserver* bitrate_observer,
+             RtpRtcp* default_rtp_rtcp);
   ~ViEChannel();
 
   WebRtc_Word32 Init();
@@ -171,8 +173,7 @@
   WebRtc_Word32 StopRTPDump(RTPDirections direction);
 
   // Implements RtcpFeedback.
-  virtual void OnLipSyncUpdate(const WebRtc_Word32 id,
-                               const WebRtc_Word32 audio_video_offset);
+  // TODO(pwestin) Depricate this functionality.
   virtual void OnApplicationDataReceived(const WebRtc_Word32 id,
                                          const WebRtc_UWord8 sub_type,
                                          const WebRtc_UWord32 name,
@@ -282,14 +283,6 @@
 
   WebRtc_Word32 EnableColorEnhancement(bool enable);
 
-  // Register send RTP RTCP module, which will deliver encoded frames to the
-  // to the channel RTP module.
-  WebRtc_Word32 RegisterSendRtpRtcpModule(RtpRtcp& send_rtp_rtcp_module);
-
-  // Deregisters the send RTP RTCP module, which will stop the encoder input to
-  // the channel.
-  WebRtc_Word32 DeregisterSendRtpRtcpModule();
-
   // Gets the modules used by the channel.
   RtpRtcp* rtp_rtcp();
 
@@ -356,17 +349,18 @@
   // Used for all registered callbacks except rendering.
   scoped_ptr<CriticalSectionWrapper> callback_cs_;
 
-  // Owned modules/classes.
-  RtpRtcp& rtp_rtcp_;
   RtpRtcp* default_rtp_rtcp_;
+
+  // Owned modules/classes.
+  scoped_ptr<RtpRtcp> rtp_rtcp_;
   std::list<RtpRtcp*> simulcast_rtp_rtcp_;
 #ifndef WEBRTC_EXTERNAL_TRANSPORT
   UdpTransport& socket_transport_;
 #endif
   VideoCodingModule& vcm_;
-  ViEReceiver& vie_receiver_;
-  ViESender& vie_sender_;
-  ViESyncModule& vie_sync_;
+  ViEReceiver vie_receiver_;
+  ViESender vie_sender_;
+  ViESyncModule vie_sync_;
 
   // Not owned.
   ProcessThread& module_process_thread_;
diff --git a/src/video_engine/vie_channel_group.cc b/src/video_engine/vie_channel_group.cc
index f542d6b..2555286 100644
--- a/src/video_engine/vie_channel_group.cc
+++ b/src/video_engine/vie_channel_group.cc
@@ -43,6 +43,14 @@
   return channels_.empty();
 }
 
+RtpRemoteBitrateObserver* ChannelGroup::GetRtpRemoteBitrateObserver() {
+  return remb_.get();
+}
+
+BitrateController* ChannelGroup::GetBitrateController() {
+  return bitrate_controller_.get();
+}
+
 bool ChannelGroup::SetChannelRembStatus(int channel_id,
                                         bool sender,
                                         bool receiver,
@@ -68,11 +76,6 @@
   } else {
     remb_->RemoveReceiveChannel(rtp_module);
   }
-  if (sender || receiver) {
-    rtp_module->SetRemoteBitrateObserver(remb_.get());
-  } else {
-    rtp_module->SetRemoteBitrateObserver(NULL);
-  }
   return true;
 }
 
diff --git a/src/video_engine/vie_channel_group.h b/src/video_engine/vie_channel_group.h
index 00c77a8..279a556 100644
--- a/src/video_engine/vie_channel_group.h
+++ b/src/video_engine/vie_channel_group.h
@@ -19,6 +19,7 @@
 
 class BitrateController;
 class ProcessThread;
+class RtpRemoteBitrateObserver;
 class ViEChannel;
 class ViEEncoder;
 class VieRemb;
@@ -41,7 +42,9 @@
                             ViEChannel* channel,
                             ViEEncoder* encoder);
 
-  BitrateController* GetBitrateController() { return bitrate_controller_.get();}
+  BitrateController* GetBitrateController();
+
+  RtpRemoteBitrateObserver* GetRtpRemoteBitrateObserver();
 
  private:
   typedef std::set<int> ChannelSet;
diff --git a/src/video_engine/vie_channel_manager.cc b/src/video_engine/vie_channel_manager.cc
index e9f6c5d..777bccc 100644
--- a/src/video_engine/vie_channel_manager.cc
+++ b/src/video_engine/vie_channel_manager.cc
@@ -98,8 +98,12 @@
   RtcpBandwidthObserver* bandwidth_observer =
       bitrate_controller->CreateRtcpBandwidthObserver();
 
+  RtpRemoteBitrateObserver* bitrate_observer =
+      group->GetRtpRemoteBitrateObserver();
+
   if (!(vie_encoder->Init() &&
-        CreateChannelObject(new_channel_id, vie_encoder, bandwidth_observer))) {
+        CreateChannelObject(new_channel_id, vie_encoder, bandwidth_observer,
+                            bitrate_observer))) {
     delete vie_encoder;
     vie_encoder = NULL;
     ReturnChannelId(new_channel_id);
@@ -129,8 +133,13 @@
   }
 
   BitrateController* bitrate_controller = channel_group->GetBitrateController();
+
   RtcpBandwidthObserver* bandwidth_observer =
       bitrate_controller->CreateRtcpBandwidthObserver();
+
+  RtpRemoteBitrateObserver* bitrate_observer =
+      channel_group->GetRtpRemoteBitrateObserver();
+
   ViEEncoder* vie_encoder = NULL;
   if (sender) {
     // We need to create a new ViEEncoder.
@@ -139,14 +148,15 @@
                                  bitrate_controller);
     if (!(vie_encoder->Init() &&
           CreateChannelObject(new_channel_id, vie_encoder,
-                              bandwidth_observer))) {
+                              bandwidth_observer, bitrate_observer))) {
       delete vie_encoder;
       vie_encoder = NULL;
     }
   } else {
     vie_encoder = ViEEncoderPtr(original_channel);
     assert(vie_encoder);
-    if (!CreateChannelObject(new_channel_id, vie_encoder, bandwidth_observer)) {
+    if (!CreateChannelObject(new_channel_id, vie_encoder, bandwidth_observer,
+                             bitrate_observer)) {
       vie_encoder = NULL;
     }
   }
@@ -182,8 +192,6 @@
     vie_channel = c_it->second;
     channel_map_.erase(c_it);
 
-    // Deregister the channel from the ViEEncoder to stop the media flow.
-    vie_channel->DeregisterSendRtpRtcpModule();
     ReturnChannelId(channel_id);
 
     // Find the encoder object.
@@ -198,10 +206,6 @@
 
     // Check if other channels are using the same encoder.
     if (ChannelUsingViEEncoder(channel_id)) {
-      // Don't delete the ViEEncoder, at least one other channel is using it.
-      WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_),
-        "%s ViEEncoder removed from map for channel %d, not deleted",
-        __FUNCTION__, channel_id);
       vie_encoder = NULL;
     } else {
       // Delete later when we've released the critsect.
@@ -217,6 +221,7 @@
       group = NULL;  // Prevent group from being deleted.
     }
   }
+  delete vie_channel;
   // Leave the write critsect before deleting the objects.
   // Deleting a channel can cause other objects, such as renderers, to be
   // deleted, which might take time.
@@ -236,7 +241,6 @@
                  channel_id);
     delete group;
   }
-  delete vie_channel;
   WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_),
                "%s Channel %d deleted", __FUNCTION__, channel_id);
   return 0;
@@ -321,39 +325,32 @@
 bool ViEChannelManager::CreateChannelObject(
     int channel_id,
     ViEEncoder* vie_encoder,
-    RtcpBandwidthObserver* bandwidth_observer) {
+    RtcpBandwidthObserver* bandwidth_observer,
+    RtpRemoteBitrateObserver* bitrate_observer) {
+  // Register the channel at the encoder.
+  RtpRtcp* send_rtp_rtcp_module = vie_encoder->SendRtpRtcpModule();
+
   ViEChannel* vie_channel = new ViEChannel(channel_id, engine_id_,
                                            number_of_cores_,
                                            *module_process_thread_,
                                            vie_encoder,
-                                           bandwidth_observer);
+                                           bandwidth_observer,
+                                           bitrate_observer,
+                                           send_rtp_rtcp_module);
   if (vie_channel->Init() != 0) {
     WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_),
                  "%s could not init channel", __FUNCTION__, channel_id);
     delete vie_channel;
     return false;
   }
-  // Register the channel at the encoder.
-  // Need to call RegisterSendRtpRtcpModule before SetSendCodec since
-  // the SetSendCodec call use the default rtp/rtcp module.
-  RtpRtcp* send_rtp_rtcp_module = vie_encoder->SendRtpRtcpModule();
-  if (vie_channel->RegisterSendRtpRtcpModule(*send_rtp_rtcp_module) != 0) {
-    delete vie_channel;
-    WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id),
-                 "%s: Could not register RTP module", __FUNCTION__);
-    return false;
-  }
-
   VideoCodec encoder;
   if (vie_encoder->GetEncoder(encoder) != 0 ||
       vie_channel->SetSendCodec(encoder) != 0) {
     WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id),
                  "%s: Could not GetEncoder or SetSendCodec.", __FUNCTION__);
-    vie_channel->DeregisterSendRtpRtcpModule();
     delete vie_channel;
     return false;
   }
-
   // Store the channel, add it to the channel group and save the vie_encoder.
   channel_map_[channel_id] = vie_channel;
   vie_encoder_map_[channel_id] = vie_encoder;
diff --git a/src/video_engine/vie_channel_manager.h b/src/video_engine/vie_channel_manager.h
index fac38d7..a0c9382 100644
--- a/src/video_engine/vie_channel_manager.h
+++ b/src/video_engine/vie_channel_manager.h
@@ -77,7 +77,8 @@
   // Creates a channel object connected to |vie_encoder|. Assumed to be called
   // protected.
   bool CreateChannelObject(int channel_id, ViEEncoder* vie_encoder,
-                           RtcpBandwidthObserver* bandwidth_observer);
+                           RtcpBandwidthObserver* bandwidth_observer,
+                           RtpRemoteBitrateObserver* bitrate_observer);
 
   // Used by ViEChannelScoped, forcing a manager user to use scoped.
   // Returns a pointer to the channel with id 'channelId'.
diff --git a/src/video_engine/vie_encoder.cc b/src/video_engine/vie_encoder.cc
index 229d74d..af5f34e 100644
--- a/src/video_engine/vie_encoder.cc
+++ b/src/video_engine/vie_encoder.cc
@@ -67,8 +67,7 @@
                                                         channel_id))),
     vpm_(*webrtc::VideoProcessingModule::Create(ViEModuleId(engine_id,
                                                             channel_id))),
-    default_rtp_rtcp_(*RtpRtcp::CreateRtpRtcp(
-        ViEModuleId(engine_id, channel_id), false)),
+    default_rtp_rtcp_(NULL),
     callback_cs_(CriticalSectionWrapper::CreateCriticalSection()),
     data_cs_(CriticalSectionWrapper::CreateCriticalSection()),
     bitrate_controller_(bitrate_controller),
@@ -92,6 +91,11 @@
                "%s(engine_id: %d) 0x%p - Constructor", __FUNCTION__, engine_id,
                this);
 
+  RtpRtcp::Configuration configuration;
+  configuration.id = ViEModuleId(engine_id_, channel_id_);
+  configuration.audio = false;  // Video.
+
+  default_rtp_rtcp_.reset(RtpRtcp::CreateRtpRtcp(configuration));
   bitrate_observer_.reset(new ViEBitrateObserver(this));
 }
 
@@ -113,13 +117,7 @@
                  "%s RegisterModule failure", __FUNCTION__);
     return false;
   }
-  if (default_rtp_rtcp_.InitSender() != 0) {
-    WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo,
-                 ViEId(engine_id_, channel_id_),
-                 "%s InitSender failure", __FUNCTION__);
-    return false;
-  }
-  if (module_process_thread_.RegisterModule(&default_rtp_rtcp_) != 0) {
+  if (module_process_thread_.RegisterModule(default_rtp_rtcp_.get()) != 0) {
     WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo,
                  ViEId(engine_id_, channel_id_),
                  "%s RegisterModule failure", __FUNCTION__);
@@ -140,13 +138,13 @@
     return false;
   }
   if (vcm_.RegisterSendCodec(&video_codec, number_of_cores_,
-                             default_rtp_rtcp_.MaxDataPayloadLength()) != 0) {
+                             default_rtp_rtcp_->MaxDataPayloadLength()) != 0) {
     WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo,
                  ViEId(engine_id_, channel_id_),
                  "%s RegisterSendCodec failure", __FUNCTION__);
     return false;
   }
-  if (default_rtp_rtcp_.RegisterSendPayload(video_codec) != 0) {
+  if (default_rtp_rtcp_->RegisterSendPayload(video_codec) != 0) {
     WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo,
                  ViEId(engine_id_, channel_id_),
                  "%s RegisterSendPayload failure", __FUNCTION__);
@@ -156,8 +154,8 @@
   VideoCodec video_codec;
   if (vcm_.Codec(webrtc::kVideoCodecI420, &video_codec) == VCM_OK) {
     vcm_.RegisterSendCodec(&video_codec, number_of_cores_,
-                           default_rtp_rtcp_.MaxDataPayloadLength());
-    default_rtp_rtcp_.RegisterSendPayload(video_codec);
+                           default_rtp_rtcp_->MaxDataPayloadLength());
+    default_rtp_rtcp_->RegisterSendPayload(video_codec);
   } else {
     return false;
   }
@@ -188,21 +186,11 @@
   WEBRTC_TRACE(webrtc::kTraceMemory, webrtc::kTraceVideo,
                ViEId(engine_id_, channel_id_),
                "ViEEncoder Destructor 0x%p, engine_id: %d", this, engine_id_);
-
-  if (default_rtp_rtcp_.NumberChildModules() > 0) {
-    assert(false);
-    WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo,
-                 ViEId(engine_id_, channel_id_),
-                 "Channels still attached %d, leaking memory",
-                 default_rtp_rtcp_.NumberChildModules());
-    return;
-  }
   module_process_thread_.DeRegisterModule(&vcm_);
   module_process_thread_.DeRegisterModule(&vpm_);
-  module_process_thread_.DeRegisterModule(&default_rtp_rtcp_);
+  module_process_thread_.DeRegisterModule(default_rtp_rtcp_.get());
   delete &vcm_;
   delete &vpm_;
-  delete &default_rtp_rtcp_;
   delete qm_callback_;
 }
 
@@ -305,7 +293,7 @@
   // encoder.
   if (current_send_codec.plType == pl_type) {
     WebRtc_UWord16 max_data_payload_length =
-        default_rtp_rtcp_.MaxDataPayloadLength();
+        default_rtp_rtcp_->MaxDataPayloadLength();
     if (vcm_.RegisterSendCodec(&current_send_codec, number_of_cores_,
                                max_data_payload_length) != VCM_OK) {
       WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo,
@@ -332,17 +320,17 @@
     return -1;
   }
 
-  if (default_rtp_rtcp_.RegisterSendPayload(video_codec) != 0) {
+  if (default_rtp_rtcp_->RegisterSendPayload(video_codec) != 0) {
     WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo,
                  ViEId(engine_id_, channel_id_),
                  "Could register RTP module video payload");
     return -1;
   }
   // Convert from kbps to bps.
-  default_rtp_rtcp_.SetTargetSendBitrate(video_codec.startBitrate * 1000);
+  default_rtp_rtcp_->SetTargetSendBitrate(video_codec.startBitrate * 1000);
 
   WebRtc_UWord16 max_data_payload_length =
-      default_rtp_rtcp_.MaxDataPayloadLength();
+      default_rtp_rtcp_->MaxDataPayloadLength();
 
   if (vcm_.RegisterSendCodec(&video_codec, number_of_cores_,
                              max_data_payload_length) != VCM_OK) {
@@ -354,8 +342,8 @@
 
   // Set this module as sending right away, let the slave module in the channel
   // start and stop sending.
-  if (default_rtp_rtcp_.Sending() == false) {
-    if (default_rtp_rtcp_.SetSendingStatus(true) != 0) {
+  if (default_rtp_rtcp_->Sending() == false) {
+    if (default_rtp_rtcp_->SetSendingStatus(true) != 0) {
       WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo,
                    ViEId(engine_id_, channel_id_),
                    "Could start RTP module sending");
@@ -424,7 +412,7 @@
   WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideo,
                ViEId(engine_id_, channel_id_), "%s", __FUNCTION__);
 
-  return &default_rtp_rtcp_;
+  return default_rtp_rtcp_.get();
 }
 
 void ViEEncoder::DeliverFrame(int id, webrtc::VideoFrame& video_frame,
@@ -436,7 +424,7 @@
 
   {
     CriticalSectionScoped cs(data_cs_.get());
-    if (paused_ || default_rtp_rtcp_.SendingMedia() == false) {
+    if (paused_ || default_rtp_rtcp_->SendingMedia() == false) {
       // We've paused or we have no channels attached, don't encode.
       return;
     }
@@ -471,12 +459,12 @@
     WebRtc_UWord32 tempCSRC[kRtpCsrcSize];
     for (int i = 0; i < num_csrcs; i++) {
       if (CSRC[i] == 1) {
-        tempCSRC[i] = default_rtp_rtcp_.SSRC();
+        tempCSRC[i] = default_rtp_rtcp_->SSRC();
       } else {
         tempCSRC[i] = CSRC[i];
       }
     }
-    default_rtp_rtcp_.SetCSRCs(tempCSRC, (WebRtc_UWord8) num_csrcs);
+    default_rtp_rtcp_->SetCSRCs(tempCSRC, (WebRtc_UWord8) num_csrcs);
   }
 
 #ifdef VIDEOCODEC_VP8
@@ -559,7 +547,7 @@
                ViEId(engine_id_, channel_id_), "%s: %u", __FUNCTION__,
                frame_delay);
 
-  default_rtp_rtcp_.SetCameraDelay(frame_delay);
+  default_rtp_rtcp_->SetCameraDelay(frame_delay);
   file_recorder_.SetFrameDelay(frame_delay);
 }
 
@@ -633,14 +621,14 @@
 
   // Updated protection method to VCM to get correct packetization sizes.
   // FEC has larger overhead than NACK -> set FEC if used.
-  WebRtc_Word32 error = default_rtp_rtcp_.GenericFECStatus(fec_enabled,
+  WebRtc_Word32 error = default_rtp_rtcp_->GenericFECStatus(fec_enabled,
                                                            dummy_ptype_red,
                                                            dummy_ptypeFEC);
   if (error) {
     return -1;
   }
 
-  bool nack_enabled = (default_rtp_rtcp_.NACK() == kNackOff) ? false : true;
+  bool nack_enabled = (default_rtp_rtcp_->NACK() == kNackOff) ? false : true;
   if (fec_enabled_ == fec_enabled && nack_enabled_ == nack_enabled) {
     // No change needed, we're already in correct state.
     return 0;
@@ -665,7 +653,7 @@
     // The send codec must be registered to set correct MTU.
     webrtc::VideoCodec codec;
     if (vcm_.SendCodec(&codec) == 0) {
-      WebRtc_UWord16 max_pay_load = default_rtp_rtcp_.MaxDataPayloadLength();
+      WebRtc_UWord16 max_pay_load = default_rtp_rtcp_->MaxDataPayloadLength();
       if (vcm_.Bitrate(&codec.startBitrate) != 0) {
         WEBRTC_TRACE(webrtc::kTraceWarning, webrtc::kTraceVideo,
                      ViEId(engine_id_, channel_id_),
@@ -711,10 +699,11 @@
   }
 
   // New encoded data, hand over to the rtp module.
-  return default_rtp_rtcp_.SendOutgoingData(frame_type, payload_type,
-                                            time_stamp, payload_data,
-                                            payload_size, &fragmentation_header,
-                                            rtp_video_hdr);
+  return default_rtp_rtcp_->SendOutgoingData(frame_type, payload_type,
+                                             time_stamp, payload_data,
+                                             payload_size,
+                                             &fragmentation_header,
+                                             rtp_video_hdr);
 }
 
 WebRtc_Word32 ViEEncoder::ProtectionRequest(
@@ -733,13 +722,13 @@
                delta_fec_params->use_uep_protection,
                key_fec_params->use_uep_protection);
 
-  if (default_rtp_rtcp_.SetFecParameters(delta_fec_params,
+  if (default_rtp_rtcp_->SetFecParameters(delta_fec_params,
                                          key_fec_params) != 0) {
     WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo,
                  ViEId(engine_id_, channel_id_),
                  "%s: Could not update FEC parameters", __FUNCTION__);
   }
-  default_rtp_rtcp_.BitrateSent(NULL,
+  default_rtp_rtcp_->BitrateSent(NULL,
                                 sent_video_rate_bps,
                                 sent_fec_rate_bps,
                                 sent_nack_rate_bps);
@@ -826,7 +815,7 @@
   vcm_.SetChannelParameters(bitrate_bps / 1000, fraction_lost,
                             round_trip_time_ms);
 
-  default_rtp_rtcp_.SetTargetSendBitrate(bitrate_bps);
+  default_rtp_rtcp_->SetTargetSendBitrate(bitrate_bps);
 }
 
 WebRtc_Word32 ViEEncoder::RegisterEffectFilter(ViEEffectFilter* effect_filter) {
diff --git a/src/video_engine/vie_encoder.h b/src/video_engine/vie_encoder.h
index 3640216..1284d7a 100644
--- a/src/video_engine/vie_encoder.h
+++ b/src/video_engine/vie_encoder.h
@@ -157,7 +157,7 @@
 
   VideoCodingModule& vcm_;
   VideoProcessingModule& vpm_;
-  RtpRtcp& default_rtp_rtcp_;
+  scoped_ptr<RtpRtcp> default_rtp_rtcp_;
   scoped_ptr<CriticalSectionWrapper> callback_cs_;
   scoped_ptr<CriticalSectionWrapper> data_cs_;
   scoped_ptr<BitrateObserver> bitrate_observer_;
diff --git a/src/video_engine/vie_receiver.cc b/src/video_engine/vie_receiver.cc
index 053efde..3dba799 100644
--- a/src/video_engine/vie_receiver.cc
+++ b/src/video_engine/vie_receiver.cc
@@ -18,13 +18,11 @@
 
 namespace webrtc {
 
-ViEReceiver::ViEReceiver(int engine_id, int channel_id,
-                         RtpRtcp& rtp_rtcp,
-                         VideoCodingModule& module_vcm)
+ViEReceiver::ViEReceiver(const int32_t channel_id,
+                         VideoCodingModule* module_vcm)
     : receive_cs_(CriticalSectionWrapper::CreateCriticalSection()),
-      engine_id_(engine_id),
       channel_id_(channel_id),
-      rtp_rtcp_(rtp_rtcp),
+      rtp_rtcp_(NULL),
       vcm_(module_vcm),
       external_decryption_(NULL),
       decryption_buffer_(NULL),
@@ -66,6 +64,10 @@
   return 0;
 }
 
+void ViEReceiver::SetRtpRtcpModule(RtpRtcp* module) {
+  rtp_rtcp_ = module;
+}
+
 void ViEReceiver::RegisterSimulcastRtpRtcpModules(
     const std::list<RtpRtcp*>& rtp_modules) {
   CriticalSectionScoped cs(receive_cs_.get());
@@ -116,7 +118,7 @@
     return 0;
   }
 
-  if (vcm_.IncomingPacket(payload_data, payload_size, *rtp_header) != 0) {
+  if (vcm_->IncomingPacket(payload_data, payload_size, *rtp_header) != 0) {
     // Check this...
     return -1;
   }
@@ -139,12 +141,11 @@
                                     decryption_buffer_, received_packet_length,
                                     &decrypted_length);
       if (decrypted_length <= 0) {
-        WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo,
-                     ViEId(engine_id_, channel_id_), "RTP decryption failed");
+        WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, channel_id_,
+                     "RTP decryption failed");
         return -1;
       } else if (decrypted_length > kViEMaxMtu) {
-        WEBRTC_TRACE(webrtc::kTraceCritical, webrtc::kTraceVideo,
-                     ViEId(engine_id_, channel_id_),
+        WEBRTC_TRACE(webrtc::kTraceCritical, webrtc::kTraceVideo, channel_id_,
                      "InsertRTPPacket: %d bytes is allocated as RTP decrytption"
                      " output, external decryption used %d bytes. => memory is "
                      " now corrupted", kViEMaxMtu, decrypted_length);
@@ -159,14 +160,15 @@
                            static_cast<WebRtc_UWord16>(received_packet_length));
     }
   }
-  return rtp_rtcp_.IncomingPacket(received_packet, received_packet_length);
+  assert(rtp_rtcp_);  // Should be set by owner at construction time.
+  return rtp_rtcp_->IncomingPacket(received_packet, received_packet_length);
 }
 
 int ViEReceiver::InsertRTCPPacket(const WebRtc_Word8* rtcp_packet,
                                   int rtcp_packet_length) {
   // TODO(mflodman) Change decrypt to get rid of this cast.
-    WebRtc_Word8* tmp_ptr = const_cast<WebRtc_Word8*>(rtcp_packet);
-    unsigned char* received_packet = reinterpret_cast<unsigned char*>(tmp_ptr);
+  WebRtc_Word8* tmp_ptr = const_cast<WebRtc_Word8*>(rtcp_packet);
+  unsigned char* received_packet = reinterpret_cast<unsigned char*>(tmp_ptr);
   int received_packet_length = rtcp_packet_length;
   {
     CriticalSectionScoped cs(receive_cs_.get());
@@ -178,12 +180,11 @@
                                          received_packet_length,
                                          &decrypted_length);
       if (decrypted_length <= 0) {
-        WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo,
-                     ViEId(engine_id_, channel_id_), "RTP decryption failed");
+        WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, channel_id_,
+                     "RTP decryption failed");
         return -1;
       } else if (decrypted_length > kViEMaxMtu) {
-        WEBRTC_TRACE(webrtc::kTraceCritical, webrtc::kTraceVideo,
-                     ViEId(engine_id_, channel_id_),
+        WEBRTC_TRACE(webrtc::kTraceCritical, webrtc::kTraceVideo, channel_id_,
                      "InsertRTCPPacket: %d bytes is allocated as RTP "
                      " decrytption output, external decryption used %d bytes. "
                      " => memory is now corrupted",
@@ -207,7 +208,8 @@
       rtp_rtcp->IncomingPacket(received_packet, received_packet_length);
     }
   }
-  return rtp_rtcp_.IncomingPacket(received_packet, received_packet_length);
+  assert(rtp_rtcp_);  // Should be set by owner at construction time.
+  return rtp_rtcp_->IncomingPacket(received_packet, received_packet_length);
 }
 
 void ViEReceiver::StartReceive() {
@@ -226,8 +228,7 @@
   } else {
     rtp_dump_ = RtpDump::CreateRtpDump();
     if (rtp_dump_ == NULL) {
-      WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo,
-                   ViEId(engine_id_, channel_id_),
+      WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, channel_id_,
                    "StartRTPDump: Failed to create RTP dump");
       return -1;
     }
@@ -235,8 +236,7 @@
   if (rtp_dump_->Start(file_nameUTF8) != 0) {
     RtpDump::DestroyRtpDump(rtp_dump_);
     rtp_dump_ = NULL;
-    WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo,
-                 ViEId(engine_id_, channel_id_),
+    WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, channel_id_,
                  "StartRTPDump: Failed to start RTP dump");
     return -1;
   }
@@ -249,15 +249,13 @@
     if (rtp_dump_->IsActive()) {
       rtp_dump_->Stop();
     } else {
-      WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo,
-                   ViEId(engine_id_, channel_id_),
+      WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, channel_id_,
                    "StopRTPDump: Dump not active");
     }
     RtpDump::DestroyRtpDump(rtp_dump_);
     rtp_dump_ = NULL;
   } else {
-    WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo,
-                 ViEId(engine_id_, channel_id_),
+    WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, channel_id_,
                  "StopRTPDump: RTP dump not started");
     return -1;
   }
diff --git a/src/video_engine/vie_receiver.h b/src/video_engine/vie_receiver.h
index b6633ca..a36a6d0 100644
--- a/src/video_engine/vie_receiver.h
+++ b/src/video_engine/vie_receiver.h
@@ -30,13 +30,14 @@
 
 class ViEReceiver : public UdpTransportData, public RtpData {
  public:
-  ViEReceiver(int engine_id, int channel_id, RtpRtcp& rtp_rtcp,
-              VideoCodingModule& module_vcm);
+  ViEReceiver(const int32_t channel_id, VideoCodingModule* module_vcm);
   ~ViEReceiver();
 
   int RegisterExternalDecryption(Encryption* decryption);
   int DeregisterExternalDecryption();
 
+  void SetRtpRtcpModule(RtpRtcp* module);
+
   void RegisterSimulcastRtpRtcpModules(const std::list<RtpRtcp*>& rtp_modules);
 
   void StartReceive();
@@ -70,11 +71,10 @@
   int InsertRTCPPacket(const WebRtc_Word8* rtcp_packet, int rtcp_packet_length);
 
   scoped_ptr<CriticalSectionWrapper> receive_cs_;
-  int engine_id_;
-  int channel_id_;
-  RtpRtcp& rtp_rtcp_;
+  const int32_t channel_id_;
+  RtpRtcp* rtp_rtcp_;
   std::list<RtpRtcp*> rtp_rtcp_simulcast_;
-  VideoCodingModule& vcm_;
+  VideoCodingModule* vcm_;
 
   Encryption* external_decryption_;
   WebRtc_UWord8* decryption_buffer_;
diff --git a/src/video_engine/vie_sender.cc b/src/video_engine/vie_sender.cc
index cee4086..ca88db9 100644
--- a/src/video_engine/vie_sender.cc
+++ b/src/video_engine/vie_sender.cc
@@ -17,9 +17,8 @@
 
 namespace webrtc {
 
-ViESender::ViESender(int engine_id, int channel_id)
-    : engine_id_(engine_id),
-      channel_id_(channel_id),
+ViESender::ViESender(int channel_id)
+    : channel_id_(channel_id),
       critsect_(CriticalSectionWrapper::CreateCriticalSection()),
       external_encryption_(NULL),
       encryption_buffer_(NULL),
@@ -92,8 +91,7 @@
   } else {
     rtp_dump_ = RtpDump::CreateRtpDump();
     if (rtp_dump_ == NULL) {
-      WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo,
-                   ViEId(engine_id_, channel_id_),
+      WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, channel_id_,
                    "StartSRTPDump: Failed to create RTP dump");
       return -1;
     }
@@ -101,8 +99,7 @@
   if (rtp_dump_->Start(file_nameUTF8) != 0) {
     RtpDump::DestroyRtpDump(rtp_dump_);
     rtp_dump_ = NULL;
-    WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo,
-                 ViEId(engine_id_, channel_id_),
+    WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, channel_id_,
                  "StartRTPDump: Failed to start RTP dump");
     return -1;
   }
@@ -115,15 +112,13 @@
     if (rtp_dump_->IsActive()) {
       rtp_dump_->Stop();
     } else {
-      WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo,
-                   ViEId(engine_id_, channel_id_),
+      WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, channel_id_,
                    "StopRTPDump: Dump not active");
     }
     RtpDump::DestroyRtpDump(rtp_dump_);
     rtp_dump_ = NULL;
   } else {
-    WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo,
-                 ViEId(engine_id_, channel_id_),
+    WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, channel_id_,
                  "StopRTPDump: RTP dump not started");
     return -1;
   }
@@ -136,7 +131,6 @@
     // No transport
     return -1;
   }
-
   assert(ChannelId(vie_id) == channel_id_);
 
   // TODO(mflodman) Change decrypt to get rid of this cast.
@@ -154,12 +148,10 @@
                                   static_cast<int*>(&send_packet_length));
     send_packet = encryption_buffer_;
   }
-
   const int bytes_sent = transport_->SendPacket(channel_id_, send_packet,
                                                 send_packet_length);
   if (bytes_sent != send_packet_length) {
-    WEBRTC_TRACE(webrtc::kTraceWarning, webrtc::kTraceVideo,
-                 ViEId(engine_id_, channel_id_),
+    WEBRTC_TRACE(webrtc::kTraceWarning, webrtc::kTraceVideo, channel_id_,
                  "ViESender::SendPacket - Transport failed to send RTP packet");
   }
   return bytes_sent;
@@ -195,8 +187,7 @@
                                                     send_packet_length);
   if (bytes_sent != send_packet_length) {
     WEBRTC_TRACE(
-        webrtc::kTraceWarning, webrtc::kTraceVideo,
-        ViEId(engine_id_, channel_id_),
+        webrtc::kTraceWarning, webrtc::kTraceVideo, channel_id_,
         "ViESender::SendRTCPPacket - Transport failed to send RTCP packet");
   }
   return bytes_sent;
diff --git a/src/video_engine/vie_sender.h b/src/video_engine/vie_sender.h
index a60446d..6c3a110 100644
--- a/src/video_engine/vie_sender.h
+++ b/src/video_engine/vie_sender.h
@@ -1,5 +1,5 @@
 /*
- *  Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
+ *  Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
  *
  *  Use of this source code is governed by a BSD-style license
  *  that can be found in the LICENSE file in the root of the source
@@ -29,7 +29,7 @@
 
 class ViESender: public Transport {
  public:
-  ViESender(int engine_id, int channel_id);
+  explicit ViESender(const int32_t channel_id);
   ~ViESender();
 
   // Registers an encryption class to use before sending packets.
@@ -49,8 +49,7 @@
   virtual int SendRTCPPacket(int vie_id, const void* data, int len);
 
  private:
-  int engine_id_;
-  int channel_id_;
+  const int32_t channel_id_;
 
   scoped_ptr<CriticalSectionWrapper> critsect_;
 
diff --git a/src/video_engine/vie_sync_module.cc b/src/video_engine/vie_sync_module.cc
index ea1c558..5e4f719 100644
--- a/src/video_engine/vie_sync_module.cc
+++ b/src/video_engine/vie_sync_module.cc
@@ -23,12 +23,13 @@
 enum { kMaxAudioDiffMs = 80 };
 enum { kMaxDelay = 1500 };
 
-ViESyncModule::ViESyncModule(int id, VideoCodingModule& vcm,
-                             RtpRtcp& rtcp_module)
+const float FracMS = 4.294967296E6f;
+
+ViESyncModule::ViESyncModule(const int32_t channel_id, VideoCodingModule* vcm)
     : data_cs_(CriticalSectionWrapper::CreateCriticalSection()),
-      id_(id),
+      channel_id_(channel_id),
       vcm_(vcm),
-      rtcp_module_(rtcp_module),
+      video_rtcp_module_(NULL),
       voe_channel_id_(-1),
       voe_sync_interface_(NULL),
       last_sync_time_(TickTime::Now()) {
@@ -37,12 +38,13 @@
 ViESyncModule::~ViESyncModule() {
 }
 
-int ViESyncModule::SetVoiceChannel(int voe_channel_id,
-                                   VoEVideoSync* voe_sync_interface) {
+int ViESyncModule::ConfigureSync(int voe_channel_id,
+                                 VoEVideoSync* voe_sync_interface,
+                                 RtpRtcp* video_rtcp_module) {
   CriticalSectionScoped cs(data_cs_.get());
   voe_channel_id_ = voe_channel_id;
   voe_sync_interface_ = voe_sync_interface;
-  rtcp_module_.DeRegisterSyncModule();
+  video_rtcp_module_ = video_rtcp_module;
 
   if (!voe_sync_interface) {
     voe_channel_id_ = -1;
@@ -52,44 +54,13 @@
     }
     return 0;
   }
-  RtpRtcp* voe_rtp_rtcp = NULL;
-  voe_sync_interface->GetRtpRtcp(voe_channel_id_, voe_rtp_rtcp);
-  return rtcp_module_.RegisterSyncModule(voe_rtp_rtcp);
+  return 0;
 }
 
 int ViESyncModule::VoiceChannel() {
   return voe_channel_id_;
 }
 
-void ViESyncModule::SetNetworkDelay(int network_delay) {
-  channel_delay_.network_delay = network_delay;
-}
-
-WebRtc_Word32 ViESyncModule::Version(char* version,
-                                     WebRtc_UWord32& remaining_buffer_in_bytes,
-                                     WebRtc_UWord32& position) const {
-  if (version == NULL) {
-    WEBRTC_TRACE(webrtc::kTraceWarning, webrtc::kTraceVideo, -1,
-                 "Invalid in argument to ViESyncModule Version()");
-    return -1;
-  }
-  char our_version[] = "ViESyncModule 1.1.0";
-  WebRtc_UWord32 our_length = (WebRtc_UWord32) strlen(our_version);
-  if (remaining_buffer_in_bytes < our_length + 1) {
-    return -1;
-  }
-  memcpy(version, our_version, our_length);
-  version[our_length] = '\0';
-  remaining_buffer_in_bytes -= (our_length + 1);
-  position += (our_length + 1);
-  return 0;
-}
-
-WebRtc_Word32 ViESyncModule::ChangeUniqueId(const WebRtc_Word32 id) {
-  id_ = id;
-  return 0;
-}
-
 WebRtc_Word32 ViESyncModule::TimeUntilNextProcess() {
   return (WebRtc_Word32)(kSyncInterval -
                          (TickTime::Now() - last_sync_time_).Milliseconds());
@@ -99,20 +70,21 @@
   CriticalSectionScoped cs(data_cs_.get());
   last_sync_time_ = TickTime::Now();
 
-  int total_video_delay_target_ms = vcm_.Delay();
-  WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideo, id_,
+  int total_video_delay_target_ms = vcm_->Delay();
+  WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideo, channel_id_,
                "Video delay (JB + decoder) is %d ms",
                total_video_delay_target_ms);
 
   if (voe_channel_id_ == -1) {
     return 0;
   }
+  assert(video_rtcp_module_ && voe_sync_interface_);
 
   int current_audio_delay_ms = 0;
   if (voe_sync_interface_->GetDelayEstimate(voe_channel_id_,
                                             current_audio_delay_ms) != 0) {
     // Could not get VoE delay value, probably not a valid channel Id.
-    WEBRTC_TRACE(webrtc::kTraceStream, webrtc::kTraceVideo, id_,
+    WEBRTC_TRACE(webrtc::kTraceStream, webrtc::kTraceVideo, channel_id_,
                  "%s: VE_GetDelayEstimate error for voice_channel %d",
                  __FUNCTION__, total_video_delay_target_ms, voe_channel_id_);
     return 0;
@@ -124,22 +96,75 @@
   // VoiceEngine report delay estimates even when not started, ignore if the
   // reported value is lower than 40 ms.
   if (current_audio_delay_ms < 40) {
-    WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideo, id_,
+    WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideo, channel_id_,
                  "A/V Sync: Audio delay < 40, skipping.");
     return 0;
   }
 
-  WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideo, id_,
+  RtpRtcp* voice_rtcp_module = NULL;
+  if (0 != voe_sync_interface_->GetRtpRtcp(voe_channel_id_,
+                                           voice_rtcp_module)) {
+    return 0;
+  }
+  assert(voice_rtcp_module);
+
+  uint32_t video_received_ntp_secs = 0;
+  uint32_t video_received_ntp_frac = 0;
+  uint32_t video_rtcp_arrivaltime_secs = 0;
+  uint32_t video_rtcp_arrivaltime_frac = 0;
+
+  if (0 != video_rtcp_module_->RemoteNTP(&video_received_ntp_secs,
+                                         &video_received_ntp_frac,
+                                         &video_rtcp_arrivaltime_secs,
+                                         &video_rtcp_arrivaltime_frac)) {
+    // Failed to get video NTP.
+    return 0;
+  }
+  uint32_t audio_received_ntp_secs = 0;
+  uint32_t audio_received_ntp_frac = 0;
+  uint32_t audio_rtcp_arrivaltime_secs = 0;
+  uint32_t audio_rtcp_arrivaltime_frac = 0;
+
+  if (0 != voice_rtcp_module->RemoteNTP(&audio_received_ntp_secs,
+                                        &audio_received_ntp_frac,
+                                        &audio_rtcp_arrivaltime_secs,
+                                        &audio_rtcp_arrivaltime_frac)) {
+    // Failed to get audio NTP.
+    return 0;
+  }
+  // ReceivedNTPxxx is NTP at sender side when sent.
+  // RTCPArrivalTimexxx is NTP at receiver side when received.
+  // can't use ConvertNTPTimeToMS since calculation can be
+  //  negative
+  int NTPdiff = (audio_received_ntp_secs - video_received_ntp_secs)
+                * 1000;  // ms
+  NTPdiff += static_cast<int>(audio_received_ntp_secs / FracMS -
+                              video_received_ntp_frac / FracMS);
+
+  int RTCPdiff = (audio_rtcp_arrivaltime_secs - video_rtcp_arrivaltime_secs)
+                 * 1000;  // ms
+  RTCPdiff += static_cast<int>(audio_rtcp_arrivaltime_frac / FracMS -
+                               video_rtcp_arrivaltime_frac / FracMS);
+
+  int diff = NTPdiff - RTCPdiff;
+  // if diff is + video is behind
+  if (diff < -1000 || diff > 1000) {
+    // unresonable ignore value.
+    return 0;
+  }
+  channel_delay_.network_delay = diff;
+
+  WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideo, channel_id_,
                "Audio delay is: %d for voice channel: %d",
                current_audio_delay_ms, voe_channel_id_);
-  WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideo, id_,
+  WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideo, channel_id_,
                "Network delay diff is: %d for voice channel: %d",
                channel_delay_.network_delay, voe_channel_id_);
   // Calculate the difference between the lowest possible video delay and
   // the current audio delay.
   current_diff_ms = total_video_delay_target_ms - current_audio_delay_ms +
       channel_delay_.network_delay;
-  WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideo, id_,
+  WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideo, channel_id_,
                "Current diff is: %d for audio channel: %d",
                current_diff_ms, voe_channel_id_);
 
@@ -270,7 +295,7 @@
     }
   }
 
-  WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideo, id_,
+  WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideo, channel_id_,
       "Sync video delay %d ms for video channel and audio delay %d for audio "
       "channel %d",
       video_delay_ms, channel_delay_.extra_audio_delay_ms, voe_channel_id_);
@@ -278,7 +303,7 @@
   // Set the extra audio delay.synchronization
   if (voe_sync_interface_->SetMinimumPlayoutDelay(
       voe_channel_id_, channel_delay_.extra_audio_delay_ms) == -1) {
-    WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceVideo, id_,
+    WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceVideo, channel_id_,
                  "Error setting voice delay");
   }
 
@@ -288,8 +313,8 @@
   total_video_delay_target_ms =
       (total_video_delay_target_ms  >  video_delay_ms) ?
       total_video_delay_target_ms : video_delay_ms;
-  vcm_.SetMinimumPlayoutDelay(total_video_delay_target_ms);
-  WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideo, id_,
+  vcm_->SetMinimumPlayoutDelay(total_video_delay_target_ms);
+  WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideo, channel_id_,
                "New Video delay target is: %d", total_video_delay_target_ms);
   return 0;
 }
diff --git a/src/video_engine/vie_sync_module.h b/src/video_engine/vie_sync_module.h
index 8dd4f86..052f7e3 100644
--- a/src/video_engine/vie_sync_module.h
+++ b/src/video_engine/vie_sync_module.h
@@ -27,29 +27,24 @@
 
 class ViESyncModule : public Module {
  public:
-  ViESyncModule(int id, VideoCodingModule& vcm, RtpRtcp& rtcp_module);
+  ViESyncModule(const int32_t channel_id, VideoCodingModule* vcm);
   ~ViESyncModule();
 
-  int SetVoiceChannel(int voe_channel_id, VoEVideoSync* voe_sync_interface);
+  int ConfigureSync(int voe_channel_id,
+                    VoEVideoSync* voe_sync_interface,
+                    RtpRtcp* video_rtcp_module);
+
   int VoiceChannel();
 
-  // Set how long time, in ms, voice is ahead of video when received on the
-  // network. Positive value means audio is ahead of video.
-  void SetNetworkDelay(int network_delay);
-
   // Implements Module.
-  virtual WebRtc_Word32 Version(char* version,
-                                WebRtc_UWord32& remaining_buffer_in_bytes,
-                                WebRtc_UWord32& position) const;
-  virtual WebRtc_Word32 ChangeUniqueId(const WebRtc_Word32 id);
   virtual WebRtc_Word32 TimeUntilNextProcess();
   virtual WebRtc_Word32 Process();
 
  private:
   scoped_ptr<CriticalSectionWrapper> data_cs_;
-  int id_;
-  VideoCodingModule& vcm_;
-  RtpRtcp& rtcp_module_;
+  const int32_t channel_id_;
+  VideoCodingModule* vcm_;
+  RtpRtcp* video_rtcp_module_;
   int voe_channel_id_;
   VoEVideoSync* voe_sync_interface_;
   TickTime last_sync_time_;
diff --git a/src/voice_engine/main/source/channel.cc b/src/voice_engine/main/source/channel.cc
index 8159899..125c3e7 100644
--- a/src/voice_engine/main/source/channel.cc
+++ b/src/voice_engine/main/source/channel.cc
@@ -54,13 +54,13 @@
         // Store current audio level in the RTP/RTCP module.
         // The level will be used in combination with voice-activity state
         // (frameType) to add an RTP header extension
-        _rtpRtcpModule.SetAudioLevel(_rtpAudioProc->level_estimator()->RMS());
+        _rtpRtcpModule->SetAudioLevel(_rtpAudioProc->level_estimator()->RMS());
     }
 
     // Push data from ACM to RTP/RTCP-module to deliver audio frame for
     // packetization.
     // This call will trigger Transport::SendPacket() from the RTP/RTCP module.
-    if (_rtpRtcpModule.SendOutgoingData((FrameType&)frameType,
+    if (_rtpRtcpModule->SendOutgoingData((FrameType&)frameType,
                                         payloadType,
                                         timeStamp,
                                         payloadData,
@@ -415,7 +415,7 @@
     // Deliver RTP packet to RTP/RTCP module for parsing
     // The packet will be pushed back to the channel thru the
     // OnReceivedPayloadData callback so we don't push it to the ACM here
-    if (_rtpRtcpModule.IncomingPacket((const WebRtc_UWord8*)rtpBufferPtr,
+    if (_rtpRtcpModule->IncomingPacket((const WebRtc_UWord8*)rtpBufferPtr,
                                       (WebRtc_UWord16)rtpBufferLength) == -1)
     {
         _engineStatisticsPtr->SetLastError(
@@ -493,7 +493,7 @@
     }
 
     // Deliver RTCP packet to RTP/RTCP module for parsing
-    if (_rtpRtcpModule.IncomingPacket((const WebRtc_UWord8*)rtcpBufferPtr,
+    if (_rtpRtcpModule->IncomingPacket((const WebRtc_UWord8*)rtcpBufferPtr,
                                       (WebRtc_UWord16)rtcpBufferLength) == -1)
     {
         _engineStatisticsPtr->SetLastError(
@@ -562,8 +562,8 @@
     assert(channel == _channelId);
 
     // Reset RTP-module counters since a new incoming RTP stream is detected
-    _rtpRtcpModule.ResetReceiveDataCountersRTP();
-    _rtpRtcpModule.ResetStatisticsRTP();
+    _rtpRtcpModule->ResetReceiveDataCountersRTP();
+    _rtpRtcpModule->ResetStatisticsRTP();
 
     if (_rtpObserver)
     {
@@ -1062,8 +1062,6 @@
     _callbackCritSect(*CriticalSectionWrapper::CreateCriticalSection()),
     _instanceId(instanceId),
     _channelId(channelId),
-    _rtpRtcpModule(*RtpRtcp::CreateRtpRtcp(VoEModuleId(
-        instanceId, channelId), true)),
     _audioCodingModule(*AudioCodingModule::Create(
         VoEModuleId(instanceId, channelId))),
 #ifndef WEBRTC_EXTERNAL_TRANSPORT
@@ -1172,6 +1170,17 @@
     _inbandDtmfGenerator.Init();
     _outputAudioLevel.Clear();
 
+    RtpRtcp::Configuration configuration;
+    configuration.id = VoEModuleId(instanceId, channelId);
+    configuration.audio = true;
+    configuration.incoming_data = this;
+    configuration.incoming_messages = this;
+    configuration.outgoing_transport = this;
+    configuration.rtcp_feedback = this;
+    configuration.audio_messages = this;
+
+    _rtpRtcpModule.reset(RtpRtcp::CreateRtpRtcp(configuration));
+
     // Create far end AudioProcessing Module
     _rxAudioProcessingModulePtr = AudioProcessing::Create(
         VoEModuleId(instanceId, channelId));
@@ -1234,38 +1243,6 @@
     // 1. De-register callbacks in modules
     // 2. De-register modules in process thread
     // 3. Destroy modules
-
-    // De-register all RTP module callbacks to ensure geting no callbacks
-    // (Receive socket callback was de-registered above)
-    if (_rtpRtcpModule.RegisterIncomingDataCallback(NULL) == -1)
-    {
-        WEBRTC_TRACE(kTraceWarning, kTraceVoice,
-                     VoEId(_instanceId,_channelId),
-                     "~Channel() failed to de-register incoming data callback"
-                     " (RTP module)");
-    }
-    if (_rtpRtcpModule.RegisterSendTransport(NULL) == -1)
-    {
-        WEBRTC_TRACE(kTraceWarning, kTraceVoice,
-                     VoEId(_instanceId,_channelId),
-                     "~Channel() failed to de-register send transport "
-                     "(RTP module)");
-    }
-    if (_rtpRtcpModule.RegisterIncomingRTPCallback(NULL) == -1)
-    {
-        WEBRTC_TRACE(kTraceWarning, kTraceVoice,
-                     VoEId(_instanceId,_channelId),
-                     "~Channel() failed to de-register incoming RTP"
-                     " callback (RTP module)");
-    }
-    _rtpRtcpModule.RegisterRtcpObservers(NULL, NULL, NULL);
-    if (_rtpRtcpModule.RegisterAudioCallback(NULL) == -1)
-    {
-        WEBRTC_TRACE(kTraceWarning, kTraceVoice,
-                     VoEId(_instanceId,_channelId),
-                     "~Channel() failed to de-register audio callback "
-                     "(RTP module)");
-    }
     if (_audioCodingModule.RegisterTransportCallback(NULL) == -1)
     {
         WEBRTC_TRACE(kTraceWarning, kTraceVoice,
@@ -1299,7 +1276,7 @@
                      "~Channel() failed to deregister socket module");
     }
 #endif
-    if (_moduleProcessThreadPtr->DeRegisterModule(&_rtpRtcpModule) == -1)
+    if (_moduleProcessThreadPtr->DeRegisterModule(_rtpRtcpModule.get()) == -1)
     {
         WEBRTC_TRACE(kTraceInfo, kTraceVoice,
                      VoEId(_instanceId,_channelId),
@@ -1311,7 +1288,6 @@
     UdpTransport::Destroy(
         &_socketTransportModule);
 #endif
-    RtpRtcp::DestroyRtpRtcp(&_rtpRtcpModule);
     AudioCodingModule::Destroy(&_audioCodingModule);
 #ifdef WEBRTC_SRTP
     SrtpModule::DestroySrtpModule(&_srtpModule);
@@ -1355,7 +1331,7 @@
     // --- Add modules to process thread (for periodic schedulation)
 
     const bool processThreadFail =
-        ((_moduleProcessThreadPtr->RegisterModule(&_rtpRtcpModule) != 0) ||
+        ((_moduleProcessThreadPtr->RegisterModule(_rtpRtcpModule.get()) != 0) ||
 #ifndef WEBRTC_EXTERNAL_TRANSPORT
         (_moduleProcessThreadPtr->RegisterModule(
                 &_socketTransportModule) != 0));
@@ -1393,11 +1369,9 @@
     // be transmitted since the Transport object will then be invalid.
 
     const bool rtpRtcpFail =
-        ((_rtpRtcpModule.InitReceiver() == -1) ||
-        (_rtpRtcpModule.InitSender() == -1) ||
-        (_rtpRtcpModule.SetTelephoneEventStatus(false, true, true) == -1) ||
+        ((_rtpRtcpModule->SetTelephoneEventStatus(false, true, true) == -1) ||
         // RTCP is enabled by default
-        (_rtpRtcpModule.SetRTCPStatus(kRtcpCompound) == -1));
+        (_rtpRtcpModule->SetRTCPStatus(kRtcpCompound) == -1));
     if (rtpRtcpFail)
     {
         _engineStatisticsPtr->SetLastError(
@@ -1407,13 +1381,7 @@
     }
 
      // --- Register all permanent callbacks
-    _rtpRtcpModule.RegisterRtcpObservers(NULL, NULL, this);
-
     const bool fail =
-        (_rtpRtcpModule.RegisterIncomingDataCallback(this) == -1) ||
-        (_rtpRtcpModule.RegisterIncomingRTPCallback(this) == -1) ||
-        (_rtpRtcpModule.RegisterSendTransport(this) == -1) ||
-        (_rtpRtcpModule.RegisterAudioCallback(this) == -1) ||
         (_audioCodingModule.RegisterTransportCallback(this) == -1) ||
         (_audioCodingModule.RegisterVADCallback(this) == -1);
 
@@ -1435,7 +1403,7 @@
     {
         // Open up the RTP/RTCP receiver for all supported codecs
         if ((_audioCodingModule.Codec(idx, codec) == -1) ||
-            (_rtpRtcpModule.RegisterReceivePayload(codec) == -1))
+            (_rtpRtcpModule->RegisterReceivePayload(codec) == -1))
         {
             WEBRTC_TRACE(kTraceWarning, kTraceVoice,
                          VoEId(_instanceId,_channelId),
@@ -1463,7 +1431,7 @@
         // Register default PT for outband 'telephone-event'
         if (!STR_CASE_CMP(codec.plname, "telephone-event"))
         {
-            if ((_rtpRtcpModule.RegisterSendPayload(codec) == -1) ||
+            if ((_rtpRtcpModule->RegisterSendPayload(codec) == -1) ||
                 (_audioCodingModule.RegisterReceiveCodec(codec) == -1))
             {
                 WEBRTC_TRACE(kTraceWarning, kTraceVoice,
@@ -1478,7 +1446,7 @@
         {
             if ((_audioCodingModule.RegisterSendCodec(codec) == -1) ||
                 (_audioCodingModule.RegisterReceiveCodec(codec) == -1) ||
-                (_rtpRtcpModule.RegisterSendPayload(codec) == -1))
+                (_rtpRtcpModule->RegisterSendPayload(codec) == -1))
             {
                 WEBRTC_TRACE(kTraceWarning, kTraceVoice,
                              VoEId(_instanceId,_channelId),
@@ -1677,7 +1645,7 @@
         _sending = true;
     }
 
-    if (_rtpRtcpModule.SetSendingStatus(true) != 0)
+    if (_rtpRtcpModule->SetSendingStatus(true) != 0)
     {
         _engineStatisticsPtr->SetLastError(
             VE_RTP_RTCP_MODULE_ERROR, kTraceError,
@@ -1709,8 +1677,8 @@
 
     // Reset sending SSRC and sequence number and triggers direct transmission
     // of RTCP BYE
-    if (_rtpRtcpModule.SetSendingStatus(false) == -1 ||
-        _rtpRtcpModule.ResetSendDataCountersRTP() == -1)
+    if (_rtpRtcpModule->SetSendingStatus(false) == -1 ||
+        _rtpRtcpModule->ResetSendDataCountersRTP() == -1)
     {
         _engineStatisticsPtr->SetLastError(
             VE_RTP_RTCP_MODULE_ERROR, kTraceWarning,
@@ -1779,16 +1747,10 @@
         }
     }
 #endif
-    bool dtmfDetection = _rtpRtcpModule.TelephoneEvent();
-    WebRtc_Word32 ret = _rtpRtcpModule.InitReceiver();
-    if (ret != 0) {
-        _engineStatisticsPtr->SetLastError(
-            VE_RTP_RTCP_MODULE_ERROR, kTraceError,
-            "StopReceiving() failed to reinitialize the RTP receiver.");
-        return -1;
-    }
+    bool dtmfDetection = _rtpRtcpModule->TelephoneEvent();
     // Recover DTMF detection status.
-    ret = _rtpRtcpModule.SetTelephoneEventStatus(dtmfDetection, true, true);
+    WebRtc_Word32 ret = _rtpRtcpModule->SetTelephoneEventStatus(dtmfDetection,
+                                                               true, true);
     if (ret != 0) {
         _engineStatisticsPtr->SetLastError(
             VE_INVALID_OPERATION, kTraceWarning,
@@ -2309,10 +2271,10 @@
         return -1;
     }
 
-    if (_rtpRtcpModule.RegisterSendPayload(codec) != 0)
+    if (_rtpRtcpModule->RegisterSendPayload(codec) != 0)
     {
-        _rtpRtcpModule.DeRegisterSendPayload(codec.pltype);
-        if (_rtpRtcpModule.RegisterSendPayload(codec) != 0)
+        _rtpRtcpModule->DeRegisterSendPayload(codec.pltype);
+        if (_rtpRtcpModule->RegisterSendPayload(codec) != 0)
         {
             WEBRTC_TRACE(
                     kTraceError, kTraceVoice, VoEId(_instanceId,_channelId),
@@ -2322,7 +2284,7 @@
         }
     }
 
-    if (_rtpRtcpModule.SetAudioPacketSize(codec.pacsize) != 0)
+    if (_rtpRtcpModule->SetAudioPacketSize(codec.pacsize) != 0)
     {
         WEBRTC_TRACE(kTraceError, kTraceVoice, VoEId(_instanceId,_channelId),
                      "SetSendCodec() failed to set audio packet size");
@@ -2394,10 +2356,10 @@
         CodecInst rxCodec = codec;
 
         // Get payload type for the given codec
-        _rtpRtcpModule.ReceivePayloadType(rxCodec, &pltype);
+        _rtpRtcpModule->ReceivePayloadType(rxCodec, &pltype);
         rxCodec.pltype = pltype;
 
-        if (_rtpRtcpModule.DeRegisterReceivePayload(pltype) != 0)
+        if (_rtpRtcpModule->DeRegisterReceivePayload(pltype) != 0)
         {
             _engineStatisticsPtr->SetLastError(
                     VE_RTP_RTCP_MODULE_ERROR,
@@ -2416,11 +2378,11 @@
         return 0;
     }
 
-    if (_rtpRtcpModule.RegisterReceivePayload(codec) != 0)
+    if (_rtpRtcpModule->RegisterReceivePayload(codec) != 0)
     {
         // First attempt to register failed => de-register and try again
-        _rtpRtcpModule.DeRegisterReceivePayload(codec.pltype);
-        if (_rtpRtcpModule.RegisterReceivePayload(codec) != 0)
+        _rtpRtcpModule->DeRegisterReceivePayload(codec.pltype);
+        if (_rtpRtcpModule->RegisterReceivePayload(codec) != 0)
         {
             _engineStatisticsPtr->SetLastError(
                 VE_RTP_RTCP_MODULE_ERROR, kTraceError,
@@ -2448,7 +2410,7 @@
     WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId,_channelId),
                  "Channel::GetRecPayloadType()");
     WebRtc_Word8 payloadType(-1);
-    if (_rtpRtcpModule.ReceivePayloadType(codec, &payloadType) != 0)
+    if (_rtpRtcpModule->ReceivePayloadType(codec, &payloadType) != 0)
     {
         _engineStatisticsPtr->SetLastError(
             VE_RTP_RTCP_MODULE_ERROR, kTraceError,
@@ -2535,10 +2497,10 @@
         return -1;
     }
 
-    if (_rtpRtcpModule.RegisterSendPayload(codec) != 0)
+    if (_rtpRtcpModule->RegisterSendPayload(codec) != 0)
     {
-        _rtpRtcpModule.DeRegisterSendPayload(codec.pltype);
-        if (_rtpRtcpModule.RegisterSendPayload(codec) != 0)
+        _rtpRtcpModule->DeRegisterSendPayload(codec.pltype);
+        if (_rtpRtcpModule->RegisterSendPayload(codec) != 0)
         {
             _engineStatisticsPtr->SetLastError(
                 VE_RTP_RTCP_MODULE_ERROR, kTraceError,
@@ -3196,13 +3158,13 @@
     {
         const WebRtc_UWord32 RTPtimeoutMS = 1000*timeoutSeconds;
         const WebRtc_UWord32 RTCPtimeoutMS = 0;
-        _rtpRtcpModule.SetPacketTimeout(RTPtimeoutMS, RTCPtimeoutMS);
+        _rtpRtcpModule->SetPacketTimeout(RTPtimeoutMS, RTCPtimeoutMS);
         _rtpPacketTimeOutIsEnabled = true;
         _rtpTimeOutSeconds = timeoutSeconds;
     }
     else
     {
-        _rtpRtcpModule.SetPacketTimeout(0, 0);
+        _rtpRtcpModule->SetPacketTimeout(0, 0);
         _rtpPacketTimeOutIsEnabled = false;
         _rtpTimeOutSeconds = 0;
     }
@@ -3285,9 +3247,9 @@
     bool enabled(false);
     WebRtc_UWord8 currentSampleTimeSec(0);
     // Store last state (will be used later if dead-or-alive is disabled).
-    _rtpRtcpModule.PeriodicDeadOrAliveStatus(enabled, currentSampleTimeSec);
+    _rtpRtcpModule->PeriodicDeadOrAliveStatus(enabled, currentSampleTimeSec);
     // Update the dead-or-alive state.
-    if (_rtpRtcpModule.SetPeriodicDeadOrAliveStatus(
+    if (_rtpRtcpModule->SetPeriodicDeadOrAliveStatus(
         enable, (WebRtc_UWord8)sampleTimeSeconds) != 0)
     {
         _engineStatisticsPtr->SetLastError(
@@ -3303,7 +3265,7 @@
         // Without this, the sample time would always be reset to default
         // (2 sec), each time dead-or-alived was disabled without sample-time
         // parameter.
-        _rtpRtcpModule.SetPeriodicDeadOrAliveStatus(enable,
+        _rtpRtcpModule->SetPeriodicDeadOrAliveStatus(enable,
                                                     currentSampleTimeSec);
     }
     return 0;
@@ -3312,7 +3274,7 @@
 WebRtc_Word32
 Channel::GetPeriodicDeadOrAliveStatus(bool& enabled, int& sampleTimeSeconds)
 {
-    _rtpRtcpModule.PeriodicDeadOrAliveStatus(
+    _rtpRtcpModule->PeriodicDeadOrAliveStatus(
         enabled,
         (WebRtc_UWord8&)sampleTimeSeconds);
     WEBRTC_TRACE(kTraceStateInfo, kTraceVoice, VoEId(_instanceId,-1),
@@ -3337,7 +3299,7 @@
             "SendUDPPacket() external transport is enabled");
         return -1;
     }
-    if (useRtcpSocket && !_rtpRtcpModule.RTCP())
+    if (useRtcpSocket && !_rtpRtcpModule->RTCP())
     {
         _engineStatisticsPtr->SetLastError(
             VE_RTCP_ERROR, kTraceError,
@@ -4423,7 +4385,7 @@
 
     _playOutbandDtmfEvent = playDtmfEvent;
 
-    if (_rtpRtcpModule.SendTelephoneEventOutband(eventCode, lengthMs,
+    if (_rtpRtcpModule->SendTelephoneEventOutband(eventCode, lengthMs,
                                                  attenuationDb) != 0)
     {
         _engineStatisticsPtr->SetLastError(
@@ -4487,7 +4449,7 @@
     codec.plfreq = 8000;
     codec.pltype = type;
     memcpy(codec.plname, "telephone-event", 16);
-    if (_rtpRtcpModule.RegisterSendPayload(codec) != 0)
+    if (_rtpRtcpModule->RegisterSendPayload(codec) != 0)
     {
         _engineStatisticsPtr->SetLastError(
             VE_RTP_RTCP_MODULE_ERROR, kTraceError,
@@ -4569,9 +4531,9 @@
     // When enabled, RtpAudioFeedback::OnReceivedTelephoneEvent() will be
     // called two times by the RTP/RTCP module (start & end).
     const bool forwardToDecoder =
-        _rtpRtcpModule.TelephoneEventForwardToDecoder();
+        _rtpRtcpModule->TelephoneEventForwardToDecoder();
     const bool detectEndOfTone = true;
-    _rtpRtcpModule.SetTelephoneEventStatus(_outOfBandTelephoneEventDetecion,
+    _rtpRtcpModule->SetTelephoneEventStatus(_outOfBandTelephoneEventDetecion,
                                            forwardToDecoder,
                                            detectEndOfTone);
 
@@ -4597,8 +4559,8 @@
 
     // Disable out-of-band event detection
     const bool forwardToDecoder =
-        _rtpRtcpModule.TelephoneEventForwardToDecoder();
-    _rtpRtcpModule.SetTelephoneEventStatus(false, forwardToDecoder);
+        _rtpRtcpModule->TelephoneEventForwardToDecoder();
+    _rtpRtcpModule->SetTelephoneEventStatus(false, forwardToDecoder);
 
     // Disable in-band Dtmf detection
     _audioCodingModule.RegisterIncomingMessagesCallback(NULL);
@@ -5057,7 +5019,7 @@
             "SetLocalSSRC() already sending");
         return -1;
     }
-    if (_rtpRtcpModule.SetSSRC(ssrc) != 0)
+    if (_rtpRtcpModule->SetSSRC(ssrc) != 0)
     {
         _engineStatisticsPtr->SetLastError(
             VE_RTP_RTCP_MODULE_ERROR, kTraceError,
@@ -5070,7 +5032,7 @@
 int
 Channel::GetLocalSSRC(unsigned int& ssrc)
 {
-    ssrc = _rtpRtcpModule.SSRC();
+    ssrc = _rtpRtcpModule->SSRC();
     WEBRTC_TRACE(kTraceStateInfo, kTraceVoice,
                  VoEId(_instanceId,_channelId),
                  "GetLocalSSRC() => ssrc=%lu", ssrc);
@@ -5080,7 +5042,7 @@
 int
 Channel::GetRemoteSSRC(unsigned int& ssrc)
 {
-    ssrc = _rtpRtcpModule.RemoteSSRC();
+    ssrc = _rtpRtcpModule->RemoteSSRC();
     WEBRTC_TRACE(kTraceStateInfo, kTraceVoice,
                  VoEId(_instanceId,_channelId),
                  "GetRemoteSSRC() => ssrc=%lu", ssrc);
@@ -5099,7 +5061,7 @@
     }
     WebRtc_UWord32 arrOfCSRC[kRtpCsrcSize];
     WebRtc_Word32 CSRCs(0);
-    CSRCs = _rtpRtcpModule.CSRCs(arrOfCSRC);
+    CSRCs = _rtpRtcpModule->CSRCs(arrOfCSRC);
     if (CSRCs > 0)
     {
         memcpy(arrCSRC, arrOfCSRC, CSRCs * sizeof(WebRtc_UWord32));
@@ -5141,7 +5103,7 @@
     }
 
     _includeAudioLevelIndication = enable;
-    return _rtpRtcpModule.SetRTPAudioLevelIndicationStatus(enable, ID);
+    return _rtpRtcpModule->SetRTPAudioLevelIndicationStatus(enable, ID);
 }
 int
 Channel::GetRTPAudioLevelIndicationStatus(bool& enabled, unsigned char& ID)
@@ -5150,7 +5112,7 @@
                  VoEId(_instanceId,_channelId),
                  "GetRTPAudioLevelIndicationStatus() => enabled=%d, ID=%u",
                  enabled, ID);
-    return _rtpRtcpModule.GetRTPAudioLevelIndicationStatus(enabled, ID);
+    return _rtpRtcpModule->GetRTPAudioLevelIndicationStatus(enabled, ID);
 }
 
 int
@@ -5158,7 +5120,7 @@
 {
     WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId,_channelId),
                  "Channel::SetRTCPStatus()");
-    if (_rtpRtcpModule.SetRTCPStatus(enable ?
+    if (_rtpRtcpModule->SetRTCPStatus(enable ?
         kRtcpCompound : kRtcpOff) != 0)
     {
         _engineStatisticsPtr->SetLastError(
@@ -5172,7 +5134,7 @@
 int
 Channel::GetRTCPStatus(bool& enabled)
 {
-    RTCPMethod method = _rtpRtcpModule.RTCP();
+    RTCPMethod method = _rtpRtcpModule->RTCP();
     enabled = (method != kRtcpOff);
     WEBRTC_TRACE(kTraceStateInfo, kTraceVoice,
                  VoEId(_instanceId,_channelId),
@@ -5185,7 +5147,7 @@
 {
     WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, _channelId),
                  "Channel::SetRTCP_CNAME()");
-    if (_rtpRtcpModule.SetCNAME(cName) != 0)
+    if (_rtpRtcpModule->SetCNAME(cName) != 0)
     {
         _engineStatisticsPtr->SetLastError(
             VE_RTP_RTCP_MODULE_ERROR, kTraceError,
@@ -5198,7 +5160,7 @@
 int
 Channel::GetRTCP_CNAME(char cName[256])
 {
-    if (_rtpRtcpModule.CNAME(cName) != 0)
+    if (_rtpRtcpModule->CNAME(cName) != 0)
     {
         _engineStatisticsPtr->SetLastError(
             VE_RTP_RTCP_MODULE_ERROR, kTraceError,
@@ -5222,8 +5184,8 @@
         return -1;
     }
     char cname[RTCP_CNAME_SIZE];
-    const WebRtc_UWord32 remoteSSRC = _rtpRtcpModule.RemoteSSRC();
-    if (_rtpRtcpModule.RemoteCNAME(remoteSSRC, cname) != 0)
+    const WebRtc_UWord32 remoteSSRC = _rtpRtcpModule->RemoteSSRC();
+    if (_rtpRtcpModule->RemoteCNAME(remoteSSRC, cname) != 0)
     {
         _engineStatisticsPtr->SetLastError(
             VE_CANNOT_RETRIEVE_CNAME, kTraceError,
@@ -5249,7 +5211,7 @@
     // --- Information from sender info in received Sender Reports
 
     RTCPSenderInfo senderInfo;
-    if (_rtpRtcpModule.RemoteRTCPStat(&senderInfo) != 0)
+    if (_rtpRtcpModule->RemoteRTCPStat(&senderInfo) != 0)
     {
         _engineStatisticsPtr->SetLastError(
             VE_RTP_RTCP_MODULE_ERROR, kTraceError,
@@ -5288,7 +5250,7 @@
         // remote SSRC and use the report block from him.
         // Otherwise use the first report block.
         std::vector<RTCPReportBlock> remote_stats;
-        if (_rtpRtcpModule.RemoteRTCPStat(&remote_stats) != 0 ||
+        if (_rtpRtcpModule->RemoteRTCPStat(&remote_stats) != 0 ||
             remote_stats.empty()) {
           WEBRTC_TRACE(kTraceWarning, kTraceVoice,
                        VoEId(_instanceId, _channelId),
@@ -5297,7 +5259,7 @@
           return -1;
         }
 
-        WebRtc_UWord32 remoteSSRC = _rtpRtcpModule.RemoteSSRC();
+        WebRtc_UWord32 remoteSSRC = _rtpRtcpModule->RemoteSSRC();
         std::vector<RTCPReportBlock>::const_iterator it = remote_stats.begin();
         for (; it != remote_stats.end(); ++it) {
           if (it->remoteSSRC == remoteSSRC)
@@ -5359,7 +5321,7 @@
             "SendApplicationDefinedRTCPPacket() invalid length value");
         return -1;
     }
-    RTCPMethod status = _rtpRtcpModule.RTCP();
+    RTCPMethod status = _rtpRtcpModule->RTCP();
     if (status == kRtcpOff)
     {
         _engineStatisticsPtr->SetLastError(
@@ -5369,7 +5331,7 @@
     }
 
     // Create and schedule the RTCP APP packet for transmission
-    if (_rtpRtcpModule.SetRTCPApplicationSpecificData(
+    if (_rtpRtcpModule->SetRTCPApplicationSpecificData(
         subType,
         name,
         (const unsigned char*) data,
@@ -5397,7 +5359,7 @@
 
     // The jitter statistics is updated for each received RTP packet and is
     // based on received packets.
-    if (_rtpRtcpModule.StatisticsRTP(&fraction_lost,
+    if (_rtpRtcpModule->StatisticsRTP(&fraction_lost,
                                      &cum_lost,
                                      &ext_max,
                                      &jitter,
@@ -5441,7 +5403,7 @@
 
     // The jitter statistics is updated for each received RTP packet and is
     // based on received packets.
-    if (_rtpRtcpModule.StatisticsRTP(&fraction_lost,
+    if (_rtpRtcpModule->StatisticsRTP(&fraction_lost,
                                      &cum_lost,
                                      &ext_max,
                                      &jitter,
@@ -5468,7 +5430,7 @@
     // --- Part two of the final structure (one value)
 
     WebRtc_UWord16 RTT(0);
-    RTCPMethod method = _rtpRtcpModule.RTCP();
+    RTCPMethod method = _rtpRtcpModule->RTCP();
     if (method == kRtcpOff)
     {
         WEBRTC_TRACE(kTraceWarning, kTraceVoice,
@@ -5478,14 +5440,14 @@
     } else
     {
         // The remote SSRC will be zero if no RTP packet has been received.
-        WebRtc_UWord32 remoteSSRC = _rtpRtcpModule.RemoteSSRC();
+        WebRtc_UWord32 remoteSSRC = _rtpRtcpModule->RemoteSSRC();
         if (remoteSSRC > 0)
         {
             WebRtc_UWord16 avgRTT(0);
             WebRtc_UWord16 maxRTT(0);
             WebRtc_UWord16 minRTT(0);
 
-            if (_rtpRtcpModule.RTT(remoteSSRC, &RTT, &avgRTT, &minRTT, &maxRTT)
+            if (_rtpRtcpModule->RTT(remoteSSRC, &RTT, &avgRTT, &minRTT, &maxRTT)
                 != 0)
             {
                 WEBRTC_TRACE(kTraceWarning, kTraceVoice,
@@ -5515,7 +5477,7 @@
     WebRtc_UWord32 bytesReceived(0);
     WebRtc_UWord32 packetsReceived(0);
 
-    if (_rtpRtcpModule.DataCountersRTP(&bytesSent,
+    if (_rtpRtcpModule->DataCountersRTP(&bytesSent,
                                        &packetsSent,
                                        &bytesReceived,
                                        &packetsReceived) != 0)
@@ -5580,7 +5542,7 @@
             "SetFECStatus() RED registration in ACM module failed");
         return -1;
     }
-    if (_rtpRtcpModule.SetSendREDPayloadType(codec.pltype) != 0)
+    if (_rtpRtcpModule->SetSendREDPayloadType(codec.pltype) != 0)
     {
         _engineStatisticsPtr->SetLastError(
             VE_RTP_RTCP_MODULE_ERROR, kTraceError,
@@ -5604,7 +5566,7 @@
     if (enabled)
     {
         WebRtc_Word8 payloadType(0);
-        if (_rtpRtcpModule.SendREDPayloadType(payloadType) != 0)
+        if (_rtpRtcpModule->SendREDPayloadType(payloadType) != 0)
         {
             _engineStatisticsPtr->SetLastError(
                 VE_RTP_RTCP_MODULE_ERROR, kTraceError,
@@ -5722,7 +5684,7 @@
             "InsertExtraRTPPacket() invalid payload data");
         return -1;
     }
-    if (payloadSize > _rtpRtcpModule.MaxDataPayloadLength())
+    if (payloadSize > _rtpRtcpModule->MaxDataPayloadLength())
     {
         _engineStatisticsPtr->SetLastError(
             VE_INVALID_ARGUMENT, kTraceError,
@@ -5753,7 +5715,7 @@
     _extraMarkerBit = markerBit;
     _insertExtraRTPPacket = true;
 
-    if (_rtpRtcpModule.SendOutgoingData(kAudioFrameSpeech,
+    if (_rtpRtcpModule->SendOutgoingData(kAudioFrameSpeech,
                                         _lastPayloadType,
                                         _lastLocalTimeStamp,
                                         (const WebRtc_UWord8*) payloadData,
@@ -5973,8 +5935,8 @@
     WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId,_channelId),
                  "Channel::ResetRTCPStatistics()");
     WebRtc_UWord32 remoteSSRC(0);
-    remoteSSRC = _rtpRtcpModule.RemoteSSRC();
-    return _rtpRtcpModule.ResetRTT(remoteSSRC);
+    remoteSSRC = _rtpRtcpModule->RemoteSSRC();
+    return _rtpRtcpModule->ResetRTT(remoteSSRC);
 }
 
 int
@@ -5985,7 +5947,7 @@
     // Override default module outputs for the case when RTCP is disabled.
     // This is done to ensure that we are backward compatible with the
     // VoiceEngine where we did not use RTP/RTCP module.
-    if (!_rtpRtcpModule.RTCP())
+    if (!_rtpRtcpModule->RTCP())
     {
         delaysMs.min = -1;
         delaysMs.max = -1;
@@ -6002,7 +5964,7 @@
     WebRtc_UWord16 maxRTT;
     WebRtc_UWord16 minRTT;
     // The remote SSRC will be zero if no RTP packet has been received.
-    remoteSSRC = _rtpRtcpModule.RemoteSSRC();
+    remoteSSRC = _rtpRtcpModule->RemoteSSRC();
     if (remoteSSRC == 0)
     {
         WEBRTC_TRACE(kTraceWarning, kTraceVoice, VoEId(_instanceId,_channelId),
@@ -6013,7 +5975,7 @@
     // Retrieve RTT statistics from the RTP/RTCP module for the specified
     // channel and SSRC. The SSRC is required to parse out the correct source
     // in conference scenarios.
-    if (_rtpRtcpModule.RTT(remoteSSRC, &RTT, &avgRTT, &minRTT,&maxRTT) != 0)
+    if (_rtpRtcpModule->RTT(remoteSSRC, &RTT, &avgRTT, &minRTT,&maxRTT) != 0)
     {
         WEBRTC_TRACE(kTraceWarning, kTraceVoice, VoEId(_instanceId,_channelId),
                      "GetRoundTripTimeSummary unable to retrieve RTT values"
@@ -6101,7 +6063,7 @@
             VE_SENDING, kTraceError, "SetInitTimestamp() already sending");
         return -1;
     }
-    if (_rtpRtcpModule.SetStartTimestamp(timestamp) != 0)
+    if (_rtpRtcpModule->SetStartTimestamp(timestamp) != 0)
     {
         _engineStatisticsPtr->SetLastError(
             VE_RTP_RTCP_MODULE_ERROR, kTraceError,
@@ -6123,7 +6085,7 @@
             "SetInitSequenceNumber() already sending");
         return -1;
     }
-    if (_rtpRtcpModule.SetSequenceNumber(sequenceNumber) != 0)
+    if (_rtpRtcpModule->SetSequenceNumber(sequenceNumber) != 0)
     {
         _engineStatisticsPtr->SetLastError(
             VE_RTP_RTCP_MODULE_ERROR, kTraceError,
@@ -6138,7 +6100,7 @@
 {
     WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId,_channelId),
                  "Channel::GetRtpRtcp()");
-    rtpRtcpModule = &_rtpRtcpModule;
+    rtpRtcpModule = _rtpRtcpModule.get();
     return 0;
 }
 
@@ -6402,7 +6364,7 @@
     bool enabled;
     WebRtc_UWord8 timeSec;
 
-    _rtpRtcpModule.PeriodicDeadOrAliveStatus(enabled, timeSec);
+    _rtpRtcpModule->PeriodicDeadOrAliveStatus(enabled, timeSec);
     if (!enabled)
         return (-1);
 
@@ -6540,7 +6502,7 @@
     {
         // Open up the RTP/RTCP receiver for all supported codecs
         if ((_audioCodingModule.Codec(idx, codec) == -1) ||
-            (_rtpRtcpModule.RegisterReceivePayload(codec) == -1))
+            (_rtpRtcpModule->RegisterReceivePayload(codec) == -1))
         {
             WEBRTC_TRACE(
                          kTraceWarning,
diff --git a/src/voice_engine/main/source/channel.h b/src/voice_engine/main/source/channel.h
index 3551054..b6578ca4 100644
--- a/src/voice_engine/main/source/channel.h
+++ b/src/voice_engine/main/source/channel.h
@@ -493,7 +493,7 @@
     }
     RtpRtcp* RtpRtcpModulePtr() const
     {
-        return &_rtpRtcpModule;
+        return _rtpRtcpModule.get();
     }
     WebRtc_Word8 OutputEnergyLevel() const
     {
@@ -534,7 +534,7 @@
     WebRtc_Word32 _channelId;
 
 private:
-    RtpRtcp& _rtpRtcpModule;
+    scoped_ptr<RtpRtcp> _rtpRtcpModule;
     AudioCodingModule& _audioCodingModule;
 #ifndef WEBRTC_EXTERNAL_TRANSPORT
     WebRtc_UWord8 _numSocketThreads;