| 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 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 remote_content_direction_(MD_INACTIVE), | 170 remote_content_direction_(MD_INACTIVE), |
| 171 has_received_packet_(false), | 171 has_received_packet_(false), |
| 172 dtls_keyed_(false), | 172 dtls_keyed_(false), |
| 173 secure_required_(false), | 173 secure_required_(false), |
| 174 rtp_abs_sendtime_extn_id_(-1) { | 174 rtp_abs_sendtime_extn_id_(-1) { |
| 175 ASSERT(worker_thread_ == rtc::Thread::Current()); | 175 ASSERT(worker_thread_ == rtc::Thread::Current()); |
| 176 LOG(LS_INFO) << "Created channel for " << content_name; | 176 LOG(LS_INFO) << "Created channel for " << content_name; |
| 177 } | 177 } |
| 178 | 178 |
| 179 BaseChannel::~BaseChannel() { | 179 BaseChannel::~BaseChannel() { |
| 180 TRACE_EVENT0("webrtc", "BaseChannel::~BaseChannel"); |
| 180 ASSERT(worker_thread_ == rtc::Thread::Current()); | 181 ASSERT(worker_thread_ == rtc::Thread::Current()); |
| 181 Deinit(); | 182 Deinit(); |
| 182 StopConnectionMonitor(); | 183 StopConnectionMonitor(); |
| 183 FlushRtcpMessages(); // Send any outstanding RTCP packets. | 184 FlushRtcpMessages(); // Send any outstanding RTCP packets. |
| 184 worker_thread_->Clear(this); // eats any outstanding messages or packets | 185 worker_thread_->Clear(this); // eats any outstanding messages or packets |
| 185 // We must destroy the media channel before the transport channel, otherwise | 186 // We must destroy the media channel before the transport channel, otherwise |
| 186 // the media channel may try to send on the dead transport channel. NULLing | 187 // the media channel may try to send on the dead transport channel. NULLing |
| 187 // is not an effective strategy since the sends will come on another thread. | 188 // is not an effective strategy since the sends will come on another thread. |
| 188 delete media_channel_; | 189 delete media_channel_; |
| 189 // Note that we don't just call set_transport_channel(nullptr) because that | 190 // Note that we don't just call set_transport_channel(nullptr) because that |
| (...skipping 817 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1007 error_desc); | 1008 error_desc); |
| 1008 return false; | 1009 return false; |
| 1009 } | 1010 } |
| 1010 return true; | 1011 return true; |
| 1011 } | 1012 } |
| 1012 | 1013 |
| 1013 bool BaseChannel::SetSrtp_w(const std::vector<CryptoParams>& cryptos, | 1014 bool BaseChannel::SetSrtp_w(const std::vector<CryptoParams>& cryptos, |
| 1014 ContentAction action, | 1015 ContentAction action, |
| 1015 ContentSource src, | 1016 ContentSource src, |
| 1016 std::string* error_desc) { | 1017 std::string* error_desc) { |
| 1018 TRACE_EVENT0("webrtc", "BaseChannel::SetSrtp_w"); |
| 1017 if (action == CA_UPDATE) { | 1019 if (action == CA_UPDATE) { |
| 1018 // no crypto params. | 1020 // no crypto params. |
| 1019 return true; | 1021 return true; |
| 1020 } | 1022 } |
| 1021 bool ret = false; | 1023 bool ret = false; |
| 1022 bool dtls = false; | 1024 bool dtls = false; |
| 1023 ret = CheckSrtpConfig(cryptos, &dtls, error_desc); | 1025 ret = CheckSrtpConfig(cryptos, &dtls, error_desc); |
| 1024 if (!ret) { | 1026 if (!ret) { |
| 1025 return false; | 1027 return false; |
| 1026 } | 1028 } |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1318 bool rtcp) | 1320 bool rtcp) |
| 1319 : BaseChannel(thread, | 1321 : BaseChannel(thread, |
| 1320 media_channel, | 1322 media_channel, |
| 1321 transport_controller, | 1323 transport_controller, |
| 1322 content_name, | 1324 content_name, |
| 1323 rtcp), | 1325 rtcp), |
| 1324 media_engine_(media_engine), | 1326 media_engine_(media_engine), |
| 1325 received_media_(false) {} | 1327 received_media_(false) {} |
| 1326 | 1328 |
| 1327 VoiceChannel::~VoiceChannel() { | 1329 VoiceChannel::~VoiceChannel() { |
| 1330 TRACE_EVENT0("webrtc", "VoiceChannel::~VoiceChannel"); |
| 1328 StopAudioMonitor(); | 1331 StopAudioMonitor(); |
| 1329 StopMediaMonitor(); | 1332 StopMediaMonitor(); |
| 1330 // this can't be done in the base class, since it calls a virtual | 1333 // this can't be done in the base class, since it calls a virtual |
| 1331 DisableMedia_w(); | 1334 DisableMedia_w(); |
| 1332 Deinit(); | 1335 Deinit(); |
| 1333 } | 1336 } |
| 1334 | 1337 |
| 1335 bool VoiceChannel::Init() { | 1338 bool VoiceChannel::Init() { |
| 1336 if (!BaseChannel::Init()) { | 1339 if (!BaseChannel::Init()) { |
| 1337 return false; | 1340 return false; |
| (...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1636 previous_we_(rtc::WE_CLOSE) {} | 1639 previous_we_(rtc::WE_CLOSE) {} |
| 1637 | 1640 |
| 1638 bool VideoChannel::Init() { | 1641 bool VideoChannel::Init() { |
| 1639 if (!BaseChannel::Init()) { | 1642 if (!BaseChannel::Init()) { |
| 1640 return false; | 1643 return false; |
| 1641 } | 1644 } |
| 1642 return true; | 1645 return true; |
| 1643 } | 1646 } |
| 1644 | 1647 |
| 1645 VideoChannel::~VideoChannel() { | 1648 VideoChannel::~VideoChannel() { |
| 1649 TRACE_EVENT0("webrtc", "VideoChannel::~VideoChannel"); |
| 1646 std::vector<uint32_t> screencast_ssrcs; | 1650 std::vector<uint32_t> screencast_ssrcs; |
| 1647 ScreencastMap::iterator iter; | 1651 ScreencastMap::iterator iter; |
| 1648 while (!screencast_capturers_.empty()) { | 1652 while (!screencast_capturers_.empty()) { |
| 1649 if (!RemoveScreencast(screencast_capturers_.begin()->first)) { | 1653 if (!RemoveScreencast(screencast_capturers_.begin()->first)) { |
| 1650 LOG(LS_ERROR) << "Unable to delete screencast with ssrc " | 1654 LOG(LS_ERROR) << "Unable to delete screencast with ssrc " |
| 1651 << screencast_capturers_.begin()->first; | 1655 << screencast_capturers_.begin()->first; |
| 1652 ASSERT(false); | 1656 ASSERT(false); |
| 1653 break; | 1657 break; |
| 1654 } | 1658 } |
| 1655 } | 1659 } |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1942 bool rtcp) | 1946 bool rtcp) |
| 1943 : BaseChannel(thread, | 1947 : BaseChannel(thread, |
| 1944 media_channel, | 1948 media_channel, |
| 1945 transport_controller, | 1949 transport_controller, |
| 1946 content_name, | 1950 content_name, |
| 1947 rtcp), | 1951 rtcp), |
| 1948 data_channel_type_(cricket::DCT_NONE), | 1952 data_channel_type_(cricket::DCT_NONE), |
| 1949 ready_to_send_data_(false) {} | 1953 ready_to_send_data_(false) {} |
| 1950 | 1954 |
| 1951 DataChannel::~DataChannel() { | 1955 DataChannel::~DataChannel() { |
| 1956 TRACE_EVENT0("webrtc", "DataChannel::~DataChannel"); |
| 1952 StopMediaMonitor(); | 1957 StopMediaMonitor(); |
| 1953 // this can't be done in the base class, since it calls a virtual | 1958 // this can't be done in the base class, since it calls a virtual |
| 1954 DisableMedia_w(); | 1959 DisableMedia_w(); |
| 1955 | 1960 |
| 1956 Deinit(); | 1961 Deinit(); |
| 1957 } | 1962 } |
| 1958 | 1963 |
| 1959 bool DataChannel::Init() { | 1964 bool DataChannel::Init() { |
| 1960 if (!BaseChannel::Init()) { | 1965 if (!BaseChannel::Init()) { |
| 1961 return false; | 1966 return false; |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2248 return (data_channel_type_ == DCT_RTP) && BaseChannel::ShouldSetupDtlsSrtp(); | 2253 return (data_channel_type_ == DCT_RTP) && BaseChannel::ShouldSetupDtlsSrtp(); |
| 2249 } | 2254 } |
| 2250 | 2255 |
| 2251 void DataChannel::OnStreamClosedRemotely(uint32_t sid) { | 2256 void DataChannel::OnStreamClosedRemotely(uint32_t sid) { |
| 2252 rtc::TypedMessageData<uint32_t>* message = | 2257 rtc::TypedMessageData<uint32_t>* message = |
| 2253 new rtc::TypedMessageData<uint32_t>(sid); | 2258 new rtc::TypedMessageData<uint32_t>(sid); |
| 2254 signaling_thread()->Post(this, MSG_STREAMCLOSEDREMOTELY, message); | 2259 signaling_thread()->Post(this, MSG_STREAMCLOSEDREMOTELY, message); |
| 2255 } | 2260 } |
| 2256 | 2261 |
| 2257 } // namespace cricket | 2262 } // namespace cricket |
| OLD | NEW |