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 |
(...skipping 731 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
742 const std::vector<C>& codecs, | 742 const std::vector<C>& codecs, |
743 const SecurePolicy& secure_policy, | 743 const SecurePolicy& secure_policy, |
744 const CryptoParamsVec* current_cryptos, | 744 const CryptoParamsVec* current_cryptos, |
745 const std::vector<std::string>& crypto_suites, | 745 const std::vector<std::string>& crypto_suites, |
746 const RtpHeaderExtensions& rtp_extensions, | 746 const RtpHeaderExtensions& rtp_extensions, |
747 bool add_legacy_stream, | 747 bool add_legacy_stream, |
748 StreamParamsVec* current_streams, | 748 StreamParamsVec* current_streams, |
749 MediaContentDescriptionImpl<C>* offer) { | 749 MediaContentDescriptionImpl<C>* offer) { |
750 offer->AddCodecs(codecs); | 750 offer->AddCodecs(codecs); |
751 | 751 |
752 if (secure_policy == SEC_REQUIRED) { | |
753 offer->set_crypto_required(CT_SDES); | |
754 } | |
755 offer->set_rtcp_mux(options.rtcp_mux_enabled); | 752 offer->set_rtcp_mux(options.rtcp_mux_enabled); |
756 if (offer->type() == cricket::MEDIA_TYPE_VIDEO) { | 753 if (offer->type() == cricket::MEDIA_TYPE_VIDEO) { |
757 offer->set_rtcp_reduced_size(true); | 754 offer->set_rtcp_reduced_size(true); |
758 } | 755 } |
759 offer->set_multistream(options.is_muc); | 756 offer->set_multistream(options.is_muc); |
760 offer->set_rtp_header_extensions(rtp_extensions); | 757 offer->set_rtp_header_extensions(rtp_extensions); |
761 | 758 |
762 if (!AddStreamParams(offer->type(), options, current_streams, offer, | 759 if (!AddStreamParams(offer->type(), options, current_streams, offer, |
763 add_legacy_stream)) { | 760 add_legacy_stream)) { |
764 return false; | 761 return false; |
765 } | 762 } |
766 | 763 |
767 #ifdef HAVE_SRTP | 764 #ifdef HAVE_SRTP |
768 if (secure_policy != SEC_DISABLED) { | 765 if (secure_policy != SEC_DISABLED) { |
769 if (current_cryptos) { | 766 if (current_cryptos) { |
770 AddMediaCryptos(*current_cryptos, offer); | 767 AddMediaCryptos(*current_cryptos, offer); |
771 } | 768 } |
772 if (offer->cryptos().empty()) { | 769 if (offer->cryptos().empty()) { |
773 if (!CreateMediaCryptos(crypto_suites, offer)) { | 770 if (!CreateMediaCryptos(crypto_suites, offer)) { |
774 return false; | 771 return false; |
775 } | 772 } |
776 } | 773 } |
777 } | 774 } |
778 #endif | 775 #endif |
779 | 776 |
780 if (offer->crypto_required() == CT_SDES && offer->cryptos().empty()) { | 777 if (secure_policy == SEC_REQUIRED && offer->cryptos().empty()) { |
pthatcher1
2016/12/01 22:57:12
Could you put a TODO on the SecurePolicy enum to r
Taylor Brandstetter
2016/12/02 00:42:32
Done.
| |
781 return false; | 778 return false; |
782 } | 779 } |
783 return true; | 780 return true; |
784 } | 781 } |
785 | 782 |
786 template <class C> | 783 template <class C> |
787 static bool ReferencedCodecsMatch(const std::vector<C>& codecs1, | 784 static bool ReferencedCodecsMatch(const std::vector<C>& codecs1, |
788 const int codec1_id, | 785 const int codec1_id, |
789 const std::vector<C>& codecs2, | 786 const std::vector<C>& codecs2, |
790 const int codec2_id) { | 787 const int codec2_id) { |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1061 if (sdes_policy != SEC_DISABLED) { | 1058 if (sdes_policy != SEC_DISABLED) { |
1062 CryptoParams crypto; | 1059 CryptoParams crypto; |
1063 if (SelectCrypto(offer, bundle_enabled, options.crypto_options, &crypto)) { | 1060 if (SelectCrypto(offer, bundle_enabled, options.crypto_options, &crypto)) { |
1064 if (current_cryptos) { | 1061 if (current_cryptos) { |
1065 FindMatchingCrypto(*current_cryptos, crypto, &crypto); | 1062 FindMatchingCrypto(*current_cryptos, crypto, &crypto); |
1066 } | 1063 } |
1067 answer->AddCrypto(crypto); | 1064 answer->AddCrypto(crypto); |
1068 } | 1065 } |
1069 } | 1066 } |
1070 | 1067 |
1071 if (answer->cryptos().empty() && | 1068 if (answer->cryptos().empty() && sdes_policy == SEC_REQUIRED) { |
1072 (offer->crypto_required() == CT_SDES || sdes_policy == SEC_REQUIRED)) { | |
1073 return false; | 1069 return false; |
1074 } | 1070 } |
1075 | 1071 |
1076 if (!AddStreamParams(answer->type(), options, current_streams, answer, | 1072 if (!AddStreamParams(answer->type(), options, current_streams, answer, |
1077 add_legacy_stream)) { | 1073 add_legacy_stream)) { |
1078 return false; // Something went seriously wrong. | 1074 return false; // Something went seriously wrong. |
1079 } | 1075 } |
1080 | 1076 |
1081 // Make sure the answer media content direction is per default set as | 1077 // Make sure the answer media content direction is per default set as |
1082 // described in RFC3264 section 6.1. | 1078 // described in RFC3264 section 6.1. |
(...skipping 1107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2190 GetFirstMediaContentDescription(sdesc, MEDIA_TYPE_VIDEO)); | 2186 GetFirstMediaContentDescription(sdesc, MEDIA_TYPE_VIDEO)); |
2191 } | 2187 } |
2192 | 2188 |
2193 DataContentDescription* GetFirstDataContentDescription( | 2189 DataContentDescription* GetFirstDataContentDescription( |
2194 SessionDescription* sdesc) { | 2190 SessionDescription* sdesc) { |
2195 return static_cast<DataContentDescription*>( | 2191 return static_cast<DataContentDescription*>( |
2196 GetFirstMediaContentDescription(sdesc, MEDIA_TYPE_DATA)); | 2192 GetFirstMediaContentDescription(sdesc, MEDIA_TYPE_DATA)); |
2197 } | 2193 } |
2198 | 2194 |
2199 } // namespace cricket | 2195 } // namespace cricket |
OLD | NEW |