| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2004 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2004 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 } | 222 } |
| 223 if (rtcp_transport_channel_) { | 223 if (rtcp_transport_channel_) { |
| 224 transport_controller_->DestroyTransportChannel_n( | 224 transport_controller_->DestroyTransportChannel_n( |
| 225 transport_name_, cricket::ICE_CANDIDATE_COMPONENT_RTCP); | 225 transport_name_, cricket::ICE_CANDIDATE_COMPONENT_RTCP); |
| 226 } | 226 } |
| 227 // Clear pending send packets/messages. | 227 // Clear pending send packets/messages. |
| 228 network_thread_->Clear(&invoker_); | 228 network_thread_->Clear(&invoker_); |
| 229 network_thread_->Clear(this); | 229 network_thread_->Clear(this); |
| 230 } | 230 } |
| 231 | 231 |
| 232 bool BaseChannel::Init_w() { | 232 bool BaseChannel::Init_w(const std::string* bundle_transport_name) { |
| 233 if (!network_thread_->Invoke<bool>(Bind(&BaseChannel::InitNetwork_n, this))) { | 233 if (!network_thread_->Invoke<bool>( |
| 234 Bind(&BaseChannel::InitNetwork_n, this, bundle_transport_name))) { |
| 234 return false; | 235 return false; |
| 235 } | 236 } |
| 236 | 237 |
| 237 // Both RTP and RTCP channels are set, we can call SetInterface on | 238 // Both RTP and RTCP channels are set, we can call SetInterface on |
| 238 // media channel and it can set network options. | 239 // media channel and it can set network options. |
| 239 RTC_DCHECK(worker_thread_->IsCurrent()); | 240 RTC_DCHECK(worker_thread_->IsCurrent()); |
| 240 media_channel_->SetInterface(this); | 241 media_channel_->SetInterface(this); |
| 241 return true; | 242 return true; |
| 242 } | 243 } |
| 243 | 244 |
| 244 bool BaseChannel::InitNetwork_n() { | 245 bool BaseChannel::InitNetwork_n(const std::string* bundle_transport_name) { |
| 245 RTC_DCHECK(network_thread_->IsCurrent()); | 246 RTC_DCHECK(network_thread_->IsCurrent()); |
| 246 if (!SetTransport_n(content_name())) { | 247 const std::string& transport_name = |
| 248 (bundle_transport_name ? *bundle_transport_name : content_name()); |
| 249 if (!SetTransport_n(transport_name)) { |
| 247 return false; | 250 return false; |
| 248 } | 251 } |
| 249 | 252 |
| 250 if (!SetDtlsSrtpCryptoSuites_n(transport_channel_, false)) { | 253 if (!SetDtlsSrtpCryptoSuites_n(transport_channel_, false)) { |
| 251 return false; | 254 return false; |
| 252 } | 255 } |
| 253 if (rtcp_transport_enabled() && | 256 if (rtcp_transport_enabled() && |
| 254 !SetDtlsSrtpCryptoSuites_n(rtcp_transport_channel_, true)) { | 257 !SetDtlsSrtpCryptoSuites_n(rtcp_transport_channel_, true)) { |
| 255 return false; | 258 return false; |
| 256 } | 259 } |
| (...skipping 1212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1469 | 1472 |
| 1470 VoiceChannel::~VoiceChannel() { | 1473 VoiceChannel::~VoiceChannel() { |
| 1471 TRACE_EVENT0("webrtc", "VoiceChannel::~VoiceChannel"); | 1474 TRACE_EVENT0("webrtc", "VoiceChannel::~VoiceChannel"); |
| 1472 StopAudioMonitor(); | 1475 StopAudioMonitor(); |
| 1473 StopMediaMonitor(); | 1476 StopMediaMonitor(); |
| 1474 // this can't be done in the base class, since it calls a virtual | 1477 // this can't be done in the base class, since it calls a virtual |
| 1475 DisableMedia_w(); | 1478 DisableMedia_w(); |
| 1476 Deinit(); | 1479 Deinit(); |
| 1477 } | 1480 } |
| 1478 | 1481 |
| 1479 bool VoiceChannel::Init_w() { | 1482 bool VoiceChannel::Init_w(const std::string* bundle_transport_name) { |
| 1480 if (!BaseChannel::Init_w()) { | 1483 if (!BaseChannel::Init_w(bundle_transport_name)) { |
| 1481 return false; | 1484 return false; |
| 1482 } | 1485 } |
| 1483 return true; | 1486 return true; |
| 1484 } | 1487 } |
| 1485 | 1488 |
| 1486 bool VoiceChannel::SetAudioSend(uint32_t ssrc, | 1489 bool VoiceChannel::SetAudioSend(uint32_t ssrc, |
| 1487 bool enable, | 1490 bool enable, |
| 1488 const AudioOptions* options, | 1491 const AudioOptions* options, |
| 1489 AudioSource* source) { | 1492 AudioSource* source) { |
| 1490 return InvokeOnWorker(Bind(&VoiceMediaChannel::SetAudioSend, media_channel(), | 1493 return InvokeOnWorker(Bind(&VoiceMediaChannel::SetAudioSend, media_channel(), |
| (...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1824 TransportController* transport_controller, | 1827 TransportController* transport_controller, |
| 1825 const std::string& content_name, | 1828 const std::string& content_name, |
| 1826 bool rtcp) | 1829 bool rtcp) |
| 1827 : BaseChannel(worker_thread, | 1830 : BaseChannel(worker_thread, |
| 1828 network_thread, | 1831 network_thread, |
| 1829 media_channel, | 1832 media_channel, |
| 1830 transport_controller, | 1833 transport_controller, |
| 1831 content_name, | 1834 content_name, |
| 1832 rtcp) {} | 1835 rtcp) {} |
| 1833 | 1836 |
| 1834 bool VideoChannel::Init_w() { | 1837 bool VideoChannel::Init_w(const std::string* bundle_transport_name) { |
| 1835 if (!BaseChannel::Init_w()) { | 1838 if (!BaseChannel::Init_w(bundle_transport_name)) { |
| 1836 return false; | 1839 return false; |
| 1837 } | 1840 } |
| 1838 return true; | 1841 return true; |
| 1839 } | 1842 } |
| 1840 | 1843 |
| 1841 VideoChannel::~VideoChannel() { | 1844 VideoChannel::~VideoChannel() { |
| 1842 TRACE_EVENT0("webrtc", "VideoChannel::~VideoChannel"); | 1845 TRACE_EVENT0("webrtc", "VideoChannel::~VideoChannel"); |
| 1843 StopMediaMonitor(); | 1846 StopMediaMonitor(); |
| 1844 // this can't be done in the base class, since it calls a virtual | 1847 // this can't be done in the base class, since it calls a virtual |
| 1845 DisableMedia_w(); | 1848 DisableMedia_w(); |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2096 | 2099 |
| 2097 DataChannel::~DataChannel() { | 2100 DataChannel::~DataChannel() { |
| 2098 TRACE_EVENT0("webrtc", "DataChannel::~DataChannel"); | 2101 TRACE_EVENT0("webrtc", "DataChannel::~DataChannel"); |
| 2099 StopMediaMonitor(); | 2102 StopMediaMonitor(); |
| 2100 // this can't be done in the base class, since it calls a virtual | 2103 // this can't be done in the base class, since it calls a virtual |
| 2101 DisableMedia_w(); | 2104 DisableMedia_w(); |
| 2102 | 2105 |
| 2103 Deinit(); | 2106 Deinit(); |
| 2104 } | 2107 } |
| 2105 | 2108 |
| 2106 bool DataChannel::Init_w() { | 2109 bool DataChannel::Init_w(const std::string* bundle_transport_name) { |
| 2107 if (!BaseChannel::Init_w()) { | 2110 if (!BaseChannel::Init_w(bundle_transport_name)) { |
| 2108 return false; | 2111 return false; |
| 2109 } | 2112 } |
| 2110 media_channel()->SignalDataReceived.connect( | 2113 media_channel()->SignalDataReceived.connect( |
| 2111 this, &DataChannel::OnDataReceived); | 2114 this, &DataChannel::OnDataReceived); |
| 2112 media_channel()->SignalReadyToSend.connect( | 2115 media_channel()->SignalReadyToSend.connect( |
| 2113 this, &DataChannel::OnDataChannelReadyToSend); | 2116 this, &DataChannel::OnDataChannelReadyToSend); |
| 2114 media_channel()->SignalStreamClosedRemotely.connect( | 2117 media_channel()->SignalStreamClosedRemotely.connect( |
| 2115 this, &DataChannel::OnStreamClosedRemotely); | 2118 this, &DataChannel::OnStreamClosedRemotely); |
| 2116 return true; | 2119 return true; |
| 2117 } | 2120 } |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2395 return data_channel_type_ == DCT_RTP && BaseChannel::ShouldSetupDtlsSrtp_n(); | 2398 return data_channel_type_ == DCT_RTP && BaseChannel::ShouldSetupDtlsSrtp_n(); |
| 2396 } | 2399 } |
| 2397 | 2400 |
| 2398 void DataChannel::OnStreamClosedRemotely(uint32_t sid) { | 2401 void DataChannel::OnStreamClosedRemotely(uint32_t sid) { |
| 2399 rtc::TypedMessageData<uint32_t>* message = | 2402 rtc::TypedMessageData<uint32_t>* message = |
| 2400 new rtc::TypedMessageData<uint32_t>(sid); | 2403 new rtc::TypedMessageData<uint32_t>(sid); |
| 2401 signaling_thread()->Post(this, MSG_STREAMCLOSEDREMOTELY, message); | 2404 signaling_thread()->Post(this, MSG_STREAMCLOSEDREMOTELY, message); |
| 2402 } | 2405 } |
| 2403 | 2406 |
| 2404 } // namespace cricket | 2407 } // namespace cricket |
| OLD | NEW |