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

Side by Side Diff: webrtc/config.cc

Issue 2761143002: Support encrypted RTP extensions (RFC 6904) (Closed)
Patch Set: Don't negotiate extension ids in SrtpFilter, more changes after feedback from Taylor. Created 3 years, 8 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 #include "webrtc/config.h" 10 #include "webrtc/config.h"
(...skipping 23 matching lines...) Expand all
34 bool UlpfecConfig::operator==(const UlpfecConfig& other) const { 34 bool UlpfecConfig::operator==(const UlpfecConfig& other) const {
35 return ulpfec_payload_type == other.ulpfec_payload_type && 35 return ulpfec_payload_type == other.ulpfec_payload_type &&
36 red_payload_type == other.red_payload_type && 36 red_payload_type == other.red_payload_type &&
37 red_rtx_payload_type == other.red_rtx_payload_type; 37 red_rtx_payload_type == other.red_rtx_payload_type;
38 } 38 }
39 39
40 std::string RtpExtension::ToString() const { 40 std::string RtpExtension::ToString() const {
41 std::stringstream ss; 41 std::stringstream ss;
42 ss << "{uri: " << uri; 42 ss << "{uri: " << uri;
43 ss << ", id: " << id; 43 ss << ", id: " << id;
44 if (encrypt) {
45 ss << ", encrypt";
46 }
44 ss << '}'; 47 ss << '}';
45 return ss.str(); 48 return ss.str();
46 } 49 }
47 50
48 const char* RtpExtension::kAudioLevelUri = 51 const char* RtpExtension::kAudioLevelUri =
49 "urn:ietf:params:rtp-hdrext:ssrc-audio-level"; 52 "urn:ietf:params:rtp-hdrext:ssrc-audio-level";
50 const int RtpExtension::kAudioLevelDefaultId = 1; 53 const int RtpExtension::kAudioLevelDefaultId = 1;
51 54
52 const char* RtpExtension::kTimestampOffsetUri = 55 const char* RtpExtension::kTimestampOffsetUri =
53 "urn:ietf:params:rtp-hdrext:toffset"; 56 "urn:ietf:params:rtp-hdrext:toffset";
(...skipping 11 matching lines...) Expand all
65 const int RtpExtension::kTransportSequenceNumberDefaultId = 5; 68 const int RtpExtension::kTransportSequenceNumberDefaultId = 5;
66 69
67 // This extension allows applications to adaptively limit the playout delay 70 // This extension allows applications to adaptively limit the playout delay
68 // on frames as per the current needs. For example, a gaming application 71 // on frames as per the current needs. For example, a gaming application
69 // has very different needs on end-to-end delay compared to a video-conference 72 // has very different needs on end-to-end delay compared to a video-conference
70 // application. 73 // application.
71 const char* RtpExtension::kPlayoutDelayUri = 74 const char* RtpExtension::kPlayoutDelayUri =
72 "http://www.webrtc.org/experiments/rtp-hdrext/playout-delay"; 75 "http://www.webrtc.org/experiments/rtp-hdrext/playout-delay";
73 const int RtpExtension::kPlayoutDelayDefaultId = 6; 76 const int RtpExtension::kPlayoutDelayDefaultId = 6;
74 77
78 const char* RtpExtension::kEncryptHeaderExtensionsUri =
79 "urn:ietf:params:rtp-hdrext:encrypt";
80
75 const int RtpExtension::kMinId = 1; 81 const int RtpExtension::kMinId = 1;
76 const int RtpExtension::kMaxId = 14; 82 const int RtpExtension::kMaxId = 14;
77 83
78 bool RtpExtension::IsSupportedForAudio(const std::string& uri) { 84 bool RtpExtension::IsSupportedForAudio(const std::string& uri) {
79 return uri == webrtc::RtpExtension::kAudioLevelUri || 85 return uri == webrtc::RtpExtension::kAudioLevelUri ||
80 uri == webrtc::RtpExtension::kTransportSequenceNumberUri; 86 uri == webrtc::RtpExtension::kTransportSequenceNumberUri;
81 } 87 }
82 88
83 bool RtpExtension::IsSupportedForVideo(const std::string& uri) { 89 bool RtpExtension::IsSupportedForVideo(const std::string& uri) {
84 return uri == webrtc::RtpExtension::kTimestampOffsetUri || 90 return uri == webrtc::RtpExtension::kTimestampOffsetUri ||
85 uri == webrtc::RtpExtension::kAbsSendTimeUri || 91 uri == webrtc::RtpExtension::kAbsSendTimeUri ||
86 uri == webrtc::RtpExtension::kVideoRotationUri || 92 uri == webrtc::RtpExtension::kVideoRotationUri ||
87 uri == webrtc::RtpExtension::kTransportSequenceNumberUri || 93 uri == webrtc::RtpExtension::kTransportSequenceNumberUri ||
88 uri == webrtc::RtpExtension::kPlayoutDelayUri; 94 uri == webrtc::RtpExtension::kPlayoutDelayUri;
89 } 95 }
90 96
97 bool RtpExtension::IsEncryptionSupported(const std::string& uri) {
98 // TODO(jbauch): Figure out a way to add "kTimestampOffsetUri" here
99 // and filter out later if external auth is used in srtpfilter.
Taylor Brandstetter 2017/04/19 06:48:39 Does this TODO need to be addressed before landing
joachim 2017/04/19 23:40:19 Just noticed it should have been "kAbsSendTimeUri"
100 return uri == webrtc::RtpExtension::kAudioLevelUri ||
101 uri == webrtc::RtpExtension::kTimestampOffsetUri ||
102 uri == webrtc::RtpExtension::kVideoRotationUri ||
103 uri == webrtc::RtpExtension::kTransportSequenceNumberUri ||
104 uri == webrtc::RtpExtension::kPlayoutDelayUri;
105 }
106
107 const RtpExtension* RtpExtension::FindHeaderExtensionByUri(
108 const std::vector<RtpExtension>& extensions,
109 const std::string& uri) {
110 for (const auto& extension : extensions) {
111 if (extension.uri == uri) {
112 return &extension;
113 }
114 }
115 return nullptr;
116 }
117
118 std::vector<RtpExtension> RtpExtension::FilterDuplicateNonEncrypted(
119 const std::vector<RtpExtension>& extensions) {
120 std::vector<RtpExtension> filtered;
121 for (auto it = extensions.begin(); it != extensions.end(); ++it) {
122 if (it->encrypt) {
123 filtered.push_back(*it);
124 } else {
125 // Only add non-encrypted extension if no encrypted with the same URI
126 // is also present...
127 bool found = false;
128 for (auto it2 = it + 1; it2 != extensions.end(); ++it2) {
129 if (it->uri == it2->uri) {
130 found = true;
131 break;
132 }
133 }
134
135 if (!found) {
136 // ...and has not been added before.
137 for (const RtpExtension& existing : filtered) {
138 if (it->uri == existing.uri) {
139 found = true;
140 break;
141 }
142 }
143
144 if (!found) {
145 filtered.push_back(*it);
146 }
147 }
148 }
149 }
150 return filtered;
151 }
152
91 VideoStream::VideoStream() 153 VideoStream::VideoStream()
92 : width(0), 154 : width(0),
93 height(0), 155 height(0),
94 max_framerate(-1), 156 max_framerate(-1),
95 min_bitrate_bps(-1), 157 min_bitrate_bps(-1),
96 target_bitrate_bps(-1), 158 target_bitrate_bps(-1),
97 max_bitrate_bps(-1), 159 max_bitrate_bps(-1),
98 max_qp(-1) {} 160 max_qp(-1) {}
99 161
100 VideoStream::~VideoStream() = default; 162 VideoStream::~VideoStream() = default;
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 VideoEncoderConfig::Vp9EncoderSpecificSettings::Vp9EncoderSpecificSettings( 264 VideoEncoderConfig::Vp9EncoderSpecificSettings::Vp9EncoderSpecificSettings(
203 const VideoCodecVP9& specifics) 265 const VideoCodecVP9& specifics)
204 : specifics_(specifics) {} 266 : specifics_(specifics) {}
205 267
206 void VideoEncoderConfig::Vp9EncoderSpecificSettings::FillVideoCodecVp9( 268 void VideoEncoderConfig::Vp9EncoderSpecificSettings::FillVideoCodecVp9(
207 VideoCodecVP9* vp9_settings) const { 269 VideoCodecVP9* vp9_settings) const {
208 *vp9_settings = specifics_; 270 *vp9_settings = specifics_;
209 } 271 }
210 272
211 } // namespace webrtc 273 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/config.h ('k') | webrtc/config_unittest.cc » ('j') | webrtc/pc/channel.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698