Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(41)

Side by Side Diff: webrtc/media/engine/webrtcmediaengine.cc

Issue 2761143002: Support encrypted RTP extensions (RFC 6904) (Closed)
Patch Set: Added missing include for compiling on Windows. Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 192
193 // Ignore any extensions that we don't recognize. 193 // Ignore any extensions that we don't recognize.
194 for (const auto& extension : extensions) { 194 for (const auto& extension : extensions) {
195 if (supported(extension.uri)) { 195 if (supported(extension.uri)) {
196 result.push_back(extension); 196 result.push_back(extension);
197 } else { 197 } else {
198 LOG(LS_WARNING) << "Unsupported RTP extension: " << extension.ToString(); 198 LOG(LS_WARNING) << "Unsupported RTP extension: " << extension.ToString();
199 } 199 }
200 } 200 }
201 201
202 // Sort by name, ascending, so that we don't reset extensions if they were 202 // Sort by name, ascending (prioritise encryption), so that we don't reset
203 // specified in a different order (also allows us to use std::unique below). 203 // extensions if they were specified in a different order (also allows us
204 // to use std::unique below).
204 std::sort(result.begin(), result.end(), 205 std::sort(result.begin(), result.end(),
205 [](const webrtc::RtpExtension& rhs, 206 [](const webrtc::RtpExtension& rhs,
206 const webrtc::RtpExtension& lhs) { return rhs.uri < lhs.uri; }); 207 const webrtc::RtpExtension& lhs) {
208 return rhs.encrypt == lhs.encrypt ? rhs.uri < lhs.uri
209 : rhs.encrypt > lhs.encrypt;
210 });
207 211
208 // Remove unnecessary extensions (used on send side). 212 // Remove unnecessary extensions (used on send side).
209 if (filter_redundant_extensions) { 213 if (filter_redundant_extensions) {
210 auto it = std::unique( 214 auto it = std::unique(
211 result.begin(), result.end(), 215 result.begin(), result.end(),
212 [](const webrtc::RtpExtension& rhs, const webrtc::RtpExtension& lhs) { 216 [](const webrtc::RtpExtension& rhs, const webrtc::RtpExtension& lhs) {
213 return rhs.uri == lhs.uri; 217 return rhs.uri == lhs.uri && rhs.encrypt == lhs.encrypt;
214 }); 218 });
215 result.erase(it, result.end()); 219 result.erase(it, result.end());
216 220
217 // Keep just the highest priority extension of any in the following list. 221 // Keep just the highest priority extension of any in the following list.
218 static const char* kBweExtensionPriorities[] = { 222 static const char* kBweExtensionPriorities[] = {
219 webrtc::RtpExtension::kTransportSequenceNumberUri, 223 webrtc::RtpExtension::kTransportSequenceNumberUri,
220 webrtc::RtpExtension::kAbsSendTimeUri, 224 webrtc::RtpExtension::kAbsSendTimeUri,
221 webrtc::RtpExtension::kTimestampOffsetUri}; 225 webrtc::RtpExtension::kTimestampOffsetUri};
222 DiscardRedundantExtensions(&result, kBweExtensionPriorities); 226 DiscardRedundantExtensions(&result, kBweExtensionPriorities);
223 } 227 }
(...skipping 20 matching lines...) Expand all
244 } 248 }
245 if (codec.GetParam(kCodecParamMaxBitrate, &bitrate_kbps) && 249 if (codec.GetParam(kCodecParamMaxBitrate, &bitrate_kbps) &&
246 bitrate_kbps > 0) { 250 bitrate_kbps > 0) {
247 config.max_bitrate_bps = bitrate_kbps * 1000; 251 config.max_bitrate_bps = bitrate_kbps * 1000;
248 } else { 252 } else {
249 config.max_bitrate_bps = -1; 253 config.max_bitrate_bps = -1;
250 } 254 }
251 return config; 255 return config;
252 } 256 }
253 } // namespace cricket 257 } // namespace cricket
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698