| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2014 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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 | 157 |
| 158 // Ignore any extensions that we don't recognize. | 158 // Ignore any extensions that we don't recognize. |
| 159 for (const auto& extension : extensions) { | 159 for (const auto& extension : extensions) { |
| 160 if (supported(extension.uri)) { | 160 if (supported(extension.uri)) { |
| 161 result.push_back(extension); | 161 result.push_back(extension); |
| 162 } else { | 162 } else { |
| 163 LOG(LS_WARNING) << "Unsupported RTP extension: " << extension.ToString(); | 163 LOG(LS_WARNING) << "Unsupported RTP extension: " << extension.ToString(); |
| 164 } | 164 } |
| 165 } | 165 } |
| 166 | 166 |
| 167 // Sort by name, ascending, so that we don't reset extensions if they were | 167 // Sort by name, ascending (prioritise encryption), so that we don't reset |
| 168 // specified in a different order (also allows us to use std::unique below). | 168 // extensions if they were specified in a different order (also allows us |
| 169 // to use std::unique below). |
| 169 std::sort(result.begin(), result.end(), | 170 std::sort(result.begin(), result.end(), |
| 170 [](const webrtc::RtpExtension& rhs, | 171 [](const webrtc::RtpExtension& rhs, |
| 171 const webrtc::RtpExtension& lhs) { return rhs.uri < lhs.uri; }); | 172 const webrtc::RtpExtension& lhs) { |
| 173 return rhs.encrypt == lhs.encrypt ? rhs.uri < lhs.uri |
| 174 : rhs.encrypt > lhs.encrypt; |
| 175 }); |
| 172 | 176 |
| 173 // Remove unnecessary extensions (used on send side). | 177 // Remove unnecessary extensions (used on send side). |
| 174 if (filter_redundant_extensions) { | 178 if (filter_redundant_extensions) { |
| 175 auto it = std::unique( | 179 auto it = std::unique( |
| 176 result.begin(), result.end(), | 180 result.begin(), result.end(), |
| 177 [](const webrtc::RtpExtension& rhs, const webrtc::RtpExtension& lhs) { | 181 [](const webrtc::RtpExtension& rhs, const webrtc::RtpExtension& lhs) { |
| 178 return rhs.uri == lhs.uri; | 182 return rhs.uri == lhs.uri && rhs.encrypt == lhs.encrypt; |
| 179 }); | 183 }); |
| 180 result.erase(it, result.end()); | 184 result.erase(it, result.end()); |
| 181 | 185 |
| 182 // Keep just the highest priority extension of any in the following list. | 186 // Keep just the highest priority extension of any in the following list. |
| 183 static const char* kBweExtensionPriorities[] = { | 187 static const char* kBweExtensionPriorities[] = { |
| 184 webrtc::RtpExtension::kTransportSequenceNumberUri, | 188 webrtc::RtpExtension::kTransportSequenceNumberUri, |
| 185 webrtc::RtpExtension::kAbsSendTimeUri, | 189 webrtc::RtpExtension::kAbsSendTimeUri, |
| 186 webrtc::RtpExtension::kTimestampOffsetUri}; | 190 webrtc::RtpExtension::kTimestampOffsetUri}; |
| 187 DiscardRedundantExtensions(&result, kBweExtensionPriorities); | 191 DiscardRedundantExtensions(&result, kBweExtensionPriorities); |
| 188 } | 192 } |
| (...skipping 20 matching lines...) Expand all Loading... |
| 209 } | 213 } |
| 210 if (codec.GetParam(kCodecParamMaxBitrate, &bitrate_kbps) && | 214 if (codec.GetParam(kCodecParamMaxBitrate, &bitrate_kbps) && |
| 211 bitrate_kbps > 0) { | 215 bitrate_kbps > 0) { |
| 212 config.max_bitrate_bps = bitrate_kbps * 1000; | 216 config.max_bitrate_bps = bitrate_kbps * 1000; |
| 213 } else { | 217 } else { |
| 214 config.max_bitrate_bps = -1; | 218 config.max_bitrate_bps = -1; |
| 215 } | 219 } |
| 216 return config; | 220 return config; |
| 217 } | 221 } |
| 218 } // namespace cricket | 222 } // namespace cricket |
| OLD | NEW |