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/helpers.h" | 22 #include "webrtc/base/helpers.h" |
23 #include "webrtc/base/logging.h" | 23 #include "webrtc/base/logging.h" |
24 #include "webrtc/base/stringutils.h" | 24 #include "webrtc/base/stringutils.h" |
| 25 #include "webrtc/common_video/h264/profile_level_id.h" |
25 #include "webrtc/media/base/cryptoparams.h" | 26 #include "webrtc/media/base/cryptoparams.h" |
26 #include "webrtc/media/base/mediaconstants.h" | 27 #include "webrtc/media/base/mediaconstants.h" |
27 #include "webrtc/p2p/base/p2pconstants.h" | 28 #include "webrtc/p2p/base/p2pconstants.h" |
28 #include "webrtc/pc/channelmanager.h" | 29 #include "webrtc/pc/channelmanager.h" |
29 #include "webrtc/pc/srtpfilter.h" | 30 #include "webrtc/pc/srtpfilter.h" |
30 | 31 |
31 namespace { | 32 namespace { |
32 const char kInline[] = "inline:"; | 33 const char kInline[] = "inline:"; |
33 | 34 |
34 void GetSupportedCryptoSuiteNames(void (*func)(const rtc::CryptoOptions&, | 35 void GetSupportedCryptoSuiteNames(void (*func)(const rtc::CryptoOptions&, |
(...skipping 736 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
771 if (FindMatchingCodec(local_codecs, offered_codecs, ours, &theirs)) { | 772 if (FindMatchingCodec(local_codecs, offered_codecs, ours, &theirs)) { |
772 C negotiated = ours; | 773 C negotiated = ours; |
773 negotiated.IntersectFeedbackParams(theirs); | 774 negotiated.IntersectFeedbackParams(theirs); |
774 if (IsRtxCodec(negotiated)) { | 775 if (IsRtxCodec(negotiated)) { |
775 const auto apt_it = | 776 const auto apt_it = |
776 theirs.params.find(kCodecParamAssociatedPayloadType); | 777 theirs.params.find(kCodecParamAssociatedPayloadType); |
777 // FindMatchingCodec shouldn't return something with no apt value. | 778 // FindMatchingCodec shouldn't return something with no apt value. |
778 RTC_DCHECK(apt_it != theirs.params.end()); | 779 RTC_DCHECK(apt_it != theirs.params.end()); |
779 negotiated.SetParam(kCodecParamAssociatedPayloadType, apt_it->second); | 780 negotiated.SetParam(kCodecParamAssociatedPayloadType, apt_it->second); |
780 } | 781 } |
| 782 if (CodecNamesEq(ours.name.c_str(), kH264CodecName)) { |
| 783 webrtc::H264::GenerateProfileLevelIdForAnswer( |
| 784 ours.params, theirs.params, &negotiated.params); |
| 785 } |
781 negotiated.id = theirs.id; | 786 negotiated.id = theirs.id; |
782 negotiated.name = theirs.name; | 787 negotiated.name = theirs.name; |
783 negotiated_codecs->push_back(std::move(negotiated)); | 788 negotiated_codecs->push_back(std::move(negotiated)); |
784 } | 789 } |
785 } | 790 } |
786 // RFC3264: Although the answerer MAY list the formats in their desired | 791 // RFC3264: Although the answerer MAY list the formats in their desired |
787 // order of preference, it is RECOMMENDED that unless there is a | 792 // order of preference, it is RECOMMENDED that unless there is a |
788 // specific reason, the answerer list formats in the same relative order | 793 // specific reason, the answerer list formats in the same relative order |
789 // they were present in the offer. | 794 // they were present in the offer. |
790 std::unordered_map<int, int> payload_type_preferences; | 795 std::unordered_map<int, int> payload_type_preferences; |
(...skipping 1362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2153 GetFirstMediaContentDescription(sdesc, MEDIA_TYPE_VIDEO)); | 2158 GetFirstMediaContentDescription(sdesc, MEDIA_TYPE_VIDEO)); |
2154 } | 2159 } |
2155 | 2160 |
2156 DataContentDescription* GetFirstDataContentDescription( | 2161 DataContentDescription* GetFirstDataContentDescription( |
2157 SessionDescription* sdesc) { | 2162 SessionDescription* sdesc) { |
2158 return static_cast<DataContentDescription*>( | 2163 return static_cast<DataContentDescription*>( |
2159 GetFirstMediaContentDescription(sdesc, MEDIA_TYPE_DATA)); | 2164 GetFirstMediaContentDescription(sdesc, MEDIA_TYPE_DATA)); |
2160 } | 2165 } |
2161 | 2166 |
2162 } // namespace cricket | 2167 } // namespace cricket |
OLD | NEW |