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

Side by Side Diff: webrtc/config.cc

Issue 2761143002: Support encrypted RTP extensions (RFC 6904) (Closed)
Patch Set: Updated comment. Created 3 years, 7 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 return uri == webrtc::RtpExtension::kAudioLevelUri ||
99 uri == webrtc::RtpExtension::kTimestampOffsetUri ||
100 #if !defined(ENABLE_EXTERNAL_AUTH)
101 // TODO(jbauch): Figure out a way to always allow "kAbsSendTimeUri"
102 // here and filter out later if external auth is really used in
103 // srtpfilter.
pthatcher1 2017/05/05 21:26:38 Can you make it more clear why we can't have this?
joachim 2017/05/06 14:52:32 Updated the comment, I hope it's clearer now.
104 uri == webrtc::RtpExtension::kAbsSendTimeUri ||
105 #endif
106 uri == webrtc::RtpExtension::kVideoRotationUri ||
107 uri == webrtc::RtpExtension::kTransportSequenceNumberUri ||
108 uri == webrtc::RtpExtension::kPlayoutDelayUri;
109 }
110
111 const RtpExtension* RtpExtension::FindHeaderExtensionByUri(
112 const std::vector<RtpExtension>& extensions,
113 const std::string& uri) {
114 for (const auto& extension : extensions) {
115 if (extension.uri == uri) {
116 return &extension;
117 }
118 }
119 return nullptr;
120 }
121
122 std::vector<RtpExtension> RtpExtension::FilterDuplicateNonEncrypted(
123 const std::vector<RtpExtension>& extensions) {
124 std::vector<RtpExtension> filtered;
125 for (auto it = extensions.begin(); it != extensions.end(); ++it) {
126 if (it->encrypt) {
127 filtered.push_back(*it);
pthatcher1 2017/05/05 21:26:38 Can we fight moving right by doing an early contin
joachim 2017/05/06 14:52:32 Done.
128 } else {
129 // Only add non-encrypted extension if no encrypted with the same URI
130 // is also present...
131 bool found = false;
132 for (auto it2 = it + 1; it2 != extensions.end(); ++it2) {
133 if (it->uri == it2->uri) {
134 found = true;
135 break;
136 }
137 }
pthatcher1 2017/05/05 21:26:38 The list of header extensions is so short, I don't
joachim 2017/05/06 14:52:32 It's not really an optimization but checking the r
138
139 if (!found) {
pthatcher1 2017/05/05 21:26:38 Please use early continue again: if (found) { c
joachim 2017/05/06 14:52:32 Done.
140 // ...and has not been added before.
141 for (const RtpExtension& existing : filtered) {
142 if (it->uri == existing.uri) {
143 found = true;
144 break;
145 }
146 }
pthatcher1 2017/05/05 21:26:38 Why not just use existing.FindHeaderExtensionByUri
joachim 2017/05/06 14:52:32 Done.
147
148 if (!found) {
149 filtered.push_back(*it);
150 }
151 }
152 }
153 }
154 return filtered;
155 }
156
91 VideoStream::VideoStream() 157 VideoStream::VideoStream()
92 : width(0), 158 : width(0),
93 height(0), 159 height(0),
94 max_framerate(-1), 160 max_framerate(-1),
95 min_bitrate_bps(-1), 161 min_bitrate_bps(-1),
96 target_bitrate_bps(-1), 162 target_bitrate_bps(-1),
97 max_bitrate_bps(-1), 163 max_bitrate_bps(-1),
98 max_qp(-1) {} 164 max_qp(-1) {}
99 165
100 VideoStream::~VideoStream() = default; 166 VideoStream::~VideoStream() = default;
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 VideoEncoderConfig::Vp9EncoderSpecificSettings::Vp9EncoderSpecificSettings( 268 VideoEncoderConfig::Vp9EncoderSpecificSettings::Vp9EncoderSpecificSettings(
203 const VideoCodecVP9& specifics) 269 const VideoCodecVP9& specifics)
204 : specifics_(specifics) {} 270 : specifics_(specifics) {}
205 271
206 void VideoEncoderConfig::Vp9EncoderSpecificSettings::FillVideoCodecVp9( 272 void VideoEncoderConfig::Vp9EncoderSpecificSettings::FillVideoCodecVp9(
207 VideoCodecVP9* vp9_settings) const { 273 VideoCodecVP9* vp9_settings) const {
208 *vp9_settings = specifics_; 274 *vp9_settings = specifics_;
209 } 275 }
210 276
211 } // namespace webrtc 277 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698