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 |
11 #include "webrtc/pc/mediasession.h" | 11 #include "webrtc/pc/mediasession.h" |
12 | 12 |
13 #include <algorithm> // For std::find_if, std::sort. | 13 #include <algorithm> // For std::find_if, std::sort. |
14 #include <functional> | 14 #include <functional> |
15 #include <map> | 15 #include <map> |
16 #include <memory> | 16 #include <memory> |
17 #include <set> | 17 #include <set> |
18 #include <unordered_map> | 18 #include <unordered_map> |
19 #include <utility> | 19 #include <utility> |
20 | 20 |
21 #include "webrtc/base/base64.h" | 21 #include "webrtc/base/base64.h" |
22 #include "webrtc/base/common.h" | |
23 #include "webrtc/base/checks.h" | 22 #include "webrtc/base/checks.h" |
24 #include "webrtc/base/helpers.h" | 23 #include "webrtc/base/helpers.h" |
25 #include "webrtc/base/logging.h" | 24 #include "webrtc/base/logging.h" |
26 #include "webrtc/base/stringutils.h" | 25 #include "webrtc/base/stringutils.h" |
| 26 #include "webrtc/common_types.h" |
27 #include "webrtc/common_video/h264/profile_level_id.h" | 27 #include "webrtc/common_video/h264/profile_level_id.h" |
28 #include "webrtc/media/base/cryptoparams.h" | 28 #include "webrtc/media/base/cryptoparams.h" |
29 #include "webrtc/media/base/mediaconstants.h" | 29 #include "webrtc/media/base/mediaconstants.h" |
30 #include "webrtc/p2p/base/p2pconstants.h" | 30 #include "webrtc/p2p/base/p2pconstants.h" |
31 #include "webrtc/pc/channelmanager.h" | 31 #include "webrtc/pc/channelmanager.h" |
32 #include "webrtc/pc/srtpfilter.h" | 32 #include "webrtc/pc/srtpfilter.h" |
33 | 33 |
34 namespace { | 34 namespace { |
35 const char kInline[] = "inline:"; | 35 const char kInline[] = "inline:"; |
36 | 36 |
(...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
695 for (const auto& codec : codecs) { | 695 for (const auto& codec : codecs) { |
696 if (IsRtxCodec(codec)) { | 696 if (IsRtxCodec(codec)) { |
697 return true; | 697 return true; |
698 } | 698 } |
699 } | 699 } |
700 return false; | 700 return false; |
701 } | 701 } |
702 | 702 |
703 template <class C> | 703 template <class C> |
704 static bool IsRtxCodec(const C& codec) { | 704 static bool IsRtxCodec(const C& codec) { |
705 return stricmp(codec.name.c_str(), kRtxCodecName) == 0; | 705 return STR_CASE_CMP(codec.name.c_str(), kRtxCodecName) == 0; |
706 } | 706 } |
707 | 707 |
708 template <class C> | 708 template <class C> |
709 static bool ContainsFlexfecCodec(const std::vector<C>& codecs) { | 709 static bool ContainsFlexfecCodec(const std::vector<C>& codecs) { |
710 for (const auto& codec : codecs) { | 710 for (const auto& codec : codecs) { |
711 if (IsFlexfecCodec(codec)) { | 711 if (IsFlexfecCodec(codec)) { |
712 return true; | 712 return true; |
713 } | 713 } |
714 } | 714 } |
715 return false; | 715 return false; |
716 } | 716 } |
717 | 717 |
718 template <class C> | 718 template <class C> |
719 static bool IsFlexfecCodec(const C& codec) { | 719 static bool IsFlexfecCodec(const C& codec) { |
720 return stricmp(codec.name.c_str(), kFlexfecCodecName) == 0; | 720 return STR_CASE_CMP(codec.name.c_str(), kFlexfecCodecName) == 0; |
721 } | 721 } |
722 | 722 |
723 static TransportOptions GetTransportOptions(const MediaSessionOptions& options, | 723 static TransportOptions GetTransportOptions(const MediaSessionOptions& options, |
724 const std::string& content_name) { | 724 const std::string& content_name) { |
725 TransportOptions transport_options; | 725 TransportOptions transport_options; |
726 auto it = options.transport_options.find(content_name); | 726 auto it = options.transport_options.find(content_name); |
727 if (it != options.transport_options.end()) { | 727 if (it != options.transport_options.end()) { |
728 transport_options = it->second; | 728 transport_options = it->second; |
729 } | 729 } |
730 transport_options.enable_ice_renomination = options.enable_ice_renomination; | 730 transport_options.enable_ice_renomination = options.enable_ice_renomination; |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1006 if (FindByUri(offered_extensions, *ours, &theirs)) { | 1006 if (FindByUri(offered_extensions, *ours, &theirs)) { |
1007 // We respond with their RTP header extension id. | 1007 // We respond with their RTP header extension id. |
1008 negotiated_extenstions->push_back(theirs); | 1008 negotiated_extenstions->push_back(theirs); |
1009 } | 1009 } |
1010 } | 1010 } |
1011 } | 1011 } |
1012 | 1012 |
1013 static void StripCNCodecs(AudioCodecs* audio_codecs) { | 1013 static void StripCNCodecs(AudioCodecs* audio_codecs) { |
1014 AudioCodecs::iterator iter = audio_codecs->begin(); | 1014 AudioCodecs::iterator iter = audio_codecs->begin(); |
1015 while (iter != audio_codecs->end()) { | 1015 while (iter != audio_codecs->end()) { |
1016 if (stricmp(iter->name.c_str(), kComfortNoiseCodecName) == 0) { | 1016 if (STR_CASE_CMP(iter->name.c_str(), kComfortNoiseCodecName) == 0) { |
1017 iter = audio_codecs->erase(iter); | 1017 iter = audio_codecs->erase(iter); |
1018 } else { | 1018 } else { |
1019 ++iter; | 1019 ++iter; |
1020 } | 1020 } |
1021 } | 1021 } |
1022 } | 1022 } |
1023 | 1023 |
1024 // Create a media content to be answered in a session-accept, | 1024 // Create a media content to be answered in a session-accept, |
1025 // according to the given options.rtcp_mux, options.streams, codecs, | 1025 // according to the given options.rtcp_mux, options.streams, codecs, |
1026 // crypto, and streams. If we don't currently have crypto (in | 1026 // crypto, and streams. If we don't currently have crypto (in |
(...skipping 1142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2169 GetFirstMediaContentDescription(sdesc, MEDIA_TYPE_VIDEO)); | 2169 GetFirstMediaContentDescription(sdesc, MEDIA_TYPE_VIDEO)); |
2170 } | 2170 } |
2171 | 2171 |
2172 DataContentDescription* GetFirstDataContentDescription( | 2172 DataContentDescription* GetFirstDataContentDescription( |
2173 SessionDescription* sdesc) { | 2173 SessionDescription* sdesc) { |
2174 return static_cast<DataContentDescription*>( | 2174 return static_cast<DataContentDescription*>( |
2175 GetFirstMediaContentDescription(sdesc, MEDIA_TYPE_DATA)); | 2175 GetFirstMediaContentDescription(sdesc, MEDIA_TYPE_DATA)); |
2176 } | 2176 } |
2177 | 2177 |
2178 } // namespace cricket | 2178 } // namespace cricket |
OLD | NEW |