| Index: talk/session/media/channel.h
 | 
| diff --git a/talk/session/media/channel.h b/talk/session/media/channel.h
 | 
| index 9cde0d1c70e59efb62c91b097278d81009ed902b..bb430bf3655691b9011c1b49de6f85ecc4cbdaea 100644
 | 
| --- a/talk/session/media/channel.h
 | 
| +++ b/talk/session/media/channel.h
 | 
| @@ -30,15 +30,12 @@
 | 
|  
 | 
|  #include <string>
 | 
|  #include <vector>
 | 
| -#include <map>
 | 
| -#include <set>
 | 
| -#include <utility>
 | 
|  
 | 
|  #include "talk/media/base/mediachannel.h"
 | 
|  #include "talk/media/base/mediaengine.h"
 | 
|  #include "talk/media/base/streamparams.h"
 | 
|  #include "talk/media/base/videocapturer.h"
 | 
| -#include "webrtc/p2p/base/transportcontroller.h"
 | 
| +#include "webrtc/p2p/base/session.h"
 | 
|  #include "webrtc/p2p/client/socketmonitor.h"
 | 
|  #include "talk/session/media/audiomonitor.h"
 | 
|  #include "talk/session/media/bundlefilter.h"
 | 
| @@ -77,11 +74,8 @@
 | 
|        public MediaChannel::NetworkInterface,
 | 
