| OLD | NEW |
| 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 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 bool SrtpFilter::GetRtpAuthParams(uint8_t** key, int* key_len, int* tag_len) { | 252 bool SrtpFilter::GetRtpAuthParams(uint8_t** key, int* key_len, int* tag_len) { |
| 253 if (!IsActive()) { | 253 if (!IsActive()) { |
| 254 LOG(LS_WARNING) << "Failed to GetRtpAuthParams: SRTP not active"; | 254 LOG(LS_WARNING) << "Failed to GetRtpAuthParams: SRTP not active"; |
| 255 return false; | 255 return false; |
| 256 } | 256 } |
| 257 | 257 |
| 258 ASSERT(send_session_ != NULL); | 258 ASSERT(send_session_ != NULL); |
| 259 return send_session_->GetRtpAuthParams(key, key_len, tag_len); | 259 return send_session_->GetRtpAuthParams(key, key_len, tag_len); |
| 260 } | 260 } |
| 261 | 261 |
| 262 void SrtpFilter::set_signal_silent_time(uint32_t signal_silent_time_in_ms) { | 262 void SrtpFilter::set_signal_silent_time(int signal_silent_time_in_ms) { |
| 263 signal_silent_time_in_ms_ = signal_silent_time_in_ms; | 263 signal_silent_time_in_ms_ = signal_silent_time_in_ms; |
| 264 if (IsActive()) { | 264 if (IsActive()) { |
| 265 ASSERT(send_session_ != NULL); | 265 ASSERT(send_session_ != NULL); |
| 266 send_session_->set_signal_silent_time(signal_silent_time_in_ms); | 266 send_session_->set_signal_silent_time(signal_silent_time_in_ms); |
| 267 ASSERT(recv_session_ != NULL); | 267 ASSERT(recv_session_ != NULL); |
| 268 recv_session_->set_signal_silent_time(signal_silent_time_in_ms); | 268 recv_session_->set_signal_silent_time(signal_silent_time_in_ms); |
| 269 if (send_rtcp_session_) | 269 if (send_rtcp_session_) |
| 270 send_rtcp_session_->set_signal_silent_time(signal_silent_time_in_ms); | 270 send_rtcp_session_->set_signal_silent_time(signal_silent_time_in_ms); |
| 271 if (recv_rtcp_session_) | 271 if (recv_rtcp_session_) |
| 272 recv_rtcp_session_->set_signal_silent_time(signal_silent_time_in_ms); | 272 recv_rtcp_session_->set_signal_silent_time(signal_silent_time_in_ms); |
| (...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 634 srtp_stream_ctx_t* stream = srtp_get_stream(session_, hdr->ssrc); | 634 srtp_stream_ctx_t* stream = srtp_get_stream(session_, hdr->ssrc); |
| 635 if (stream == NULL) | 635 if (stream == NULL) |
| 636 return false; | 636 return false; |
| 637 | 637 |
| 638 // Shift packet index, put into network byte order | 638 // Shift packet index, put into network byte order |
| 639 *index = static_cast<int64_t>( | 639 *index = static_cast<int64_t>( |
| 640 rtc::NetworkToHost64(rdbx_get_packet_index(&stream->rtp_rdbx) << 16)); | 640 rtc::NetworkToHost64(rdbx_get_packet_index(&stream->rtp_rdbx) << 16)); |
| 641 return true; | 641 return true; |
| 642 } | 642 } |
| 643 | 643 |
| 644 void SrtpSession::set_signal_silent_time(uint32_t signal_silent_time_in_ms) { | 644 void SrtpSession::set_signal_silent_time(int signal_silent_time_in_ms) { |
| 645 srtp_stat_->set_signal_silent_time(signal_silent_time_in_ms); | 645 srtp_stat_->set_signal_silent_time(signal_silent_time_in_ms); |
| 646 } | 646 } |
| 647 | 647 |
| 648 bool SrtpSession::SetKey(int type, int cs, const uint8_t* key, int len) { | 648 bool SrtpSession::SetKey(int type, int cs, const uint8_t* key, int len) { |
| 649 if (session_) { | 649 if (session_) { |
| 650 LOG(LS_ERROR) << "Failed to create SRTP session: " | 650 LOG(LS_ERROR) << "Failed to create SRTP session: " |
| 651 << "SRTP session already created"; | 651 << "SRTP session already created"; |
| 652 return false; | 652 return false; |
| 653 } | 653 } |
| 654 | 654 |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 884 AddUnprotectRtpResult(0U, result); | 884 AddUnprotectRtpResult(0U, result); |
| 885 } | 885 } |
| 886 | 886 |
| 887 void SrtpStat::HandleSrtpResult(const SrtpStat::FailureKey& key) { | 887 void SrtpStat::HandleSrtpResult(const SrtpStat::FailureKey& key) { |
| 888 // Handle some cases where error should be signalled right away. For other | 888 // Handle some cases where error should be signalled right away. For other |
| 889 // errors, trigger error for the first time seeing it. After that, silent | 889 // errors, trigger error for the first time seeing it. After that, silent |
| 890 // the same error for a certain amount of time (default 1 sec). | 890 // the same error for a certain amount of time (default 1 sec). |
| 891 if (key.error != SrtpFilter::ERROR_NONE) { | 891 if (key.error != SrtpFilter::ERROR_NONE) { |
| 892 // For errors, signal first time and wait for 1 sec. | 892 // For errors, signal first time and wait for 1 sec. |
| 893 FailureStat* stat = &(failures_[key]); | 893 FailureStat* stat = &(failures_[key]); |
| 894 uint32_t current_time = rtc::Time(); | 894 int64_t current_time = rtc::Time(); |
| 895 if (stat->last_signal_time == 0 || | 895 if (stat->last_signal_time == 0 || |
| 896 rtc::TimeDiff(current_time, stat->last_signal_time) > | 896 rtc::TimeDiff(current_time, stat->last_signal_time) > |
| 897 static_cast<int>(signal_silent_time_)) { | 897 signal_silent_time_) { |
| 898 SignalSrtpError(key.ssrc, key.mode, key.error); | 898 SignalSrtpError(key.ssrc, key.mode, key.error); |
| 899 stat->last_signal_time = current_time; | 899 stat->last_signal_time = current_time; |
| 900 } | 900 } |
| 901 } | 901 } |
| 902 } | 902 } |
| 903 | 903 |
| 904 #else // !HAVE_SRTP | 904 #else // !HAVE_SRTP |
| 905 | 905 |
| 906 // On some systems, SRTP is not (yet) available. | 906 // On some systems, SRTP is not (yet) available. |
| 907 | 907 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 926 SrtpNotAvailable(__FUNCTION__); | 926 SrtpNotAvailable(__FUNCTION__); |
| 927 } | 927 } |
| 928 | 928 |
| 929 void SrtpStat::HandleSrtpResult(const SrtpStat::FailureKey& key) { | 929 void SrtpStat::HandleSrtpResult(const SrtpStat::FailureKey& key) { |
| 930 SrtpNotAvailable(__FUNCTION__); | 930 SrtpNotAvailable(__FUNCTION__); |
| 931 } | 931 } |
| 932 | 932 |
| 933 #endif // HAVE_SRTP | 933 #endif // HAVE_SRTP |
| 934 | 934 |
| 935 } // namespace cricket | 935 } // namespace cricket |
| OLD | NEW |