| Index: talk/app/webrtc/mediacontroller.cc
 | 
| diff --git a/talk/app/webrtc/mediacontroller.cc b/talk/app/webrtc/mediacontroller.cc
 | 
| index 28b007e15b787e94fe92aa9ad385a1165350f139..db6b5c75fb28a237168e4dafa4ed01d7d90ab508 100644
 | 
| --- a/talk/app/webrtc/mediacontroller.cc
 | 
| +++ b/talk/app/webrtc/mediacontroller.cc
 | 
| @@ -29,7 +29,7 @@
 | 
|  
 | 
|  #include "webrtc/base/bind.h"
 | 
|  #include "webrtc/base/checks.h"
 | 
| -#include "webrtc/call.h"
 | 
| +#include "webrtc/p2p/base/transportchannel.h"
 | 
|  
 | 
|  namespace {
 | 
|  
 | 
| @@ -37,11 +37,20 @@ const int kMinBandwidthBps = 30000;
 | 
|  const int kStartBandwidthBps = 300000;
 | 
|  const int kMaxBandwidthBps = 2000000;
 | 
|  
 | 
| -class MediaController : public webrtc::MediaControllerInterface {
 | 
| +class MediaController : public webrtc::MediaControllerInterface,
 | 
| +                        public sigslot::has_slots<> {
 | 
|   public:
 | 
| -  MediaController(rtc::Thread* worker_thread,
 | 
| +  MediaController(rtc::Thread* worker_thread, webrtc::VoiceEngine* voice_engine)
 | 
| +      : worker_thread_(worker_thread),
 | 
| +        call_factory_(new webrtc::CallFactory()) {
 | 
| +    RTC_DCHECK(nullptr != worker_thread);
 | 
| +    worker_thread_->Invoke<void>(
 | 
| +        rtc::Bind(&MediaController::Construct_w, this, voice_engine));
 | 
| +  }
 | 
| +  MediaController(webrtc::CallFactory* call_factory,
 | 
| +                  rtc::Thread* worker_thread,
 | 
|                    webrtc::VoiceEngine* voice_engine)
 | 
| -      : worker_thread_(worker_thread) {
 | 
| +      : worker_thread_(worker_thread), call_factory_(call_factory) {
 | 
|      RTC_DCHECK(nullptr != worker_thread);
 | 
|      worker_thread_->Invoke<void>(
 | 
|          rtc::Bind(&MediaController::Construct_w, this, voice_engine));
 | 
| @@ -56,6 +65,16 @@ class MediaController : public webrtc::MediaControllerInterface {
 | 
|      return call_.get();
 | 
|    }
 | 
|  
 | 
| +  void ConnectToSignalSentPacket_w(
 | 
| +      cricket::TransportChannel* transport_channel) override {
 | 
| +    RTC_DCHECK(worker_thread_->IsCurrent());
 | 
| +    if (!transport_channels_.insert(transport_channel).second) {
 | 
| +      return;
 | 
| +    }
 | 
| +    transport_channel->SignalSentPacket.connect(this,
 | 
| +                                                &MediaController::OnSentPacket);
 | 
| +  }
 | 
| +
 | 
|   private:
 | 
|    void Construct_w(webrtc::VoiceEngine* voice_engine)  {
 | 
|      RTC_DCHECK(worker_thread_->IsCurrent());
 | 
| @@ -64,15 +83,21 @@ class MediaController : public webrtc::MediaControllerInterface {
 | 
|      config.bitrate_config.min_bitrate_bps = kMinBandwidthBps;
 | 
|      config.bitrate_config.start_bitrate_bps = kStartBandwidthBps;
 | 
|      config.bitrate_config.max_bitrate_bps = kMaxBandwidthBps;
 | 
| -    call_.reset(webrtc::Call::Create(config));
 | 
| +    call_.reset(call_factory_->CreateCall(config));
 | 
|    }
 | 
|    void Destruct_w() {
 | 
|      RTC_DCHECK(worker_thread_->IsCurrent());
 | 
| -    call_.reset(nullptr);
 | 
| +    call_.reset();
 | 
| +  }
 | 
| +  void OnSentPacket(cricket::TransportChannel* channel,
 | 
| +                    const rtc::SentPacket& sent_packet) {
 | 
| +    call_->OnSentPacket(sent_packet);
 | 
|    }
 | 
|  
 | 
| -  rtc::Thread* worker_thread_;
 | 
| +  rtc::Thread* const worker_thread_;
 | 
| +  rtc::scoped_ptr<webrtc::CallFactory> call_factory_;
 | 
|    rtc::scoped_ptr<webrtc::Call> call_;
 | 
| +  std::set<cricket::TransportChannel*> transport_channels_;
 | 
|  
 | 
|    RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(MediaController);
 | 
|  };
 | 
| @@ -84,4 +109,10 @@ MediaControllerInterface* MediaControllerInterface::Create(
 | 
|      rtc::Thread* worker_thread, webrtc::VoiceEngine* voice_engine) {
 | 
|    return new MediaController(worker_thread, voice_engine);
 | 
|  }
 | 
| +MediaControllerInterface* MediaControllerInterface::Create(
 | 
| +    webrtc::CallFactory* call_factory,
 | 
| +    rtc::Thread* worker_thread,
 | 
| +    webrtc::VoiceEngine* voice_engine) {
 | 
| +  return new MediaController(call_factory, worker_thread, voice_engine);
 | 
| +}
 | 
|  } // namespace webrtc
 | 
| 
 |