|        public ConnectionStatsGetter {
 | 
|   public:
 | 
| -  BaseChannel(rtc::Thread* thread,
 | 
| -              MediaChannel* channel,
 | 
| -              TransportController* transport_controller,
 | 
| -              const std::string& content_name,
 | 
| -              bool rtcp);
 | 
| +  BaseChannel(rtc::Thread* thread, MediaChannel* channel, BaseSession* session,
 | 
| +              const std::string& content_name, bool rtcp);
 | 
|    virtual ~BaseChannel();
 | 
|    bool Init();
 | 
|    // Deinit may be called multiple times and is simply ignored if it's alreay
 | 
| @@ -89,8 +83,8 @@
 | 
|    void Deinit();
 | 
|  
 | 
|    rtc::Thread* worker_thread() const { return worker_thread_; }
 | 
| -  const std::string& content_name() const { return content_name_; }
 | 
| -  const std::string& transport_name() const { return transport_name_; }
 | 
| +  BaseSession* session() const { return session_; }
 | 
| +  const std::string& content_name() { return content_name_; }
 | 
|    TransportChannel* transport_channel() const {
 | 
|      return transport_channel_;
 | 
|    }
 | 
| @@ -115,7 +109,6 @@
 | 
|    // description doesn't support RTCP mux, setting the remote
 | 
|    // description will fail.
 | 
|    void ActivateRtcpMux();
 | 
| -  bool SetTransport(const std::string& transport_name);
 | 
|    bool PushdownLocalDescription(const SessionDescription* local_desc,
 | 
|                                  ContentAction action,
 | 
|                                  std::string* error_desc);
 | 
| @@ -142,7 +135,7 @@
 | 
|    void StartConnectionMonitor(int cms);
 | 
|    void StopConnectionMonitor();
 | 
|    // For ConnectionStatsGetter, used by ConnectionMonitor
 | 
| -  bool GetConnectionStats(ConnectionInfos* infos) override;
 | 
| +  virtual bool GetConnectionStats(ConnectionInfos* infos) override;
 | 
|  
 | 
|    void set_srtp_signal_silent_time(uint32 silent_time) {
 | 
|      srtp_filter_.set_signal_silent_time(silent_time);
 | 
| @@ -165,16 +158,19 @@
 | 
|    sigslot::signal1<BaseChannel*> SignalFirstPacketReceived;
 | 
|  
 | 
|    // Made public for easier testing.
 | 
| -  void SetReadyToSend(bool rtcp, bool ready);
 | 
| +  void SetReadyToSend(TransportChannel* channel, bool ready);
 | 
|  
 | 
|    // Only public for unit tests.  Otherwise, consider protected.
 | 
|    virtual int SetOption(SocketType type, rtc::Socket::Option o, int val);
 | 
|  
 | 
|   protected:
 | 
|    virtual MediaChannel* media_channel() const { return media_channel_; }
 | 
| -  // Sets the |transport_channel_| (and |rtcp_transport_channel_|, if |rtcp_| is
 | 
| -  // true). Gets the transport channels from |transport_controller_|.
 | 
| -  bool SetTransport_w(const std::string& transport_name);
 | 
| +  // Sets the transport_channel_ and rtcp_transport_channel_.  If
 | 
| +  // |rtcp| is false, set rtcp_transport_channel_ is set to NULL.  Get
 | 
| +  // the transport channels from |session|.
 | 
| +  // TODO(pthatcher): Pass in a Transport instead of a BaseSession.
 | 
| +  bool SetTransportChannels(BaseSession* session, bool rtcp);
 | 
| +  bool SetTransportChannels_w(BaseSession* session, bool rtcp);
 | 
|    void set_transport_channel(TransportChannel* transport);
 | 
|    void set_rtcp_transport_channel(TransportChannel* transport);
 | 
|    bool was_ever_writable() const { return was_ever_writable_; }
 | 
| @@ -189,11 +185,9 @@
 | 
|    }
 | 
|    bool IsReadyToReceive() const;
 | 
|    bool IsReadyToSend() const;
 | 
| -  rtc::Thread* signaling_thread() {
 | 
| -    return transport_controller_->signaling_thread();
 | 
| -  }
 | 
| +  rtc::Thread* signaling_thread() { return session_->signaling_thread(); }
 | 
|    SrtpFilter* srtp_filter() { return &srtp_filter_; }
 | 
| -  bool rtcp_transport_enabled() const { return rtcp_transport_enabled_; }
 | 
| +  bool rtcp() const { return rtcp_; }
 | 
|  
 | 
|    void ConnectToTransportChannel(TransportChannel* tc);
 | 
|    void DisconnectFromTransportChannel(TransportChannel* tc);
 | 
| @@ -223,9 +217,12 @@
 | 
|    void HandlePacket(bool rtcp, rtc::Buffer* packet,
 | 
|                      const rtc::PacketTime& packet_time);
 | 
|  
 | 
| +  // Apply the new local/remote session description.
 | 
| +  void OnNewLocalDescription(BaseSession* session, ContentAction action);
 | 
| +  void OnNewRemoteDescription(BaseSession* session, ContentAction action);
 | 
| +
 | 
|    void EnableMedia_w();
 | 
|    void DisableMedia_w();
 | 
| -  void UpdateWritableState_w();
 | 
|    void ChannelWritable_w();
 | 
|    void ChannelNotWritable_w();
 | 
|    bool AddRecvStream_w(const StreamParams& sp);
 | 
| @@ -296,18 +293,15 @@
 | 
|  
 | 
|   private:
 | 
|    rtc::Thread* worker_thread_;
 | 
| -  TransportController* transport_controller_;
 | 
| +  BaseSession* session_;
 | 
|    MediaChannel* media_channel_;
 | 
|    std::vector<StreamParams> local_streams_;
 | 
|    std::vector<StreamParams> remote_streams_;
 | 
|  
 | 
|    const std::string content_name_;
 | 
| -  std::string transport_name_;
 | 
| -  bool rtcp_transport_enabled_;
 | 
| +  bool rtcp_;
 | 
|    TransportChannel* transport_channel_;
 | 
| -  std::vector<std::pair<rtc::Socket::Option, int> > socket_options_;
 | 
|    TransportChannel* rtcp_transport_channel_;
 | 
| -  std::vector<std::pair<rtc::Socket::Option, int> > rtcp_socket_options_;
 | 
|    SrtpFilter srtp_filter_;
 | 
|    RtcpMuxFilter rtcp_mux_filter_;
 | 
|    BundleFilter bundle_filter_;
 | 
| @@ -329,21 +323,16 @@
 | 
|  // and input/output level monitoring.
 | 
|  class VoiceChannel : public BaseChannel {
 | 
|   public:
 | 
| -  VoiceChannel(rtc::Thread* thread,
 | 
| -               MediaEngineInterface* media_engine,
 | 
| -               VoiceMediaChannel* channel,
 | 
| -               TransportController* transport_controller,
 | 
| -               const std::string& content_name,
 | 
| -               bool rtcp);
 | 
| +  VoiceChannel(rtc::Thread* thread, MediaEngineInterface* media_engine,
 | 
| +               VoiceMediaChannel* channel, BaseSession* session,
 | 
| +               const std::string& content_name, bool rtcp);
 | 
|    ~VoiceChannel();
 | 
|    bool Init();
 | 
|    bool SetRemoteRenderer(uint32 ssrc, AudioRenderer* renderer);
 | 
|  
 | 
|    // Configure sending media on the stream with SSRC |ssrc|
 | 
|    // If there is only one sending stream SSRC 0 can be used.
 | 
| -  bool SetAudioSend(uint32 ssrc,
 | 
| -                    bool mute,
 | 
| -                    const AudioOptions* options,
 | 
| +  bool SetAudioSend(uint32 ssrc, bool mute, const AudioOptions* options,
 | 
|                      AudioRenderer* renderer);
 | 
|  
 | 
|    // downcasts a MediaChannel
 | 
| @@ -444,10 +433,8 @@
 | 
|  // VideoChannel is a specialization for video.
 | 
|  class VideoChannel : public BaseChannel {
 | 
|   public:
 | 
| -  VideoChannel(rtc::Thread* thread,
 | 
| -               VideoMediaChannel* channel,
 | 
| -               TransportController* transport_controller,
 | 
| -               const std::string& content_name,
 | 
| +  VideoChannel(rtc::Thread* thread, VideoMediaChannel* channel,
 | 
| +               BaseSession* session, const std::string& content_name,
 | 
|                 bool rtcp);
 | 
|    ~VideoChannel();
 | 
|    bool Init();
 | 
| @@ -546,7 +533,7 @@
 | 
|   public:
 | 
|    DataChannel(rtc::Thread* thread,
 | 
|                DataMediaChannel* media_channel,
 | 
| -              TransportController* transport_controller,
 | 
| +              BaseSession* session,
 | 
|                const std::string& content_name,
 | 
|                bool rtcp);
 | 
|    ~DataChannel();
 | 
| 
 |