Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(49)

Side by Side Diff: webrtc/pc/srtpfilter.cc

Issue 2761143002: Support encrypted RTP extensions (RFC 6904) (Closed)
Patch Set: Fix compile error on win_x64 bots. Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/pc/srtpfilter.h ('k') | webrtc/pc/srtpfilter_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2009 The WebRTC project authors. All Rights Reserved. 2 * Copyright 2009 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 const uint8_t* send_key, 70 const uint8_t* send_key,
71 int send_key_len, 71 int send_key_len,
72 int recv_cs, 72 int recv_cs,
73 const uint8_t* recv_key, 73 const uint8_t* recv_key,
74 int recv_key_len) { 74 int recv_key_len) {
75 if (IsActive()) { 75 if (IsActive()) {
76 LOG(LS_ERROR) << "Tried to set SRTP Params when filter already active"; 76 LOG(LS_ERROR) << "Tried to set SRTP Params when filter already active";
77 return false; 77 return false;
78 } 78 }
79 CreateSrtpSessions(); 79 CreateSrtpSessions();
80 if (!send_session_->SetSend(send_cs, send_key, send_key_len)) 80 send_session_->SetEncryptedHeaderExtensionIds(
81 send_encrypted_header_extension_ids_);
82 if (!send_session_->SetSend(send_cs, send_key, send_key_len)) {
81 return false; 83 return false;
84 }
82 85
83 if (!recv_session_->SetRecv(recv_cs, recv_key, recv_key_len)) 86 recv_session_->SetEncryptedHeaderExtensionIds(
87 recv_encrypted_header_extension_ids_);
88 if (!recv_session_->SetRecv(recv_cs, recv_key, recv_key_len)) {
84 return false; 89 return false;
90 }
85 91
86 state_ = ST_ACTIVE; 92 state_ = ST_ACTIVE;
87 93
88 LOG(LS_INFO) << "SRTP activated with negotiated parameters:" 94 LOG(LS_INFO) << "SRTP activated with negotiated parameters:"
89 << " send cipher_suite " << send_cs 95 << " send cipher_suite " << send_cs
90 << " recv cipher_suite " << recv_cs; 96 << " recv cipher_suite " << recv_cs;
91 return true; 97 return true;
92 } 98 }
93 99
100 bool SrtpFilter::UpdateRtpParams(int send_cs,
101 const uint8_t* send_key,
102 int send_key_len,
103 int recv_cs,
104 const uint8_t* recv_key,
105 int recv_key_len) {
106 if (!IsActive()) {
107 LOG(LS_ERROR) << "Tried to update SRTP Params when filter is not active";
108 return false;
109 }
110 send_session_->SetEncryptedHeaderExtensionIds(
111 send_encrypted_header_extension_ids_);
112 if (!send_session_->UpdateSend(send_cs, send_key, send_key_len)) {
113 return false;
114 }
115
116 recv_session_->SetEncryptedHeaderExtensionIds(
117 recv_encrypted_header_extension_ids_);
118 if (!recv_session_->UpdateRecv(recv_cs, recv_key, recv_key_len)) {
119 return false;
120 }
121
122 LOG(LS_INFO) << "SRTP updated with negotiated parameters:"
123 << " send cipher_suite " << send_cs
124 << " recv cipher_suite " << recv_cs;
125 return true;
126 }
127
94 // This function is provided separately because DTLS-SRTP behaves 128 // This function is provided separately because DTLS-SRTP behaves
95 // differently in RTP/RTCP mux and non-mux modes. 129 // differently in RTP/RTCP mux and non-mux modes.
96 // 130 //
97 // - In the non-muxed case, RTP and RTCP are keyed with different 131 // - In the non-muxed case, RTP and RTCP are keyed with different
98 // keys (from different DTLS handshakes), and so we need a new 132 // keys (from different DTLS handshakes), and so we need a new
99 // SrtpSession. 133 // SrtpSession.
100 // - In the muxed case, they are keyed with the same keys, so 134 // - In the muxed case, they are keyed with the same keys, so
101 // this function is not needed 135 // this function is not needed
102 bool SrtpFilter::SetRtcpParams(int send_cs, 136 bool SrtpFilter::SetRtcpParams(int send_cs,
103 const uint8_t* send_key, 137 const uint8_t* send_key,
104 int send_key_len, 138 int send_key_len,
105 int recv_cs, 139 int recv_cs,
106 const uint8_t* recv_key, 140 const uint8_t* recv_key,
107 int recv_key_len) { 141 int recv_key_len) {
108 // This can only be called once, but can be safely called after 142 // This can only be called once, but can be safely called after
109 // SetRtpParams 143 // SetRtpParams
110 if (send_rtcp_session_ || recv_rtcp_session_) { 144 if (send_rtcp_session_ || recv_rtcp_session_) {
111 LOG(LS_ERROR) << "Tried to set SRTCP Params when filter already active"; 145 LOG(LS_ERROR) << "Tried to set SRTCP Params when filter already active";
112 return false; 146 return false;
113 } 147 }
114 148
115 send_rtcp_session_.reset(new SrtpSession()); 149 send_rtcp_session_.reset(new SrtpSession());
116 if (!send_rtcp_session_->SetRecv(send_cs, send_key, send_key_len)) 150 if (!send_rtcp_session_->SetRecv(send_cs, send_key, send_key_len)) {
117 return false; 151 return false;
152 }
118 153
119 recv_rtcp_session_.reset(new SrtpSession()); 154 recv_rtcp_session_.reset(new SrtpSession());
120 if (!recv_rtcp_session_->SetRecv(recv_cs, recv_key, recv_key_len)) 155 if (!recv_rtcp_session_->SetRecv(recv_cs, recv_key, recv_key_len)) {
121 return false; 156 return false;
157 }
122 158
123 LOG(LS_INFO) << "SRTCP activated with negotiated parameters:" 159 LOG(LS_INFO) << "SRTCP activated with negotiated parameters:"
124 << " send cipher_suite " << send_cs 160 << " send cipher_suite " << send_cs
125 << " recv cipher_suite " << recv_cs; 161 << " recv cipher_suite " << recv_cs;
126 162
127 return true; 163 return true;
128 } 164 }
129 165
130 bool SrtpFilter::ProtectRtp(void* p, int in_len, int max_len, int* out_len) { 166 bool SrtpFilter::ProtectRtp(void* p, int in_len, int max_len, int* out_len) {
131 if (!IsActive()) { 167 if (!IsActive()) {
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 bool SrtpFilter::IsExternalAuthActive() const { 253 bool SrtpFilter::IsExternalAuthActive() const {
218 if (!IsActive()) { 254 if (!IsActive()) {
219 LOG(LS_WARNING) << "Failed to check IsExternalAuthActive: SRTP not active"; 255 LOG(LS_WARNING) << "Failed to check IsExternalAuthActive: SRTP not active";
220 return false; 256 return false;
221 } 257 }
222 258
223 RTC_CHECK(send_session_); 259 RTC_CHECK(send_session_);
224 return send_session_->IsExternalAuthActive(); 260 return send_session_->IsExternalAuthActive();
225 } 261 }
226 262
263 void SrtpFilter::SetEncryptedHeaderExtensionIds(ContentSource source,
264 const std::vector<int>& extension_ids) {
265 if (source == CS_LOCAL) {
266 recv_encrypted_header_extension_ids_ = extension_ids;
267 } else {
268 send_encrypted_header_extension_ids_ = extension_ids;
269 }
270 }
271
227 bool SrtpFilter::ExpectOffer(ContentSource source) { 272 bool SrtpFilter::ExpectOffer(ContentSource source) {
228 return ((state_ == ST_INIT) || 273 return ((state_ == ST_INIT) ||
229 (state_ == ST_ACTIVE) || 274 (state_ == ST_ACTIVE) ||
230 (state_ == ST_SENTOFFER && source == CS_LOCAL) || 275 (state_ == ST_SENTOFFER && source == CS_LOCAL) ||
231 (state_ == ST_SENTUPDATEDOFFER && source == CS_LOCAL) || 276 (state_ == ST_SENTUPDATEDOFFER && source == CS_LOCAL) ||
232 (state_ == ST_RECEIVEDOFFER && source == CS_REMOTE) || 277 (state_ == ST_RECEIVEDOFFER && source == CS_REMOTE) ||
233 (state_ == ST_RECEIVEDUPDATEDOFFER && source == CS_REMOTE)); 278 (state_ == ST_RECEIVEDUPDATEDOFFER && source == CS_REMOTE));
234 } 279 }
235 280
236 bool SrtpFilter::StoreParams(const std::vector<CryptoParams>& params, 281 bool SrtpFilter::StoreParams(const std::vector<CryptoParams>& params,
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 // TODO(juberti): Zero these buffers after use. 422 // TODO(juberti): Zero these buffers after use.
378 bool ret; 423 bool ret;
379 rtc::Buffer send_key(send_key_len + send_salt_len); 424 rtc::Buffer send_key(send_key_len + send_salt_len);
380 rtc::Buffer recv_key(recv_key_len + recv_salt_len); 425 rtc::Buffer recv_key(recv_key_len + recv_salt_len);
381 ret = (ParseKeyParams(send_params.key_params, send_key.data(), 426 ret = (ParseKeyParams(send_params.key_params, send_key.data(),
382 send_key.size()) && 427 send_key.size()) &&
383 ParseKeyParams(recv_params.key_params, recv_key.data(), 428 ParseKeyParams(recv_params.key_params, recv_key.data(),
384 recv_key.size())); 429 recv_key.size()));
385 if (ret) { 430 if (ret) {
386 CreateSrtpSessions(); 431 CreateSrtpSessions();
432 send_session_->SetEncryptedHeaderExtensionIds(
433 send_encrypted_header_extension_ids_);
434 recv_session_->SetEncryptedHeaderExtensionIds(
435 recv_encrypted_header_extension_ids_);
387 ret = (send_session_->SetSend( 436 ret = (send_session_->SetSend(
388 rtc::SrtpCryptoSuiteFromName(send_params.cipher_suite), 437 rtc::SrtpCryptoSuiteFromName(send_params.cipher_suite),
389 send_key.data(), send_key.size()) && 438 send_key.data(), send_key.size()) &&
390 recv_session_->SetRecv( 439 recv_session_->SetRecv(
391 rtc::SrtpCryptoSuiteFromName(recv_params.cipher_suite), 440 rtc::SrtpCryptoSuiteFromName(recv_params.cipher_suite),
392 recv_key.data(), recv_key.size())); 441 recv_key.data(), recv_key.size()));
393 } 442 }
394 if (ret) { 443 if (ret) {
395 LOG(LS_INFO) << "SRTP activated with negotiated parameters:" 444 LOG(LS_INFO) << "SRTP activated with negotiated parameters:"
396 << " send cipher_suite " << send_params.cipher_suite 445 << " send cipher_suite " << send_params.cipher_suite
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
449 if (session_) { 498 if (session_) {
450 srtp_set_user_data(session_, nullptr); 499 srtp_set_user_data(session_, nullptr);
451 srtp_dealloc(session_); 500 srtp_dealloc(session_);
452 } 501 }
453 } 502 }
454 503
455 bool SrtpSession::SetSend(int cs, const uint8_t* key, size_t len) { 504 bool SrtpSession::SetSend(int cs, const uint8_t* key, size_t len) {
456 return SetKey(ssrc_any_outbound, cs, key, len); 505 return SetKey(ssrc_any_outbound, cs, key, len);
457 } 506 }
458 507
508 bool SrtpSession::UpdateSend(int cs, const uint8_t* key, size_t len) {
509 return UpdateKey(ssrc_any_outbound, cs, key, len);
510 }
511
459 bool SrtpSession::SetRecv(int cs, const uint8_t* key, size_t len) { 512 bool SrtpSession::SetRecv(int cs, const uint8_t* key, size_t len) {
460 return SetKey(ssrc_any_inbound, cs, key, len); 513 return SetKey(ssrc_any_inbound, cs, key, len);
461 } 514 }
462 515
516 bool SrtpSession::UpdateRecv(int cs, const uint8_t* key, size_t len) {
517 return UpdateKey(ssrc_any_inbound, cs, key, len);
518 }
519
463 bool SrtpSession::ProtectRtp(void* p, int in_len, int max_len, int* out_len) { 520 bool SrtpSession::ProtectRtp(void* p, int in_len, int max_len, int* out_len) {
464 RTC_DCHECK(thread_checker_.CalledOnValidThread()); 521 RTC_DCHECK(thread_checker_.CalledOnValidThread());
465 if (!session_) { 522 if (!session_) {
466 LOG(LS_WARNING) << "Failed to protect SRTP packet: no SRTP Session"; 523 LOG(LS_WARNING) << "Failed to protect SRTP packet: no SRTP Session";
467 return false; 524 return false;
468 } 525 }
469 526
470 int need_len = in_len + rtp_auth_tag_len_; // NOLINT 527 int need_len = in_len + rtp_auth_tag_len_; // NOLINT
471 if (max_len < need_len) { 528 if (max_len < need_len) {
472 LOG(LS_WARNING) << "Failed to protect SRTP packet: The buffer length " 529 LOG(LS_WARNING) << "Failed to protect SRTP packet: The buffer length "
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
619 return false; 676 return false;
620 } 677 }
621 678
622 // Shift packet index, put into network byte order 679 // Shift packet index, put into network byte order
623 *index = static_cast<int64_t>( 680 *index = static_cast<int64_t>(
624 rtc::NetworkToHost64( 681 rtc::NetworkToHost64(
625 srtp_rdbx_get_packet_index(&stream->rtp_rdbx) << 16)); 682 srtp_rdbx_get_packet_index(&stream->rtp_rdbx) << 16));
626 return true; 683 return true;
627 } 684 }
628 685
629 bool SrtpSession::SetKey(int type, int cs, const uint8_t* key, size_t len) { 686
687 bool SrtpSession::DoSetKey(int type, int cs, const uint8_t* key, size_t len) {
630 RTC_DCHECK(thread_checker_.CalledOnValidThread()); 688 RTC_DCHECK(thread_checker_.CalledOnValidThread());
631 if (session_) {
632 LOG(LS_ERROR) << "Failed to create SRTP session: "
633 << "SRTP session already created";
634 return false;
635 }
636
637 if (!Init()) {
638 return false;
639 }
640 689
641 srtp_policy_t policy; 690 srtp_policy_t policy;
642 memset(&policy, 0, sizeof(policy)); 691 memset(&policy, 0, sizeof(policy));
643 if (cs == rtc::SRTP_AES128_CM_SHA1_80) { 692 if (cs == rtc::SRTP_AES128_CM_SHA1_80) {
644 srtp_crypto_policy_set_aes_cm_128_hmac_sha1_80(&policy.rtp); 693 srtp_crypto_policy_set_aes_cm_128_hmac_sha1_80(&policy.rtp);
645 srtp_crypto_policy_set_aes_cm_128_hmac_sha1_80(&policy.rtcp); 694 srtp_crypto_policy_set_aes_cm_128_hmac_sha1_80(&policy.rtcp);
646 } else if (cs == rtc::SRTP_AES128_CM_SHA1_32) { 695 } else if (cs == rtc::SRTP_AES128_CM_SHA1_32) {
647 // RTP HMAC is shortened to 32 bits, but RTCP remains 80 bits. 696 // RTP HMAC is shortened to 32 bits, but RTCP remains 80 bits.
648 srtp_crypto_policy_set_aes_cm_128_hmac_sha1_32(&policy.rtp); 697 srtp_crypto_policy_set_aes_cm_128_hmac_sha1_32(&policy.rtp);
649 srtp_crypto_policy_set_aes_cm_128_hmac_sha1_80(&policy.rtcp); 698 srtp_crypto_policy_set_aes_cm_128_hmac_sha1_80(&policy.rtcp);
650 } else if (cs == rtc::SRTP_AEAD_AES_128_GCM) { 699 } else if (cs == rtc::SRTP_AEAD_AES_128_GCM) {
651 srtp_crypto_policy_set_aes_gcm_128_16_auth(&policy.rtp); 700 srtp_crypto_policy_set_aes_gcm_128_16_auth(&policy.rtp);
652 srtp_crypto_policy_set_aes_gcm_128_16_auth(&policy.rtcp); 701 srtp_crypto_policy_set_aes_gcm_128_16_auth(&policy.rtcp);
653 } else if (cs == rtc::SRTP_AEAD_AES_256_GCM) { 702 } else if (cs == rtc::SRTP_AEAD_AES_256_GCM) {
654 srtp_crypto_policy_set_aes_gcm_256_16_auth(&policy.rtp); 703 srtp_crypto_policy_set_aes_gcm_256_16_auth(&policy.rtp);
655 srtp_crypto_policy_set_aes_gcm_256_16_auth(&policy.rtcp); 704 srtp_crypto_policy_set_aes_gcm_256_16_auth(&policy.rtcp);
656 } else { 705 } else {
657 LOG(LS_WARNING) << "Failed to create SRTP session: unsupported" 706 LOG(LS_WARNING) << "Failed to " << (session_ ? "update" : "create")
658 << " cipher_suite " << cs; 707 << " SRTP session: unsupported cipher_suite " << cs;
659 return false; 708 return false;
660 } 709 }
661 710
662 int expected_key_len; 711 int expected_key_len;
663 int expected_salt_len; 712 int expected_salt_len;
664 if (!rtc::GetSrtpKeyAndSaltLengths(cs, &expected_key_len, 713 if (!rtc::GetSrtpKeyAndSaltLengths(cs, &expected_key_len,
665 &expected_salt_len)) { 714 &expected_salt_len)) {
666 // This should never happen. 715 // This should never happen.
667 LOG(LS_WARNING) << "Failed to create SRTP session: unsupported" 716 LOG(LS_WARNING) << "Failed to " << (session_ ? "update" : "create")
668 << " cipher_suite without length information" << cs; 717 << " SRTP session: unsupported cipher_suite without length information"
718 << cs;
669 return false; 719 return false;
670 } 720 }
671 721
672 if (!key || 722 if (!key ||
673 len != static_cast<size_t>(expected_key_len + expected_salt_len)) { 723 len != static_cast<size_t>(expected_key_len + expected_salt_len)) {
674 LOG(LS_WARNING) << "Failed to create SRTP session: invalid key"; 724 LOG(LS_WARNING) << "Failed to " << (session_ ? "update" : "create")
725 << " SRTP session: invalid key";
675 return false; 726 return false;
676 } 727 }
677 728
678 policy.ssrc.type = static_cast<srtp_ssrc_type_t>(type); 729 policy.ssrc.type = static_cast<srtp_ssrc_type_t>(type);
679 policy.ssrc.value = 0; 730 policy.ssrc.value = 0;
680 policy.key = const_cast<uint8_t*>(key); 731 policy.key = const_cast<uint8_t*>(key);
681 // TODO(astor) parse window size from WSH session-param 732 // TODO(astor) parse window size from WSH session-param
682 policy.window_size = 1024; 733 policy.window_size = 1024;
683 policy.allow_repeat_tx = 1; 734 policy.allow_repeat_tx = 1;
684 // If external authentication option is enabled, supply custom auth module 735 // If external authentication option is enabled, supply custom auth module
685 // id EXTERNAL_HMAC_SHA1 in the policy structure. 736 // id EXTERNAL_HMAC_SHA1 in the policy structure.
686 // We want to set this option only for rtp packets. 737 // We want to set this option only for rtp packets.
687 // By default policy structure is initialized to HMAC_SHA1. 738 // By default policy structure is initialized to HMAC_SHA1.
688 // Enable external HMAC authentication only for outgoing streams and only 739 // Enable external HMAC authentication only for outgoing streams and only
689 // for cipher suites that support it (i.e. only non-GCM cipher suites). 740 // for cipher suites that support it (i.e. only non-GCM cipher suites).
690 if (type == ssrc_any_outbound && IsExternalAuthEnabled() && 741 if (type == ssrc_any_outbound && IsExternalAuthEnabled() &&
691 !rtc::IsGcmCryptoSuite(cs)) { 742 !rtc::IsGcmCryptoSuite(cs)) {
692 policy.rtp.auth_type = EXTERNAL_HMAC_SHA1; 743 policy.rtp.auth_type = EXTERNAL_HMAC_SHA1;
693 } 744 }
745 if (!encrypted_header_extension_ids_.empty()) {
746 policy.enc_xtn_hdr = const_cast<int*>(&encrypted_header_extension_ids_[0]);
747 policy.enc_xtn_hdr_count =
748 static_cast<int>(encrypted_header_extension_ids_.size());
749 }
694 policy.next = nullptr; 750 policy.next = nullptr;
695 751
696 int err = srtp_create(&session_, &policy); 752 if (!session_) {
697 if (err != srtp_err_status_ok) { 753 int err = srtp_create(&session_, &policy);
698 session_ = nullptr; 754 if (err != srtp_err_status_ok) {
699 LOG(LS_ERROR) << "Failed to create SRTP session, err=" << err; 755 session_ = nullptr;
700 return false; 756 LOG(LS_ERROR) << "Failed to create SRTP session, err=" << err;
757 return false;
758 }
759 srtp_set_user_data(session_, this);
760 } else {
761 int err = srtp_update(session_, &policy);
762 if (err != srtp_err_status_ok) {
763 LOG(LS_ERROR) << "Failed to update SRTP session, err=" << err;
764 return false;
765 }
701 } 766 }
702 767
703 srtp_set_user_data(session_, this);
704 rtp_auth_tag_len_ = policy.rtp.auth_tag_len; 768 rtp_auth_tag_len_ = policy.rtp.auth_tag_len;
705 rtcp_auth_tag_len_ = policy.rtcp.auth_tag_len; 769 rtcp_auth_tag_len_ = policy.rtcp.auth_tag_len;
706 external_auth_active_ = (policy.rtp.auth_type == EXTERNAL_HMAC_SHA1); 770 external_auth_active_ = (policy.rtp.auth_type == EXTERNAL_HMAC_SHA1);
707 return true; 771 return true;
708 } 772 }
709 773
774 bool SrtpSession::SetKey(int type, int cs, const uint8_t* key, size_t len) {
775 RTC_DCHECK(thread_checker_.CalledOnValidThread());
776 if (session_) {
777 LOG(LS_ERROR) << "Failed to create SRTP session: "
778 << "SRTP session already created";
779 return false;
780 }
781
782 if (!Init()) {
783 return false;
784 }
785
786 return DoSetKey(type, cs, key, len);
787 }
788
789 bool SrtpSession::UpdateKey(int type, int cs, const uint8_t* key, size_t len) {
790 RTC_DCHECK(thread_checker_.CalledOnValidThread());
791 if (!session_) {
792 LOG(LS_ERROR) << "Failed to update non-existing SRTP session";
793 return false;
794 }
795
796 return DoSetKey(type, cs, key, len);
797 }
798
799 void SrtpSession::SetEncryptedHeaderExtensionIds(
800 const std::vector<int>& encrypted_header_extension_ids) {
801 RTC_DCHECK(thread_checker_.CalledOnValidThread());
802 encrypted_header_extension_ids_ = encrypted_header_extension_ids;
803 }
804
710 bool SrtpSession::Init() { 805 bool SrtpSession::Init() {
711 rtc::GlobalLockScope ls(&lock_); 806 rtc::GlobalLockScope ls(&lock_);
712 807
713 if (!inited_) { 808 if (!inited_) {
714 int err; 809 int err;
715 err = srtp_init(); 810 err = srtp_init();
716 if (err != srtp_err_status_ok) { 811 if (err != srtp_err_status_ok) {
717 LOG(LS_ERROR) << "Failed to init SRTP, err=" << err; 812 LOG(LS_ERROR) << "Failed to init SRTP, err=" << err;
718 return false; 813 return false;
719 } 814 }
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
773 // Callback will be executed from same thread that calls the "srtp_protect" 868 // Callback will be executed from same thread that calls the "srtp_protect"
774 // and "srtp_unprotect" functions. 869 // and "srtp_unprotect" functions.
775 SrtpSession* session = static_cast<SrtpSession*>( 870 SrtpSession* session = static_cast<SrtpSession*>(
776 srtp_get_user_data(ev->session)); 871 srtp_get_user_data(ev->session));
777 if (session) { 872 if (session) {
778 session->HandleEvent(ev); 873 session->HandleEvent(ev);
779 } 874 }
780 } 875 }
781 876
782 } // namespace cricket 877 } // namespace cricket
OLDNEW
« no previous file with comments | « webrtc/pc/srtpfilter.h ('k') | webrtc/pc/srtpfilter_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698