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

Side by Side Diff: talk/session/media/channel.cc

Issue 1337673002: Change WebRTC SslCipher to be exposed as number only. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Created 5 years, 2 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
OLDNEW
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 798 matching lines...) Expand 10 before | Expand all | Expand 10 after
809 void BaseChannel::SignalDtlsSetupFailure_s(bool rtcp) { 809 void BaseChannel::SignalDtlsSetupFailure_s(bool rtcp) {
810 ASSERT(signaling_thread() == rtc::Thread::Current()); 810 ASSERT(signaling_thread() == rtc::Thread::Current());
811 SignalDtlsSetupFailure(this, rtcp); 811 SignalDtlsSetupFailure(this, rtcp);
812 } 812 }
813 813
814 bool BaseChannel::SetDtlsSrtpCiphers(TransportChannel *tc, bool rtcp) { 814 bool BaseChannel::SetDtlsSrtpCiphers(TransportChannel *tc, bool rtcp) {
815 std::vector<std::string> ciphers; 815 std::vector<std::string> ciphers;
816 // We always use the default SRTP ciphers for RTCP, but we may use different 816 // We always use the default SRTP ciphers for RTCP, but we may use different
817 // ciphers for RTP depending on the media type. 817 // ciphers for RTP depending on the media type.
818 if (!rtcp) { 818 if (!rtcp) {
819 GetSrtpCiphers(&ciphers); 819 GetSrtpCipherByRfcNames(&ciphers);
820 } else { 820 } else {
821 GetSupportedDefaultCryptoSuites(&ciphers); 821 GetSupportedDefaultCryptoSuites(&ciphers);
pthatcher1 2015/09/30 18:39:35 And this should be GetDefaultSrtpCryptoSuiteNames
guoweis_webrtc 2015/09/30 20:14:21 Done.
822 } 822 }
823 return tc->SetSrtpCiphers(ciphers); 823 return tc->SetSrtpCiphers(ciphers);
824 } 824 }
825 825
826 bool BaseChannel::ShouldSetupDtlsSrtp() const { 826 bool BaseChannel::ShouldSetupDtlsSrtp() const {
827 return true; 827 return true;
828 } 828 }
829 829
830 // This function returns true if either DTLS-SRTP is not in use 830 // This function returns true if either DTLS-SRTP is not in use
831 // *or* DTLS-SRTP is successfully set up. 831 // *or* DTLS-SRTP is successfully set up.
832 bool BaseChannel::SetupDtlsSrtp(bool rtcp_channel) { 832 bool BaseChannel::SetupDtlsSrtp(bool rtcp_channel) {
833 bool ret = false; 833 bool ret = false;
834 834
835 TransportChannel* channel = 835 TransportChannel* channel =
836 rtcp_channel ? rtcp_transport_channel_ : transport_channel_; 836 rtcp_channel ? rtcp_transport_channel_ : transport_channel_;
837 837
838 // No DTLS 838 // No DTLS
839 if (!channel->IsDtlsActive()) 839 if (!channel->IsDtlsActive())
840 return true; 840 return true;
841 841
842 std::string selected_cipher; 842 std::string selected_cipher;
843 843
844 if (!channel->GetSrtpCipher(&selected_cipher)) { 844 if (!channel->GetSrtpCipherByRfcName(&selected_cipher)) {
845 LOG(LS_ERROR) << "No DTLS-SRTP selected cipher"; 845 LOG(LS_ERROR) << "No DTLS-SRTP selected cipher";
846 return false; 846 return false;
847 } 847 }
848 848
849 LOG(LS_INFO) << "Installing keys from DTLS-SRTP on " 849 LOG(LS_INFO) << "Installing keys from DTLS-SRTP on "
850 << content_name() << " " 850 << content_name() << " "
851 << PacketType(rtcp_channel); 851 << PacketType(rtcp_channel);
852 852
853 // OK, we're now doing DTLS (RFC 5764) 853 // OK, we're now doing DTLS (RFC 5764)
854 std::vector<unsigned char> dtls_buffer(SRTP_MASTER_KEY_KEY_LEN * 2 + 854 std::vector<unsigned char> dtls_buffer(SRTP_MASTER_KEY_KEY_LEN * 2 +
(...skipping 765 matching lines...) Expand 10 before | Expand all | Expand 10 after
1620 case SrtpFilter::ERROR_REPLAY: 1620 case SrtpFilter::ERROR_REPLAY:
1621 // Only receving channel should have this error. 1621 // Only receving channel should have this error.
1622 ASSERT(mode == SrtpFilter::UNPROTECT); 1622 ASSERT(mode == SrtpFilter::UNPROTECT);
1623 OnVoiceChannelError(ssrc, VoiceMediaChannel::ERROR_PLAY_SRTP_REPLAY); 1623 OnVoiceChannelError(ssrc, VoiceMediaChannel::ERROR_PLAY_SRTP_REPLAY);
1624 break; 1624 break;
1625 default: 1625 default:
1626 break; 1626 break;
1627 } 1627 }
1628 } 1628 }
1629 1629
1630 void VoiceChannel::GetSrtpCiphers(std::vector<std::string>* ciphers) const { 1630 void VoiceChannel::GetSrtpCipherByRfcNames(
1631 std::vector<std::string>* ciphers) const {
1631 GetSupportedAudioCryptoSuites(ciphers); 1632 GetSupportedAudioCryptoSuites(ciphers);
1632 } 1633 }
1633 1634
1634 VideoChannel::VideoChannel(rtc::Thread* thread, 1635 VideoChannel::VideoChannel(rtc::Thread* thread,
1635 VideoMediaChannel* media_channel, 1636 VideoMediaChannel* media_channel,
1636 TransportController* transport_controller, 1637 TransportController* transport_controller,
1637 const std::string& content_name, 1638 const std::string& content_name,
1638 bool rtcp) 1639 bool rtcp)
1639 : BaseChannel(thread, 1640 : BaseChannel(thread,
1640 media_channel, 1641 media_channel,
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after
2053 ASSERT(mode == SrtpFilter::UNPROTECT); 2054 ASSERT(mode == SrtpFilter::UNPROTECT);
2054 // TODO(gangji): Turn on the signaling of replay error once we have 2055 // TODO(gangji): Turn on the signaling of replay error once we have
2055 // switched to the new mechanism for doing video retransmissions. 2056 // switched to the new mechanism for doing video retransmissions.
2056 // OnVideoChannelError(ssrc, VideoMediaChannel::ERROR_PLAY_SRTP_REPLAY); 2057 // OnVideoChannelError(ssrc, VideoMediaChannel::ERROR_PLAY_SRTP_REPLAY);
2057 break; 2058 break;
2058 default: 2059 default:
2059 break; 2060 break;
2060 } 2061 }
2061 } 2062 }
2062 2063
2063 void VideoChannel::GetSrtpCiphers(std::vector<std::string>* ciphers) const { 2064 void VideoChannel::GetSrtpCipherByRfcNames(
2065 std::vector<std::string>* ciphers) const {
2064 GetSupportedVideoCryptoSuites(ciphers); 2066 GetSupportedVideoCryptoSuites(ciphers);
2065 } 2067 }
2066 2068
2067 DataChannel::DataChannel(rtc::Thread* thread, 2069 DataChannel::DataChannel(rtc::Thread* thread,
2068 DataMediaChannel* media_channel, 2070 DataMediaChannel* media_channel,
2069 TransportController* transport_controller, 2071 TransportController* transport_controller,
2070 const std::string& content_name, 2072 const std::string& content_name,
2071 bool rtcp) 2073 bool rtcp)
2072 : BaseChannel(thread, 2074 : BaseChannel(thread,
2073 media_channel, 2075 media_channel,
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
2388 case SrtpFilter::ERROR_REPLAY: 2390 case SrtpFilter::ERROR_REPLAY:
2389 // Only receving channel should have this error. 2391 // Only receving channel should have this error.
2390 ASSERT(mode == SrtpFilter::UNPROTECT); 2392 ASSERT(mode == SrtpFilter::UNPROTECT);
2391 OnDataChannelError(ssrc, DataMediaChannel::ERROR_RECV_SRTP_REPLAY); 2393 OnDataChannelError(ssrc, DataMediaChannel::ERROR_RECV_SRTP_REPLAY);
2392 break; 2394 break;
2393 default: 2395 default:
2394 break; 2396 break;
2395 } 2397 }
2396 } 2398 }
2397 2399
2398 void DataChannel::GetSrtpCiphers(std::vector<std::string>* ciphers) const { 2400 void DataChannel::GetSrtpCipherByRfcNames(
2401 std::vector<std::string>* ciphers) const {
2399 GetSupportedDataCryptoSuites(ciphers); 2402 GetSupportedDataCryptoSuites(ciphers);
2400 } 2403 }
2401 2404
2402 bool DataChannel::ShouldSetupDtlsSrtp() const { 2405 bool DataChannel::ShouldSetupDtlsSrtp() const {
2403 return (data_channel_type_ == DCT_RTP); 2406 return (data_channel_type_ == DCT_RTP);
2404 } 2407 }
2405 2408
2406 void DataChannel::OnStreamClosedRemotely(uint32 sid) { 2409 void DataChannel::OnStreamClosedRemotely(uint32 sid) {
2407 rtc::TypedMessageData<uint32>* message = 2410 rtc::TypedMessageData<uint32>* message =
2408 new rtc::TypedMessageData<uint32>(sid); 2411 new rtc::TypedMessageData<uint32>(sid);
2409 signaling_thread()->Post(this, MSG_STREAMCLOSEDREMOTELY, message); 2412 signaling_thread()->Post(this, MSG_STREAMCLOSEDREMOTELY, message);
2410 } 2413 }
2411 2414
2412 } // namespace cricket 2415 } // namespace cricket
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698