| 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 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 | 201 |
| 202 // Ignore any extensions that we don't recognize. | 202 // Ignore any extensions that we don't recognize. |
| 203 for (const auto& extension : extensions) { | 203 for (const auto& extension : extensions) { |
| 204 if (supported(extension.uri)) { | 204 if (supported(extension.uri)) { |
| 205 result.push_back(extension); | 205 result.push_back(extension); |
| 206 } else { | 206 } else { |
| 207 LOG(LS_WARNING) << "Unsupported RTP extension: " << extension.ToString(); | 207 LOG(LS_WARNING) << "Unsupported RTP extension: " << extension.ToString(); |
| 208 } | 208 } |
| 209 } | 209 } |
| 210 | 210 |
| 211 // Sort by name, ascending, so that we don't reset extensions if they were | 211 // Sort by name, ascending (prioritise encryption), so that we don't reset |
| 212 // specified in a different order (also allows us to use std::unique below). | 212 // extensions if they were specified in a different order (also allows us |
| 213 // to use std::unique below). |
| 213 std::sort(result.begin(), result.end(), | 214 std::sort(result.begin(), result.end(), |
| 214 [](const webrtc::RtpExtension& rhs, | 215 [](const webrtc::RtpExtension& rhs, |
| 215 const webrtc::RtpExtension& lhs) { return rhs.uri < lhs.uri; }); | 216 const webrtc::RtpExtension& lhs) { |
| 217 return rhs.encrypt == lhs.encrypt ? rhs.uri < lhs.uri |
| 218 : rhs.encrypt > lhs.encrypt; |
| 219 }); |
| 216 | 220 |
| 217 // Remove unnecessary extensions (used on send side). | 221 // Remove unnecessary extensions (used on send side). |
| 218 if (filter_redundant_extensions) { | 222 if (filter_redundant_extensions) { |
| 219 auto it = std::unique( | 223 auto it = std::unique( |
| 220 result.begin(), result.end(), | 224 result.begin(), result.end(), |
| 221 [](const webrtc::RtpExtension& rhs, const webrtc::RtpExtension& lhs) { | 225 [](const webrtc::RtpExtension& rhs, const webrtc::RtpExtension& lhs) { |
| 222 return rhs.uri == lhs.uri; | 226 return rhs.uri == lhs.uri && rhs.encrypt == lhs.encrypt; |
| 223 }); | 227 }); |
| 224 result.erase(it, result.end()); | 228 result.erase(it, result.end()); |
| 225 | 229 |
| 226 // Keep just the highest priority extension of any in the following list. | 230 // Keep just the highest priority extension of any in the following list. |
| 227 static const char* kBweExtensionPriorities[] = { | 231 static const char* kBweExtensionPriorities[] = { |
| 228 webrtc::RtpExtension::kTransportSequenceNumberUri, | 232 webrtc::RtpExtension::kTransportSequenceNumberUri, |
| 229 webrtc::RtpExtension::kAbsSendTimeUri, | 233 webrtc::RtpExtension::kAbsSendTimeUri, |
| 230 webrtc::RtpExtension::kTimestampOffsetUri}; | 234 webrtc::RtpExtension::kTimestampOffsetUri}; |
| 231 DiscardRedundantExtensions(&result, kBweExtensionPriorities); | 235 DiscardRedundantExtensions(&result, kBweExtensionPriorities); |
| 232 } | 236 } |
| (...skipping 20 matching lines...) Expand all Loading... |
| 253 } | 257 } |
| 254 if (codec.GetParam(kCodecParamMaxBitrate, &bitrate_kbps) && | 258 if (codec.GetParam(kCodecParamMaxBitrate, &bitrate_kbps) && |
| 255 bitrate_kbps > 0) { | 259 bitrate_kbps > 0) { |
| 256 config.max_bitrate_bps = bitrate_kbps * 1000; | 260 config.max_bitrate_bps = bitrate_kbps * 1000; |
| 257 } else { | 261 } else { |
| 258 config.max_bitrate_bps = -1; | 262 config.max_bitrate_bps = -1; |
| 259 } | 263 } |
| 260 return config; | 264 return config; |
| 261 } | 265 } |
| 262 } // namespace cricket | 266 } // namespace cricket |
| OLD | NEW |