Chromium Code Reviews| Index: talk/app/webrtc/mediacontroller.cc |
| diff --git a/talk/app/webrtc/mediacontroller.cc b/talk/app/webrtc/mediacontroller.cc |
| index 28b007e15b787e94fe92aa9ad385a1165350f139..729b465a0305a86882397d849d4dd037baf67083 100644 |
| --- a/talk/app/webrtc/mediacontroller.cc |
| +++ b/talk/app/webrtc/mediacontroller.cc |
| @@ -30,6 +30,7 @@ |
| #include "webrtc/base/bind.h" |
| #include "webrtc/base/checks.h" |
| #include "webrtc/call.h" |
| +#include "webrtc/p2p/base/transportchannel.h" |
| namespace { |
| @@ -37,7 +38,8 @@ 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, |
| webrtc::VoiceEngine* voice_engine) |
| @@ -49,6 +51,7 @@ class MediaController : public webrtc::MediaControllerInterface { |
| ~MediaController() override { |
| worker_thread_->Invoke<void>( |
| rtc::Bind(&MediaController::Destruct_w, this)); |
| + RTC_DCHECK(transport_channels_.empty()); |
| } |
| webrtc::Call* call_w() override { |
| @@ -56,6 +59,24 @@ class MediaController : public webrtc::MediaControllerInterface { |
| return call_.get(); |
| } |
| + void ConnectTransportChannel( |
| + cricket::TransportChannel* transport_channel) override { |
|
pthatcher1
2015/10/07 16:44:37
Needs a RTC_DCHECK(worker_thread_->IsCurrent());
stefan-webrtc
2015/10/08 12:53:45
Done.
|
| + if (transport_channels_.find(transport_channel) != |
| + transport_channels_.end()) |
| + return; |
| + transport_channels_.insert(transport_channel); |
| + transport_channel->SignalSentPacket.connect(this, |
| + &MediaController::OnSentPacket); |
| + } |
|
pthatcher1
2015/10/07 16:44:37
Can't you do this?
if (!transport_channels_.inser
stefan-webrtc
2015/10/08 12:53:45
Done.
|
| + |
| + void DisconnectTransportChannel( |
| + cricket::TransportChannel* transport_channel) override { |
| + RTC_DCHECK(transport_channels_.find(transport_channel) != |
| + transport_channels_.end()); |
| + transport_channels_.erase(transport_channel); |
| + transport_channel->SignalSentPacket.disconnect(this); |
| + } |
| + |
| private: |
| void Construct_w(webrtc::VoiceEngine* voice_engine) { |
| RTC_DCHECK(worker_thread_->IsCurrent()); |
| @@ -70,9 +91,14 @@ class MediaController : public webrtc::MediaControllerInterface { |
| RTC_DCHECK(worker_thread_->IsCurrent()); |
| call_.reset(nullptr); |
| } |
| + void OnSentPacket(cricket::TransportChannel* channel, |
| + const rtc::SentPacket& sent_packet) { |
| + call_->OnSentPacket(sent_packet); |
| + } |
| rtc::Thread* worker_thread_; |
| rtc::scoped_ptr<webrtc::Call> call_; |
| + std::set<cricket::TransportChannel*> transport_channels_; |
| RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(MediaController); |
| }; |