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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 transport_name_, cricket::ICE_CANDIDATE_COMPONENT_RTP); | 205 transport_name_, cricket::ICE_CANDIDATE_COMPONENT_RTP); |
206 } | 206 } |
207 if (rtcp_transport_channel_) { | 207 if (rtcp_transport_channel_) { |
208 DisconnectFromTransportChannel(rtcp_transport_channel_); | 208 DisconnectFromTransportChannel(rtcp_transport_channel_); |
209 transport_controller_->DestroyTransportChannel_n( | 209 transport_controller_->DestroyTransportChannel_n( |
210 transport_name_, cricket::ICE_CANDIDATE_COMPONENT_RTCP); | 210 transport_name_, cricket::ICE_CANDIDATE_COMPONENT_RTCP); |
211 } | 211 } |
212 network_thread_->Clear(this); | 212 network_thread_->Clear(this); |
213 } | 213 } |
214 | 214 |
215 bool BaseChannel::Init_w() { | 215 bool BaseChannel::Init_w(const std::string* bundle_transport_name) { |
216 if (!network_thread_->Invoke<bool>(Bind(&BaseChannel::InitNetwork_n, this))) { | 216 if (!network_thread_->Invoke<bool>( |
| 217 Bind(&BaseChannel::InitNetwork_n, this, bundle_transport_name))) { |
217 return false; | 218 return false; |
218 } | 219 } |
219 | 220 |
220 // Both RTP and RTCP channels are set, we can call SetInterface on | 221 // Both RTP and RTCP channels are set, we can call SetInterface on |
221 // media channel and it can set network options. | 222 // media channel and it can set network options. |
222 RTC_DCHECK(worker_thread_->IsCurrent()); | 223 RTC_DCHECK(worker_thread_->IsCurrent()); |
223 media_channel_->SetInterface(this); | 224 media_channel_->SetInterface(this); |
224 return true; | 225 return true; |
225 } | 226 } |
226 | 227 |
227 bool BaseChannel::InitNetwork_n() { | 228 bool BaseChannel::InitNetwork_n(const std::string* bundle_transport_name) { |
228 RTC_DCHECK(network_thread_->IsCurrent()); | 229 RTC_DCHECK(network_thread_->IsCurrent()); |
229 if (!SetTransport_n(content_name())) { | 230 const std::string& transport_name = |
| 231 (bundle_transport_name ? *bundle_transport_name : content_name()); |
| 232 if (!SetTransport_n(transport_name)) { |
230 return false; | 233 return false; |
231 } | 234 } |
232 | 235 |
233 if (!SetDtlsSrtpCryptoSuites_n(transport_channel_, false)) { | 236 if (!SetDtlsSrtpCryptoSuites_n(transport_channel_, false)) { |
234 return false; | 237 return false; |
235 } | 238 } |
236 if (rtcp_transport_enabled() && | 239 if (rtcp_transport_enabled() && |
237 !SetDtlsSrtpCryptoSuites_n(rtcp_transport_channel_, true)) { | 240 !SetDtlsSrtpCryptoSuites_n(rtcp_transport_channel_, true)) { |
238 return false; | 241 return false; |
239 } | 242 } |
(...skipping 1207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1447 | 1450 |
1448 VoiceChannel::~VoiceChannel() { | 1451 VoiceChannel::~VoiceChannel() { |
1449 TRACE_EVENT0("webrtc", "VoiceChannel::~VoiceChannel"); | 1452 TRACE_EVENT0("webrtc", "VoiceChannel::~VoiceChannel"); |
1450 StopAudioMonitor(); | 1453 StopAudioMonitor(); |
1451 StopMediaMonitor(); | 1454 StopMediaMonitor(); |
1452 // this can't be done in the base class, since it calls a virtual | 1455 // this can't be done in the base class, since it calls a virtual |
1453 DisableMedia_w(); | 1456 DisableMedia_w(); |
1454 Deinit(); | 1457 Deinit(); |
1455 } | 1458 } |
1456 | 1459 |
1457 bool VoiceChannel::Init_w() { | 1460 bool VoiceChannel::Init_w(const std::string* bundle_transport_name) { |
1458 if (!BaseChannel::Init_w()) { | 1461 if (!BaseChannel::Init_w(bundle_transport_name)) { |
1459 return false; | 1462 return false; |
1460 } | 1463 } |
1461 return true; | 1464 return true; |
1462 } | 1465 } |
1463 | 1466 |
1464 bool VoiceChannel::SetAudioSend(uint32_t ssrc, | 1467 bool VoiceChannel::SetAudioSend(uint32_t ssrc, |
1465 bool enable, | 1468 bool enable, |
1466 const AudioOptions* options, | 1469 const AudioOptions* options, |
1467 AudioSource* source) { | 1470 AudioSource* source) { |
1468 return InvokeOnWorker(Bind(&VoiceMediaChannel::SetAudioSend, media_channel(), | 1471 return InvokeOnWorker(Bind(&VoiceMediaChannel::SetAudioSend, media_channel(), |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1777 TransportController* transport_controller, | 1780 TransportController* transport_controller, |
1778 const std::string& content_name, | 1781 const std::string& content_name, |
1779 bool rtcp) | 1782 bool rtcp) |
1780 : BaseChannel(worker_thread, | 1783 : BaseChannel(worker_thread, |
1781 network_thread, | 1784 network_thread, |
1782 media_channel, | 1785 media_channel, |
1783 transport_controller, | 1786 transport_controller, |
1784 content_name, | 1787 content_name, |
1785 rtcp) {} | 1788 rtcp) {} |
1786 | 1789 |
1787 bool VideoChannel::Init_w() { | 1790 bool VideoChannel::Init_w(const std::string* bundle_transport_name) { |
1788 if (!BaseChannel::Init_w()) { | 1791 if (!BaseChannel::Init_w(bundle_transport_name)) { |
1789 return false; | 1792 return false; |
1790 } | 1793 } |
1791 return true; | 1794 return true; |
1792 } | 1795 } |
1793 | 1796 |
1794 VideoChannel::~VideoChannel() { | 1797 VideoChannel::~VideoChannel() { |
1795 TRACE_EVENT0("webrtc", "VideoChannel::~VideoChannel"); | 1798 TRACE_EVENT0("webrtc", "VideoChannel::~VideoChannel"); |
1796 StopMediaMonitor(); | 1799 StopMediaMonitor(); |
1797 // this can't be done in the base class, since it calls a virtual | 1800 // this can't be done in the base class, since it calls a virtual |
1798 DisableMedia_w(); | 1801 DisableMedia_w(); |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2024 | 2027 |
2025 DataChannel::~DataChannel() { | 2028 DataChannel::~DataChannel() { |
2026 TRACE_EVENT0("webrtc", "DataChannel::~DataChannel"); | 2029 TRACE_EVENT0("webrtc", "DataChannel::~DataChannel"); |
2027 StopMediaMonitor(); | 2030 StopMediaMonitor(); |
2028 // this can't be done in the base class, since it calls a virtual | 2031 // this can't be done in the base class, since it calls a virtual |
2029 DisableMedia_w(); | 2032 DisableMedia_w(); |
2030 | 2033 |
2031 Deinit(); | 2034 Deinit(); |
2032 } | 2035 } |
2033 | 2036 |
2034 bool DataChannel::Init_w() { | 2037 bool DataChannel::Init_w(const std::string* bundle_transport_name) { |
2035 if (!BaseChannel::Init_w()) { | 2038 if (!BaseChannel::Init_w(bundle_transport_name)) { |
2036 return false; | 2039 return false; |
2037 } | 2040 } |
2038 media_channel()->SignalDataReceived.connect( | 2041 media_channel()->SignalDataReceived.connect( |
2039 this, &DataChannel::OnDataReceived); | 2042 this, &DataChannel::OnDataReceived); |
2040 media_channel()->SignalReadyToSend.connect( | 2043 media_channel()->SignalReadyToSend.connect( |
2041 this, &DataChannel::OnDataChannelReadyToSend); | 2044 this, &DataChannel::OnDataChannelReadyToSend); |
2042 media_channel()->SignalStreamClosedRemotely.connect( | 2045 media_channel()->SignalStreamClosedRemotely.connect( |
2043 this, &DataChannel::OnStreamClosedRemotely); | 2046 this, &DataChannel::OnStreamClosedRemotely); |
2044 return true; | 2047 return true; |
2045 } | 2048 } |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2323 return data_channel_type_ == DCT_RTP && BaseChannel::ShouldSetupDtlsSrtp_n(); | 2326 return data_channel_type_ == DCT_RTP && BaseChannel::ShouldSetupDtlsSrtp_n(); |
2324 } | 2327 } |
2325 | 2328 |
2326 void DataChannel::OnStreamClosedRemotely(uint32_t sid) { | 2329 void DataChannel::OnStreamClosedRemotely(uint32_t sid) { |
2327 rtc::TypedMessageData<uint32_t>* message = | 2330 rtc::TypedMessageData<uint32_t>* message = |
2328 new rtc::TypedMessageData<uint32_t>(sid); | 2331 new rtc::TypedMessageData<uint32_t>(sid); |
2329 signaling_thread()->Post(this, MSG_STREAMCLOSEDREMOTELY, message); | 2332 signaling_thread()->Post(this, MSG_STREAMCLOSEDREMOTELY, message); |
2330 } | 2333 } |
2331 | 2334 |
2332 } // namespace cricket | 2335 } // namespace cricket |
OLD | NEW |