Chromium Code Reviews| 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 |
| 11 #include <utility> | 11 #include <utility> |
| 12 | 12 |
| 13 #include "webrtc/pc/channel.h" | 13 #include "webrtc/pc/channel.h" |
| 14 | 14 |
| 15 #include "webrtc/api/call/audio_sink.h" | 15 #include "webrtc/api/call/audio_sink.h" |
| 16 #include "webrtc/base/bind.h" | 16 #include "webrtc/base/bind.h" |
| 17 #include "webrtc/base/byteorder.h" | 17 #include "webrtc/base/byteorder.h" |
| 18 #include "webrtc/base/checks.h" | 18 #include "webrtc/base/checks.h" |
| 19 #include "webrtc/base/common.h" | 19 #include "webrtc/base/common.h" |
| 20 #include "webrtc/base/copyonwritebuffer.h" | 20 #include "webrtc/base/copyonwritebuffer.h" |
| 21 #include "webrtc/base/dscp.h" | 21 #include "webrtc/base/dscp.h" |
| 22 #include "webrtc/base/logging.h" | 22 #include "webrtc/base/logging.h" |
| 23 #include "webrtc/base/networkroute.h" | 23 #include "webrtc/base/networkroute.h" |
| 24 #include "webrtc/base/trace_event.h" | 24 #include "webrtc/base/trace_event.h" |
| 25 #include "webrtc/media/base/mediaconstants.h" | 25 #include "webrtc/media/base/mediaconstants.h" |
| 26 #include "webrtc/media/base/rtputils.h" | 26 #include "webrtc/media/base/rtputils.h" |
| 27 #include "webrtc/p2p/base/packettransportinterface.h" | 27 #include "webrtc/p2p/base/packettransportinterface.h" |
| 28 #include "webrtc/p2p/base/transportchannel.h" | |
| 29 #include "webrtc/pc/channelmanager.h" | 28 #include "webrtc/pc/channelmanager.h" |
| 30 | 29 |
| 31 namespace cricket { | 30 namespace cricket { |
| 32 using rtc::Bind; | 31 using rtc::Bind; |
| 33 | 32 |
| 34 namespace { | 33 namespace { |
| 35 // See comment below for why we need to use a pointer to a unique_ptr. | 34 // See comment below for why we need to use a pointer to a unique_ptr. |
| 36 bool SetRawAudioSink_w(VoiceMediaChannel* channel, | 35 bool SetRawAudioSink_w(VoiceMediaChannel* channel, |
| 37 uint32_t ssrc, | 36 uint32_t ssrc, |
| 38 std::unique_ptr<webrtc::AudioSinkInterface>* sink) { | 37 std::unique_ptr<webrtc::AudioSinkInterface>* sink) { |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 335 // BaseChannel could have resulted in an error), but even so, we'll just | 334 // BaseChannel could have resulted in an error), but even so, we'll just |
| 336 // encounter the error again and update "ready to send" accordingly. | 335 // encounter the error again and update "ready to send" accordingly. |
| 337 SetTransportChannelReadyToSend( | 336 SetTransportChannelReadyToSend( |
| 338 false, transport_channel_ && transport_channel_->writable()); | 337 false, transport_channel_ && transport_channel_->writable()); |
| 339 SetTransportChannelReadyToSend( | 338 SetTransportChannelReadyToSend( |
| 340 true, rtcp_transport_channel_ && rtcp_transport_channel_->writable()); | 339 true, rtcp_transport_channel_ && rtcp_transport_channel_->writable()); |
| 341 return true; | 340 return true; |
| 342 } | 341 } |
| 343 | 342 |
| 344 void BaseChannel::SetTransportChannel_n(bool rtcp, | 343 void BaseChannel::SetTransportChannel_n(bool rtcp, |
| 345 TransportChannel* new_channel) { | 344 DtlsTransportInternal* new_channel) { |
|
pthatcher1
2017/01/13 22:41:16
We should rename this method to SetTransport or Se
Zhi Huang
2017/01/16 10:38:24
I'll name it "SetTransport_n".
Then the "SetTransp
| |
| 346 RTC_DCHECK(network_thread_->IsCurrent()); | 345 RTC_DCHECK(network_thread_->IsCurrent()); |
| 347 TransportChannel*& old_channel = | 346 DtlsTransportInternal*& old_channel = |
| 348 rtcp ? rtcp_transport_channel_ : transport_channel_; | 347 rtcp ? rtcp_transport_channel_ : transport_channel_; |
| 349 | 348 |
| 350 if (!old_channel && !new_channel) { | 349 if (!old_channel && !new_channel) { |
| 351 // Nothing to do. | 350 // Nothing to do. |
| 352 return; | 351 return; |
| 353 } | 352 } |
| 354 RTC_DCHECK(old_channel != new_channel); | 353 RTC_DCHECK(old_channel != new_channel); |
| 355 | 354 |
| 356 if (old_channel) { | 355 if (old_channel) { |
| 357 DisconnectFromTransportChannel(old_channel); | 356 DisconnectFromTransportChannel(old_channel); |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 369 << "should never happen."; | 368 << "should never happen."; |
| 370 } | 369 } |
| 371 ConnectToTransportChannel(new_channel); | 370 ConnectToTransportChannel(new_channel); |
| 372 auto& socket_options = rtcp ? rtcp_socket_options_ : socket_options_; | 371 auto& socket_options = rtcp ? rtcp_socket_options_ : socket_options_; |
| 373 for (const auto& pair : socket_options) { | 372 for (const auto& pair : socket_options) { |
| 374 new_channel->SetOption(pair.first, pair.second); | 373 new_channel->SetOption(pair.first, pair.second); |
| 375 } | 374 } |
| 376 } | 375 } |
| 377 } | 376 } |
| 378 | 377 |
| 379 void BaseChannel::ConnectToTransportChannel(TransportChannel* tc) { | 378 void BaseChannel::ConnectToTransportChannel(DtlsTransportInternal* tc) { |
| 380 RTC_DCHECK(network_thread_->IsCurrent()); | 379 RTC_DCHECK(network_thread_->IsCurrent()); |
| 381 | 380 |
| 382 tc->SignalWritableState.connect(this, &BaseChannel::OnWritableState); | 381 tc->SignalWritableState.connect(this, &BaseChannel::OnWritableState); |
| 383 tc->SignalReadPacket.connect(this, &BaseChannel::OnPacketRead); | 382 tc->SignalReadPacket.connect(this, &BaseChannel::OnPacketRead); |
| 384 tc->SignalReadyToSend.connect(this, &BaseChannel::OnReadyToSend); | 383 tc->SignalReadyToSend.connect(this, &BaseChannel::OnReadyToSend); |
| 385 tc->SignalDtlsState.connect(this, &BaseChannel::OnDtlsState); | 384 tc->SignalDtlsState.connect(this, &BaseChannel::OnDtlsState); |
| 386 tc->SignalSelectedCandidatePairChanged.connect( | 385 tc->SignalSentPacket.connect(this, &BaseChannel::SignalSentPacket_n); |
| 386 tc->ice_transport()->SignalSelectedCandidatePairChanged.connect( | |
| 387 this, &BaseChannel::OnSelectedCandidatePairChanged); | 387 this, &BaseChannel::OnSelectedCandidatePairChanged); |
| 388 tc->SignalSentPacket.connect(this, &BaseChannel::SignalSentPacket_n); | |
| 389 } | 388 } |
| 390 | 389 |
| 391 void BaseChannel::DisconnectFromTransportChannel(TransportChannel* tc) { | 390 void BaseChannel::DisconnectFromTransportChannel(DtlsTransportInternal* tc) { |
| 392 RTC_DCHECK(network_thread_->IsCurrent()); | 391 RTC_DCHECK(network_thread_->IsCurrent()); |
| 393 OnSelectedCandidatePairChanged(tc, nullptr, -1, false); | 392 OnSelectedCandidatePairChanged(tc->ice_transport(), nullptr, -1, false); |
| 394 | 393 |
| 395 tc->SignalWritableState.disconnect(this); | 394 tc->SignalWritableState.disconnect(this); |
| 396 tc->SignalReadPacket.disconnect(this); | 395 tc->SignalReadPacket.disconnect(this); |
| 397 tc->SignalReadyToSend.disconnect(this); | 396 tc->SignalReadyToSend.disconnect(this); |
| 398 tc->SignalDtlsState.disconnect(this); | 397 tc->SignalDtlsState.disconnect(this); |
| 399 tc->SignalSelectedCandidatePairChanged.disconnect(this); | |
| 400 tc->SignalSentPacket.disconnect(this); | 398 tc->SignalSentPacket.disconnect(this); |
| 399 tc->ice_transport()->SignalSelectedCandidatePairChanged.disconnect(this); | |
| 401 } | 400 } |
| 402 | 401 |
| 403 bool BaseChannel::Enable(bool enable) { | 402 bool BaseChannel::Enable(bool enable) { |
| 404 worker_thread_->Invoke<void>( | 403 worker_thread_->Invoke<void>( |
| 405 RTC_FROM_HERE, | 404 RTC_FROM_HERE, |
| 406 Bind(enable ? &BaseChannel::EnableMedia_w : &BaseChannel::DisableMedia_w, | 405 Bind(enable ? &BaseChannel::EnableMedia_w : &BaseChannel::DisableMedia_w, |
| 407 this)); | 406 this)); |
| 408 return true; | 407 return true; |
| 409 } | 408 } |
| 410 | 409 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 460 | 459 |
| 461 void BaseChannel::StopConnectionMonitor() { | 460 void BaseChannel::StopConnectionMonitor() { |
| 462 if (connection_monitor_) { | 461 if (connection_monitor_) { |
| 463 connection_monitor_->Stop(); | 462 connection_monitor_->Stop(); |
| 464 connection_monitor_.reset(); | 463 connection_monitor_.reset(); |
| 465 } | 464 } |
| 466 } | 465 } |
| 467 | 466 |
| 468 bool BaseChannel::GetConnectionStats(ConnectionInfos* infos) { | 467 bool BaseChannel::GetConnectionStats(ConnectionInfos* infos) { |
| 469 RTC_DCHECK(network_thread_->IsCurrent()); | 468 RTC_DCHECK(network_thread_->IsCurrent()); |
| 470 return transport_channel_->GetStats(infos); | 469 return transport_channel_->ice_transport()->GetStats(infos); |
| 471 } | 470 } |
| 472 | 471 |
| 473 bool BaseChannel::IsReadyToReceiveMedia_w() const { | 472 bool BaseChannel::IsReadyToReceiveMedia_w() const { |
| 474 // Receive data if we are enabled and have local content, | 473 // Receive data if we are enabled and have local content, |
| 475 return enabled() && IsReceiveContentDirection(local_content_direction_); | 474 return enabled() && IsReceiveContentDirection(local_content_direction_); |
| 476 } | 475 } |
| 477 | 476 |
| 478 bool BaseChannel::IsReadyToSendMedia_w() const { | 477 bool BaseChannel::IsReadyToSendMedia_w() const { |
| 479 // Need to access some state updated on the network thread. | 478 // Need to access some state updated on the network thread. |
| 480 return network_thread_->Invoke<bool>( | 479 return network_thread_->Invoke<bool>( |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 503 int BaseChannel::SetOption(SocketType type, rtc::Socket::Option opt, | 502 int BaseChannel::SetOption(SocketType type, rtc::Socket::Option opt, |
| 504 int value) { | 503 int value) { |
| 505 return network_thread_->Invoke<int>( | 504 return network_thread_->Invoke<int>( |
| 506 RTC_FROM_HERE, Bind(&BaseChannel::SetOption_n, this, type, opt, value)); | 505 RTC_FROM_HERE, Bind(&BaseChannel::SetOption_n, this, type, opt, value)); |
| 507 } | 506 } |
| 508 | 507 |
| 509 int BaseChannel::SetOption_n(SocketType type, | 508 int BaseChannel::SetOption_n(SocketType type, |
| 510 rtc::Socket::Option opt, | 509 rtc::Socket::Option opt, |
| 511 int value) { | 510 int value) { |
| 512 RTC_DCHECK(network_thread_->IsCurrent()); | 511 RTC_DCHECK(network_thread_->IsCurrent()); |
| 513 TransportChannel* channel = nullptr; | 512 DtlsTransportInternal* channel = nullptr; |
| 514 switch (type) { | 513 switch (type) { |
| 515 case ST_RTP: | 514 case ST_RTP: |
| 516 channel = transport_channel_; | 515 channel = transport_channel_; |
| 517 socket_options_.push_back( | 516 socket_options_.push_back( |
| 518 std::pair<rtc::Socket::Option, int>(opt, value)); | 517 std::pair<rtc::Socket::Option, int>(opt, value)); |
| 519 break; | 518 break; |
| 520 case ST_RTCP: | 519 case ST_RTCP: |
| 521 channel = rtcp_transport_channel_; | 520 channel = rtcp_transport_channel_; |
| 522 rtcp_socket_options_.push_back( | 521 rtcp_socket_options_.push_back( |
| 523 std::pair<rtc::Socket::Option, int>(opt, value)); | 522 std::pair<rtc::Socket::Option, int>(opt, value)); |
| 524 break; | 523 break; |
| 525 } | 524 } |
| 526 return channel ? channel->SetOption(opt, value) : -1; | 525 return channel ? channel->ice_transport()->SetOption(opt, value) : -1; |
| 527 } | 526 } |
| 528 | 527 |
| 529 bool BaseChannel::SetCryptoOptions(const rtc::CryptoOptions& crypto_options) { | 528 bool BaseChannel::SetCryptoOptions(const rtc::CryptoOptions& crypto_options) { |
| 530 crypto_options_ = crypto_options; | 529 crypto_options_ = crypto_options; |
| 531 return true; | 530 return true; |
| 532 } | 531 } |
| 533 | 532 |
| 534 void BaseChannel::OnWritableState(rtc::PacketTransportInterface* transport) { | 533 void BaseChannel::OnWritableState(rtc::PacketTransportInterface* transport) { |
| 535 RTC_DCHECK(transport == transport_channel_ || | 534 RTC_DCHECK(transport == transport_channel_ || |
| 536 transport == rtcp_transport_channel_); | 535 transport == rtcp_transport_channel_); |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 553 rtc::CopyOnWriteBuffer packet(data, len); | 552 rtc::CopyOnWriteBuffer packet(data, len); |
| 554 HandlePacket(rtcp, &packet, packet_time); | 553 HandlePacket(rtcp, &packet, packet_time); |
| 555 } | 554 } |
| 556 | 555 |
| 557 void BaseChannel::OnReadyToSend(rtc::PacketTransportInterface* transport) { | 556 void BaseChannel::OnReadyToSend(rtc::PacketTransportInterface* transport) { |
| 558 RTC_DCHECK(transport == transport_channel_ || | 557 RTC_DCHECK(transport == transport_channel_ || |
| 559 transport == rtcp_transport_channel_); | 558 transport == rtcp_transport_channel_); |
| 560 SetTransportChannelReadyToSend(transport == rtcp_transport_channel_, true); | 559 SetTransportChannelReadyToSend(transport == rtcp_transport_channel_, true); |
| 561 } | 560 } |
| 562 | 561 |
| 563 void BaseChannel::OnDtlsState(TransportChannel* channel, | 562 void BaseChannel::OnDtlsState(DtlsTransportInternal* channel, |
| 564 DtlsTransportState state) { | 563 DtlsTransportState state) { |
| 565 if (!ShouldSetupDtlsSrtp_n()) { | 564 if (!ShouldSetupDtlsSrtp_n()) { |
| 566 return; | 565 return; |
| 567 } | 566 } |
| 568 | 567 |
| 569 // Reset the srtp filter if it's not the CONNECTED state. For the CONNECTED | 568 // Reset the srtp filter if it's not the CONNECTED state. For the CONNECTED |
| 570 // state, setting up DTLS-SRTP context is deferred to ChannelWritable_w to | 569 // state, setting up DTLS-SRTP context is deferred to ChannelWritable_w to |
| 571 // cover other scenarios like the whole channel is writable (not just this | 570 // cover other scenarios like the whole channel is writable (not just this |
| 572 // TransportChannel) or when TransportChannel is attached after DTLS is | 571 // TransportChannel) or when TransportChannel is attached after DTLS is |
| 573 // negotiated. | 572 // negotiated. |
| 574 if (state != DTLS_TRANSPORT_CONNECTED) { | 573 if (state != DTLS_TRANSPORT_CONNECTED) { |
| 575 srtp_filter_.ResetParams(); | 574 srtp_filter_.ResetParams(); |
| 576 } | 575 } |
| 577 } | 576 } |
| 578 | 577 |
| 579 void BaseChannel::OnSelectedCandidatePairChanged( | 578 void BaseChannel::OnSelectedCandidatePairChanged( |
| 580 TransportChannel* channel, | 579 IceTransportInternal* channel, |
| 581 CandidatePairInterface* selected_candidate_pair, | 580 CandidatePairInterface* selected_candidate_pair, |
| 582 int last_sent_packet_id, | 581 int last_sent_packet_id, |
| 583 bool ready_to_send) { | 582 bool ready_to_send) { |
| 584 RTC_DCHECK(channel == transport_channel_ || | 583 RTC_DCHECK(channel == transport_channel_->ice_transport() || |
| 585 channel == rtcp_transport_channel_); | 584 channel == rtcp_transport_channel_->ice_transport()); |
| 586 RTC_DCHECK(network_thread_->IsCurrent()); | 585 RTC_DCHECK(network_thread_->IsCurrent()); |
| 587 selected_candidate_pair_ = selected_candidate_pair; | 586 selected_candidate_pair_ = selected_candidate_pair; |
| 588 std::string transport_name = channel->transport_name(); | 587 std::string transport_name = channel->transport_name(); |
| 589 rtc::NetworkRoute network_route; | 588 rtc::NetworkRoute network_route; |
| 590 if (selected_candidate_pair) { | 589 if (selected_candidate_pair) { |
| 591 network_route = rtc::NetworkRoute( | 590 network_route = rtc::NetworkRoute( |
| 592 ready_to_send, selected_candidate_pair->local_candidate().network_id(), | 591 ready_to_send, selected_candidate_pair->local_candidate().network_id(), |
| 593 selected_candidate_pair->remote_candidate().network_id(), | 592 selected_candidate_pair->remote_candidate().network_id(), |
| 594 last_sent_packet_id); | 593 last_sent_packet_id); |
| 595 | 594 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 644 data->options = options; | 643 data->options = options; |
| 645 network_thread_->Post(RTC_FROM_HERE, this, message_id, data); | 644 network_thread_->Post(RTC_FROM_HERE, this, message_id, data); |
| 646 return true; | 645 return true; |
| 647 } | 646 } |
| 648 TRACE_EVENT0("webrtc", "BaseChannel::SendPacket"); | 647 TRACE_EVENT0("webrtc", "BaseChannel::SendPacket"); |
| 649 | 648 |
| 650 // Now that we are on the correct thread, ensure we have a place to send this | 649 // Now that we are on the correct thread, ensure we have a place to send this |
| 651 // packet before doing anything. (We might get RTCP packets that we don't | 650 // packet before doing anything. (We might get RTCP packets that we don't |
| 652 // intend to send.) If we've negotiated RTCP mux, send RTCP over the RTP | 651 // intend to send.) If we've negotiated RTCP mux, send RTCP over the RTP |
| 653 // transport. | 652 // transport. |
| 654 TransportChannel* channel = (!rtcp || rtcp_mux_filter_.IsActive()) ? | 653 DtlsTransportInternal* channel = (!rtcp || rtcp_mux_filter_.IsActive()) |
| 655 transport_channel_ : rtcp_transport_channel_; | 654 ? transport_channel_ |
| 655 : rtcp_transport_channel_; | |
| 656 if (!channel || !channel->writable()) { | 656 if (!channel || !channel->writable()) { |
| 657 return false; | 657 return false; |
| 658 } | 658 } |
| 659 | 659 |
| 660 // Protect ourselves against crazy data. | 660 // Protect ourselves against crazy data. |
| 661 if (!ValidPacket(rtcp, packet)) { | 661 if (!ValidPacket(rtcp, packet)) { |
| 662 LOG(LS_ERROR) << "Dropping outgoing " << content_name_ << " " | 662 LOG(LS_ERROR) << "Dropping outgoing " << content_name_ << " " |
| 663 << PacketType(rtcp) | 663 << PacketType(rtcp) |
| 664 << " packet: wrong size=" << packet->size(); | 664 << " packet: wrong size=" << packet->size(); |
| 665 return false; | 665 return false; |
| (...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 935 invoker_.AsyncInvoke<void>( | 935 invoker_.AsyncInvoke<void>( |
| 936 RTC_FROM_HERE, signaling_thread(), | 936 RTC_FROM_HERE, signaling_thread(), |
| 937 Bind(&BaseChannel::SignalDtlsSrtpSetupFailure_s, this, rtcp)); | 937 Bind(&BaseChannel::SignalDtlsSrtpSetupFailure_s, this, rtcp)); |
| 938 } | 938 } |
| 939 | 939 |
| 940 void BaseChannel::SignalDtlsSrtpSetupFailure_s(bool rtcp) { | 940 void BaseChannel::SignalDtlsSrtpSetupFailure_s(bool rtcp) { |
| 941 RTC_DCHECK(signaling_thread() == rtc::Thread::Current()); | 941 RTC_DCHECK(signaling_thread() == rtc::Thread::Current()); |
| 942 SignalDtlsSrtpSetupFailure(this, rtcp); | 942 SignalDtlsSrtpSetupFailure(this, rtcp); |
| 943 } | 943 } |
| 944 | 944 |
| 945 bool BaseChannel::SetDtlsSrtpCryptoSuites_n(TransportChannel* tc, bool rtcp) { | 945 bool BaseChannel::SetDtlsSrtpCryptoSuites_n(DtlsTransportInternal* tc, |
| 946 bool rtcp) { | |
| 946 std::vector<int> crypto_suites; | 947 std::vector<int> crypto_suites; |
| 947 // We always use the default SRTP crypto suites for RTCP, but we may use | 948 // We always use the default SRTP crypto suites for RTCP, but we may use |
| 948 // different crypto suites for RTP depending on the media type. | 949 // different crypto suites for RTP depending on the media type. |
| 949 if (!rtcp) { | 950 if (!rtcp) { |
| 950 GetSrtpCryptoSuites_n(&crypto_suites); | 951 GetSrtpCryptoSuites_n(&crypto_suites); |
| 951 } else { | 952 } else { |
| 952 GetDefaultSrtpCryptoSuites(crypto_options(), &crypto_suites); | 953 GetDefaultSrtpCryptoSuites(crypto_options(), &crypto_suites); |
| 953 } | 954 } |
| 954 return tc->SetSrtpCryptoSuites(crypto_suites); | 955 return tc->SetSrtpCryptoSuites(crypto_suites); |
| 955 } | 956 } |
| 956 | 957 |
| 957 bool BaseChannel::ShouldSetupDtlsSrtp_n() const { | 958 bool BaseChannel::ShouldSetupDtlsSrtp_n() const { |
| 958 // Since DTLS is applied to all channels, checking RTP should be enough. | 959 // Since DTLS is applied to all channels, checking RTP should be enough. |
| 959 return transport_channel_ && transport_channel_->IsDtlsActive(); | 960 return transport_channel_ && transport_channel_->IsDtlsActive(); |
| 960 } | 961 } |
| 961 | 962 |
| 962 // This function returns true if either DTLS-SRTP is not in use | 963 // This function returns true if either DTLS-SRTP is not in use |
| 963 // *or* DTLS-SRTP is successfully set up. | 964 // *or* DTLS-SRTP is successfully set up. |
| 964 bool BaseChannel::SetupDtlsSrtp_n(bool rtcp_channel) { | 965 bool BaseChannel::SetupDtlsSrtp_n(bool rtcp_channel) { |
| 965 RTC_DCHECK(network_thread_->IsCurrent()); | 966 RTC_DCHECK(network_thread_->IsCurrent()); |
| 966 bool ret = false; | 967 bool ret = false; |
| 967 | 968 |
| 968 TransportChannel* channel = | 969 DtlsTransportInternal* channel = |
| 969 rtcp_channel ? rtcp_transport_channel_ : transport_channel_; | 970 rtcp_channel ? rtcp_transport_channel_ : transport_channel_; |
| 970 | 971 |
| 971 RTC_DCHECK(channel->IsDtlsActive()); | 972 RTC_DCHECK(channel->IsDtlsActive()); |
| 972 | 973 |
| 973 int selected_crypto_suite; | 974 int selected_crypto_suite; |
| 974 | 975 |
| 975 if (!channel->GetSrtpCryptoSuite(&selected_crypto_suite)) { | 976 if (!channel->GetSrtpCryptoSuite(&selected_crypto_suite)) { |
| 976 LOG(LS_ERROR) << "No DTLS-SRTP selected crypto suite"; | 977 LOG(LS_ERROR) << "No DTLS-SRTP selected crypto suite"; |
| 977 return false; | 978 return false; |
| 978 } | 979 } |
| (...skipping 1431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2410 signaling_thread()->Post(RTC_FROM_HERE, this, MSG_READYTOSENDDATA, | 2411 signaling_thread()->Post(RTC_FROM_HERE, this, MSG_READYTOSENDDATA, |
| 2411 new DataChannelReadyToSendMessageData(writable)); | 2412 new DataChannelReadyToSendMessageData(writable)); |
| 2412 } | 2413 } |
| 2413 | 2414 |
| 2414 void RtpDataChannel::GetSrtpCryptoSuites_n( | 2415 void RtpDataChannel::GetSrtpCryptoSuites_n( |
| 2415 std::vector<int>* crypto_suites) const { | 2416 std::vector<int>* crypto_suites) const { |
| 2416 GetSupportedDataCryptoSuites(crypto_options(), crypto_suites); | 2417 GetSupportedDataCryptoSuites(crypto_options(), crypto_suites); |
| 2417 } | 2418 } |
| 2418 | 2419 |
| 2419 } // namespace cricket | 2420 } // namespace cricket |
| OLD | NEW |