OLD | NEW |
---|---|
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2004 Google Inc. | 3 * Copyright 2004 Google Inc. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
166 TransportController* transport_controller, | 166 TransportController* transport_controller, |
167 const std::string& content_name, | 167 const std::string& content_name, |
168 bool rtcp) | 168 bool rtcp) |
169 : worker_thread_(thread), | 169 : worker_thread_(thread), |
170 transport_controller_(transport_controller), | 170 transport_controller_(transport_controller), |
171 media_channel_(media_channel), | 171 media_channel_(media_channel), |
172 content_name_(content_name), | 172 content_name_(content_name), |
173 rtcp_transport_enabled_(rtcp), | 173 rtcp_transport_enabled_(rtcp), |
174 transport_channel_(nullptr), | 174 transport_channel_(nullptr), |
175 rtcp_transport_channel_(nullptr), | 175 rtcp_transport_channel_(nullptr), |
176 srtp_filter_(new SrtpFilter()), | |
176 enabled_(false), | 177 enabled_(false), |
177 writable_(false), | 178 writable_(false), |
178 rtp_ready_to_send_(false), | 179 rtp_ready_to_send_(false), |
179 rtcp_ready_to_send_(false), | 180 rtcp_ready_to_send_(false), |
180 was_ever_writable_(false), | 181 was_ever_writable_(false), |
181 local_content_direction_(MD_INACTIVE), | 182 local_content_direction_(MD_INACTIVE), |
182 remote_content_direction_(MD_INACTIVE), | 183 remote_content_direction_(MD_INACTIVE), |
183 has_received_packet_(false), | 184 has_received_packet_(false), |
184 dtls_keyed_(false), | 185 dtls_keyed_(false), |
185 secure_required_(false), | 186 secure_required_(false), |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
329 UpdateWritableState_w(); | 330 UpdateWritableState_w(); |
330 SetReadyToSend(true, new_tc && new_tc->writable()); | 331 SetReadyToSend(true, new_tc && new_tc->writable()); |
331 } | 332 } |
332 | 333 |
333 void BaseChannel::ConnectToTransportChannel(TransportChannel* tc) { | 334 void BaseChannel::ConnectToTransportChannel(TransportChannel* tc) { |
334 ASSERT(worker_thread_ == rtc::Thread::Current()); | 335 ASSERT(worker_thread_ == rtc::Thread::Current()); |
335 | 336 |
336 tc->SignalWritableState.connect(this, &BaseChannel::OnWritableState); | 337 tc->SignalWritableState.connect(this, &BaseChannel::OnWritableState); |
337 tc->SignalReadPacket.connect(this, &BaseChannel::OnChannelRead); | 338 tc->SignalReadPacket.connect(this, &BaseChannel::OnChannelRead); |
338 tc->SignalReadyToSend.connect(this, &BaseChannel::OnReadyToSend); | 339 tc->SignalReadyToSend.connect(this, &BaseChannel::OnReadyToSend); |
340 tc->SignalDtlsSrtpSetup.connect(this, &BaseChannel::OnDtlsSrtpSetup); | |
339 } | 341 } |
340 | 342 |
341 void BaseChannel::DisconnectFromTransportChannel(TransportChannel* tc) { | 343 void BaseChannel::DisconnectFromTransportChannel(TransportChannel* tc) { |
342 ASSERT(worker_thread_ == rtc::Thread::Current()); | 344 ASSERT(worker_thread_ == rtc::Thread::Current()); |
343 | 345 |
344 tc->SignalWritableState.disconnect(this); | 346 tc->SignalWritableState.disconnect(this); |
345 tc->SignalReadPacket.disconnect(this); | 347 tc->SignalReadPacket.disconnect(this); |
346 tc->SignalReadyToSend.disconnect(this); | 348 tc->SignalReadyToSend.disconnect(this); |
347 } | 349 } |
348 | 350 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
409 } | 411 } |
410 | 412 |
411 bool BaseChannel::IsReadyToReceive() const { | 413 bool BaseChannel::IsReadyToReceive() const { |
412 // Receive data if we are enabled and have local content, | 414 // Receive data if we are enabled and have local content, |
413 return enabled() && IsReceiveContentDirection(local_content_direction_); | 415 return enabled() && IsReceiveContentDirection(local_content_direction_); |
414 } | 416 } |
415 | 417 |
416 bool BaseChannel::IsReadyToSend() const { | 418 bool BaseChannel::IsReadyToSend() const { |
417 // Send outgoing data if we are enabled, have local and remote content, | 419 // Send outgoing data if we are enabled, have local and remote content, |
418 // and we have had some form of connectivity. | 420 // and we have had some form of connectivity. |
419 return enabled() && | 421 return enabled() && IsReceiveContentDirection(remote_content_direction_) && |
420 IsReceiveContentDirection(remote_content_direction_) && | |
421 IsSendContentDirection(local_content_direction_) && | 422 IsSendContentDirection(local_content_direction_) && |
422 was_ever_writable(); | 423 was_ever_writable(); |
423 } | 424 } |
424 | 425 |
425 bool BaseChannel::SendPacket(rtc::Buffer* packet, | 426 bool BaseChannel::SendPacket(rtc::Buffer* packet, |
426 const rtc::PacketOptions& options) { | 427 const rtc::PacketOptions& options) { |
427 return SendPacket(false, packet, options); | 428 return SendPacket(false, packet, options); |
428 } | 429 } |
429 | 430 |
430 bool BaseChannel::SendRtcp(rtc::Buffer* packet, | 431 bool BaseChannel::SendRtcp(rtc::Buffer* packet, |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
467 bool rtcp = PacketIsRtcp(channel, data, len); | 468 bool rtcp = PacketIsRtcp(channel, data, len); |
468 rtc::Buffer packet(data, len); | 469 rtc::Buffer packet(data, len); |
469 HandlePacket(rtcp, &packet, packet_time); | 470 HandlePacket(rtcp, &packet, packet_time); |
470 } | 471 } |
471 | 472 |
472 void BaseChannel::OnReadyToSend(TransportChannel* channel) { | 473 void BaseChannel::OnReadyToSend(TransportChannel* channel) { |
473 ASSERT(channel == transport_channel_ || channel == rtcp_transport_channel_); | 474 ASSERT(channel == transport_channel_ || channel == rtcp_transport_channel_); |
474 SetReadyToSend(channel == rtcp_transport_channel_, true); | 475 SetReadyToSend(channel == rtcp_transport_channel_, true); |
475 } | 476 } |
476 | 477 |
478 void BaseChannel::OnDtlsSrtpSetup(TransportChannel* channel) { | |
pthatcher1
2015/11/18 20:42:43
Since this will be fired on the worker thread, we
| |
479 // When the channel signals the DTLS-SRTP has been setup, set the | |
480 // |was_ever_writable| to false, allowing re-setup SRTP here. | |
481 LOG(LS_INFO) << "TransportChannel has DTLS-SRTP set up."; | |
482 was_ever_writable_ = false; | |
pthatcher1
2015/11/18 20:42:43
That's not what "was ever writable" means. It it
| |
483 } | |
484 | |
477 void BaseChannel::SetReadyToSend(bool rtcp, bool ready) { | 485 void BaseChannel::SetReadyToSend(bool rtcp, bool ready) { |
478 if (rtcp) { | 486 if (rtcp) { |
479 rtcp_ready_to_send_ = ready; | 487 rtcp_ready_to_send_ = ready; |
480 } else { | 488 } else { |
481 rtp_ready_to_send_ = ready; | 489 rtp_ready_to_send_ = ready; |
482 } | 490 } |
483 | 491 |
484 if (rtp_ready_to_send_ && | 492 if (rtp_ready_to_send_ && |
485 // In the case of rtcp mux |rtcp_transport_channel_| will be null. | 493 // In the case of rtcp mux |rtcp_transport_channel_| will be null. |
486 (rtcp_ready_to_send_ || !rtcp_transport_channel_)) { | 494 (rtcp_ready_to_send_ || !rtcp_transport_channel_)) { |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
532 if (!ValidPacket(rtcp, packet)) { | 540 if (!ValidPacket(rtcp, packet)) { |
533 LOG(LS_ERROR) << "Dropping outgoing " << content_name_ << " " | 541 LOG(LS_ERROR) << "Dropping outgoing " << content_name_ << " " |
534 << PacketType(rtcp) | 542 << PacketType(rtcp) |
535 << " packet: wrong size=" << packet->size(); | 543 << " packet: wrong size=" << packet->size(); |
536 return false; | 544 return false; |
537 } | 545 } |
538 | 546 |
539 rtc::PacketOptions updated_options; | 547 rtc::PacketOptions updated_options; |
540 updated_options = options; | 548 updated_options = options; |
541 // Protect if needed. | 549 // Protect if needed. |
542 if (srtp_filter_.IsActive()) { | 550 if (srtp_filter_->IsActive()) { |
543 bool res; | 551 bool res; |
544 uint8_t* data = packet->data(); | 552 uint8_t* data = packet->data(); |
545 int len = static_cast<int>(packet->size()); | 553 int len = static_cast<int>(packet->size()); |
546 if (!rtcp) { | 554 if (!rtcp) { |
547 // If ENABLE_EXTERNAL_AUTH flag is on then packet authentication is not done | 555 // If ENABLE_EXTERNAL_AUTH flag is on then packet authentication is not done |
548 // inside libsrtp for a RTP packet. A external HMAC module will be writing | 556 // inside libsrtp for a RTP packet. A external HMAC module will be writing |
549 // a fake HMAC value. This is ONLY done for a RTP packet. | 557 // a fake HMAC value. This is ONLY done for a RTP packet. |
550 // Socket layer will update rtp sendtime extension header if present in | 558 // Socket layer will update rtp sendtime extension header if present in |
551 // packet with current time before updating the HMAC. | 559 // packet with current time before updating the HMAC. |
552 #if !defined(ENABLE_EXTERNAL_AUTH) | 560 #if !defined(ENABLE_EXTERNAL_AUTH) |
553 res = srtp_filter_.ProtectRtp( | 561 res = srtp_filter_->ProtectRtp( |
554 data, len, static_cast<int>(packet->capacity()), &len); | 562 data, len, static_cast<int>(packet->capacity()), &len); |
555 #else | 563 #else |
556 updated_options.packet_time_params.rtp_sendtime_extension_id = | 564 updated_options.packet_time_params.rtp_sendtime_extension_id = |
557 rtp_abs_sendtime_extn_id_; | 565 rtp_abs_sendtime_extn_id_; |
558 res = srtp_filter_.ProtectRtp( | 566 res = srtp_filter_->ProtectRtp( |
559 data, len, static_cast<int>(packet->capacity()), &len, | 567 data, len, static_cast<int>(packet->capacity()), &len, |
560 &updated_options.packet_time_params.srtp_packet_index); | 568 &updated_options.packet_time_params.srtp_packet_index); |
561 // If protection succeeds, let's get auth params from srtp. | 569 // If protection succeeds, let's get auth params from srtp. |
562 if (res) { | 570 if (res) { |
563 uint8_t* auth_key = NULL; | 571 uint8_t* auth_key = NULL; |
564 int key_len; | 572 int key_len; |
565 res = srtp_filter_.GetRtpAuthParams( | 573 res = srtp_filter_->GetRtpAuthParams( |
566 &auth_key, &key_len, | 574 &auth_key, &key_len, |
567 &updated_options.packet_time_params.srtp_auth_tag_len); | 575 &updated_options.packet_time_params.srtp_auth_tag_len); |
568 if (res) { | 576 if (res) { |
569 updated_options.packet_time_params.srtp_auth_key.resize(key_len); | 577 updated_options.packet_time_params.srtp_auth_key.resize(key_len); |
570 updated_options.packet_time_params.srtp_auth_key.assign( | 578 updated_options.packet_time_params.srtp_auth_key.assign( |
571 auth_key, auth_key + key_len); | 579 auth_key, auth_key + key_len); |
572 } | 580 } |
573 } | 581 } |
574 #endif | 582 #endif |
575 if (!res) { | 583 if (!res) { |
576 int seq_num = -1; | 584 int seq_num = -1; |
577 uint32_t ssrc = 0; | 585 uint32_t ssrc = 0; |
578 GetRtpSeqNum(data, len, &seq_num); | 586 GetRtpSeqNum(data, len, &seq_num); |
579 GetRtpSsrc(data, len, &ssrc); | 587 GetRtpSsrc(data, len, &ssrc); |
580 LOG(LS_ERROR) << "Failed to protect " << content_name_ | 588 LOG(LS_ERROR) << "Failed to protect " << content_name_ |
581 << " RTP packet: size=" << len | 589 << " RTP packet: size=" << len |
582 << ", seqnum=" << seq_num << ", SSRC=" << ssrc; | 590 << ", seqnum=" << seq_num << ", SSRC=" << ssrc; |
583 return false; | 591 return false; |
584 } | 592 } |
585 } else { | 593 } else { |
586 res = srtp_filter_.ProtectRtcp(data, len, | 594 res = srtp_filter_->ProtectRtcp( |
587 static_cast<int>(packet->capacity()), | 595 data, len, static_cast<int>(packet->capacity()), &len); |
588 &len); | |
589 if (!res) { | 596 if (!res) { |
590 int type = -1; | 597 int type = -1; |
591 GetRtcpType(data, len, &type); | 598 GetRtcpType(data, len, &type); |
592 LOG(LS_ERROR) << "Failed to protect " << content_name_ | 599 LOG(LS_ERROR) << "Failed to protect " << content_name_ |
593 << " RTCP packet: size=" << len << ", type=" << type; | 600 << " RTCP packet: size=" << len << ", type=" << type; |
594 return false; | 601 return false; |
595 } | 602 } |
596 } | 603 } |
597 | 604 |
598 // Update the length of the packet now that we've added the auth tag. | 605 // Update the length of the packet now that we've added the auth tag. |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
640 } | 647 } |
641 | 648 |
642 // We are only interested in the first rtp packet because that | 649 // We are only interested in the first rtp packet because that |
643 // indicates the media has started flowing. | 650 // indicates the media has started flowing. |
644 if (!has_received_packet_ && !rtcp) { | 651 if (!has_received_packet_ && !rtcp) { |
645 has_received_packet_ = true; | 652 has_received_packet_ = true; |
646 signaling_thread()->Post(this, MSG_FIRSTPACKETRECEIVED); | 653 signaling_thread()->Post(this, MSG_FIRSTPACKETRECEIVED); |
647 } | 654 } |
648 | 655 |
649 // Unprotect the packet, if needed. | 656 // Unprotect the packet, if needed. |
650 if (srtp_filter_.IsActive()) { | 657 if (srtp_filter_->IsActive()) { |
651 char* data = packet->data<char>(); | 658 char* data = packet->data<char>(); |
652 int len = static_cast<int>(packet->size()); | 659 int len = static_cast<int>(packet->size()); |
653 bool res; | 660 bool res; |
654 if (!rtcp) { | 661 if (!rtcp) { |
655 res = srtp_filter_.UnprotectRtp(data, len, &len); | 662 res = srtp_filter_->UnprotectRtp(data, len, &len); |
656 if (!res) { | 663 if (!res) { |
657 int seq_num = -1; | 664 int seq_num = -1; |
658 uint32_t ssrc = 0; | 665 uint32_t ssrc = 0; |
659 GetRtpSeqNum(data, len, &seq_num); | 666 GetRtpSeqNum(data, len, &seq_num); |
660 GetRtpSsrc(data, len, &ssrc); | 667 GetRtpSsrc(data, len, &ssrc); |
661 LOG(LS_ERROR) << "Failed to unprotect " << content_name_ | 668 LOG(LS_ERROR) << "Failed to unprotect " << content_name_ |
662 << " RTP packet: size=" << len | 669 << " RTP packet: size=" << len |
663 << ", seqnum=" << seq_num << ", SSRC=" << ssrc; | 670 << ", seqnum=" << seq_num << ", SSRC=" << ssrc; |
664 return; | 671 return; |
665 } | 672 } |
666 } else { | 673 } else { |
667 res = srtp_filter_.UnprotectRtcp(data, len, &len); | 674 res = srtp_filter_->UnprotectRtcp(data, len, &len); |
668 if (!res) { | 675 if (!res) { |
669 int type = -1; | 676 int type = -1; |
670 GetRtcpType(data, len, &type); | 677 GetRtcpType(data, len, &type); |
671 LOG(LS_ERROR) << "Failed to unprotect " << content_name_ | 678 LOG(LS_ERROR) << "Failed to unprotect " << content_name_ |
672 << " RTCP packet: size=" << len << ", type=" << type; | 679 << " RTCP packet: size=" << len << ", type=" << type; |
673 return; | 680 return; |
674 } | 681 } |
675 } | 682 } |
676 | 683 |
677 packet->SetSize(len); | 684 packet->SetSize(len); |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
769 for (std::vector<ConnectionInfo>::const_iterator it = infos.begin(); | 776 for (std::vector<ConnectionInfo>::const_iterator it = infos.begin(); |
770 it != infos.end(); ++it) { | 777 it != infos.end(); ++it) { |
771 if (it->best_connection) { | 778 if (it->best_connection) { |
772 LOG(LS_INFO) << "Using " << it->local_candidate.ToSensitiveString() | 779 LOG(LS_INFO) << "Using " << it->local_candidate.ToSensitiveString() |
773 << "->" << it->remote_candidate.ToSensitiveString(); | 780 << "->" << it->remote_candidate.ToSensitiveString(); |
774 break; | 781 break; |
775 } | 782 } |
776 } | 783 } |
777 | 784 |
778 // If we're doing DTLS-SRTP, now is the time. | 785 // If we're doing DTLS-SRTP, now is the time. |
779 if (!was_ever_writable_ && ShouldSetupDtlsSrtp()) { | 786 if (!was_ever_writable_ && ShouldSetupDtlsSrtp() && IsUsingDtlsSrtp()) { |
787 // If we're using DTLS-SRTP, instead of resetting the SRTP context, just | |
788 // recreate a SRTP context. | |
789 srtp_filter_.reset(new SrtpFilter()); | |
790 | |
780 if (!SetupDtlsSrtp(false)) { | 791 if (!SetupDtlsSrtp(false)) { |
781 SignalDtlsSetupFailure_w(false); | 792 SignalDtlsSetupFailure_w(false); |
782 return; | 793 return; |
783 } | 794 } |
784 | 795 |
785 if (rtcp_transport_channel_) { | 796 if (rtcp_transport_channel_) { |
786 if (!SetupDtlsSrtp(true)) { | 797 if (!SetupDtlsSrtp(true)) { |
787 SignalDtlsSetupFailure_w(true); | 798 SignalDtlsSetupFailure_w(true); |
788 return; | 799 return; |
789 } | 800 } |
(...skipping 25 matching lines...) Expand all Loading... | |
815 } else { | 826 } else { |
816 GetDefaultSrtpCryptoSuiteNames(&ciphers); | 827 GetDefaultSrtpCryptoSuiteNames(&ciphers); |
817 } | 828 } |
818 return tc->SetSrtpCiphers(ciphers); | 829 return tc->SetSrtpCiphers(ciphers); |
819 } | 830 } |
820 | 831 |
821 bool BaseChannel::ShouldSetupDtlsSrtp() const { | 832 bool BaseChannel::ShouldSetupDtlsSrtp() const { |
822 return true; | 833 return true; |
823 } | 834 } |
824 | 835 |
836 bool BaseChannel::IsUsingDtlsSrtp() const { | |
837 return (transport_channel_ && transport_channel_->IsDtlsActive()) || | |
838 (rtcp_transport_channel_ && rtcp_transport_channel_->IsDtlsActive()); | |
839 } | |
840 | |
825 // This function returns true if either DTLS-SRTP is not in use | 841 // This function returns true if either DTLS-SRTP is not in use |
826 // *or* DTLS-SRTP is successfully set up. | 842 // *or* DTLS-SRTP is successfully set up. |
827 bool BaseChannel::SetupDtlsSrtp(bool rtcp_channel) { | 843 bool BaseChannel::SetupDtlsSrtp(bool rtcp_channel) { |
828 bool ret = false; | 844 bool ret = false; |
829 | 845 |
830 TransportChannel* channel = | 846 TransportChannel* channel = |
831 rtcp_channel ? rtcp_transport_channel_ : transport_channel_; | 847 rtcp_channel ? rtcp_transport_channel_ : transport_channel_; |
832 | 848 |
833 // No DTLS | 849 // No DTLS |
834 if (!channel->IsDtlsActive()) | 850 if (!channel->IsDtlsActive()) |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
886 | 902 |
887 if (role == rtc::SSL_SERVER) { | 903 if (role == rtc::SSL_SERVER) { |
888 send_key = &server_write_key; | 904 send_key = &server_write_key; |
889 recv_key = &client_write_key; | 905 recv_key = &client_write_key; |
890 } else { | 906 } else { |
891 send_key = &client_write_key; | 907 send_key = &client_write_key; |
892 recv_key = &server_write_key; | 908 recv_key = &server_write_key; |
893 } | 909 } |
894 | 910 |
895 if (rtcp_channel) { | 911 if (rtcp_channel) { |
896 ret = srtp_filter_.SetRtcpParams( | 912 ret = srtp_filter_->SetRtcpParams( |
897 selected_cipher, | 913 selected_cipher, &(*send_key)[0], static_cast<int>(send_key->size()), |
898 &(*send_key)[0], | 914 selected_cipher, &(*recv_key)[0], static_cast<int>(recv_key->size())); |
899 static_cast<int>(send_key->size()), | |
900 selected_cipher, | |
901 &(*recv_key)[0], | |
902 static_cast<int>(recv_key->size())); | |
903 } else { | 915 } else { |
904 ret = srtp_filter_.SetRtpParams( | 916 ret = srtp_filter_->SetRtpParams( |
905 selected_cipher, | 917 selected_cipher, &(*send_key)[0], static_cast<int>(send_key->size()), |
906 &(*send_key)[0], | 918 selected_cipher, &(*recv_key)[0], static_cast<int>(recv_key->size())); |
907 static_cast<int>(send_key->size()), | |
908 selected_cipher, | |
909 &(*recv_key)[0], | |
910 static_cast<int>(recv_key->size())); | |
911 } | 919 } |
912 | 920 |
913 if (!ret) | 921 if (!ret) |
914 LOG(LS_WARNING) << "DTLS-SRTP key installation failed"; | 922 LOG(LS_WARNING) << "DTLS-SRTP key installation failed"; |
915 else | 923 else |
916 dtls_keyed_ = true; | 924 dtls_keyed_ = true; |
917 | 925 |
918 return ret; | 926 return ret; |
919 } | 927 } |
920 | 928 |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
980 bool dtls = false; | 988 bool dtls = false; |
981 ret = CheckSrtpConfig(cryptos, &dtls, error_desc); | 989 ret = CheckSrtpConfig(cryptos, &dtls, error_desc); |
982 if (!ret) { | 990 if (!ret) { |
983 return false; | 991 return false; |
984 } | 992 } |
985 switch (action) { | 993 switch (action) { |
986 case CA_OFFER: | 994 case CA_OFFER: |
987 // If DTLS is already active on the channel, we could be renegotiating | 995 // If DTLS is already active on the channel, we could be renegotiating |
988 // here. We don't update the srtp filter. | 996 // here. We don't update the srtp filter. |
989 if (!dtls) { | 997 if (!dtls) { |
990 ret = srtp_filter_.SetOffer(cryptos, src); | 998 ret = srtp_filter_->SetOffer(cryptos, src); |
991 } | 999 } |
992 break; | 1000 break; |
993 case CA_PRANSWER: | 1001 case CA_PRANSWER: |
994 // If we're doing DTLS-SRTP, we don't want to update the filter | 1002 // If we're doing DTLS-SRTP, we don't want to update the filter |
995 // with an answer, because we already have SRTP parameters. | 1003 // with an answer, because we already have SRTP parameters. |
996 if (!dtls) { | 1004 if (!dtls) { |
997 ret = srtp_filter_.SetProvisionalAnswer(cryptos, src); | 1005 ret = srtp_filter_->SetProvisionalAnswer(cryptos, src); |
998 } | 1006 } |
999 break; | 1007 break; |
1000 case CA_ANSWER: | 1008 case CA_ANSWER: |
1001 // If we're doing DTLS-SRTP, we don't want to update the filter | 1009 // If we're doing DTLS-SRTP, we don't want to update the filter |
1002 // with an answer, because we already have SRTP parameters. | 1010 // with an answer, because we already have SRTP parameters. |
1003 if (!dtls) { | 1011 if (!dtls) { |
1004 ret = srtp_filter_.SetAnswer(cryptos, src); | 1012 ret = srtp_filter_->SetAnswer(cryptos, src); |
1005 } | 1013 } |
1006 break; | 1014 break; |
1007 default: | 1015 default: |
1008 break; | 1016 break; |
1009 } | 1017 } |
1010 if (!ret) { | 1018 if (!ret) { |
1011 SafeSetError("Failed to setup SRTP filter.", error_desc); | 1019 SafeSetError("Failed to setup SRTP filter.", error_desc); |
1012 return false; | 1020 return false; |
1013 } | 1021 } |
1014 return true; | 1022 return true; |
(...skipping 1273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2288 return (data_channel_type_ == DCT_RTP); | 2296 return (data_channel_type_ == DCT_RTP); |
2289 } | 2297 } |
2290 | 2298 |
2291 void DataChannel::OnStreamClosedRemotely(uint32_t sid) { | 2299 void DataChannel::OnStreamClosedRemotely(uint32_t sid) { |
2292 rtc::TypedMessageData<uint32_t>* message = | 2300 rtc::TypedMessageData<uint32_t>* message = |
2293 new rtc::TypedMessageData<uint32_t>(sid); | 2301 new rtc::TypedMessageData<uint32_t>(sid); |
2294 signaling_thread()->Post(this, MSG_STREAMCLOSEDREMOTELY, message); | 2302 signaling_thread()->Post(this, MSG_STREAMCLOSEDREMOTELY, message); |
2295 } | 2303 } |
2296 | 2304 |
2297 } // namespace cricket | 2305 } // namespace cricket |
OLD | NEW |