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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: webrtc/config.cc
diff --git a/webrtc/config.cc b/webrtc/config.cc
index e0c490d1ecd8038d546b7298fc9a885ab02718df..07cf0767c84980a5429a969bce1a3b9eb6234f5b 100644
--- a/webrtc/config.cc
+++ b/webrtc/config.cc
@@ -41,6 +41,9 @@ std::string RtpExtension::ToString() const {
std::stringstream ss;
ss << "{uri: " << uri;
ss << ", id: " << id;
+ if (encrypt) {
+ ss << ", encrypt";
+ }
ss << '}';
return ss.str();
}
@@ -72,6 +75,9 @@ const char* RtpExtension::kPlayoutDelayUri =
"http://www.webrtc.org/experiments/rtp-hdrext/playout-delay";
const int RtpExtension::kPlayoutDelayDefaultId = 6;
+const char* RtpExtension::kEncryptHeaderExtensionsUri =
+ "urn:ietf:params:rtp-hdrext:encrypt";
+
const int RtpExtension::kMinId = 1;
const int RtpExtension::kMaxId = 14;
@@ -88,6 +94,62 @@ bool RtpExtension::IsSupportedForVideo(const std::string& uri) {
uri == webrtc::RtpExtension::kPlayoutDelayUri;
}
+bool RtpExtension::IsEncryptionSupported(const std::string& uri) {
+ // TODO(jbauch): Figure out a way to add "kTimestampOffsetUri" here
+ // 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"
+ return uri == webrtc::RtpExtension::kAudioLevelUri ||
+ uri == webrtc::RtpExtension::kTimestampOffsetUri ||
+ uri == webrtc::RtpExtension::kVideoRotationUri ||
+ uri == webrtc::RtpExtension::kTransportSequenceNumberUri ||
+ uri == webrtc::RtpExtension::kPlayoutDelayUri;
+}
+
+const RtpExtension* RtpExtension::FindHeaderExtensionByUri(
+ const std::vector<RtpExtension>& extensions,
+ const std::string& uri) {
+ for (const auto& extension : extensions) {
+ if (extension.uri == uri) {
+ return &extension;
+ }
+ }
+ return nullptr;
+}
+
+std::vector<RtpExtension> RtpExtension::FilterDuplicateNonEncrypted(
+ const std::vector<RtpExtension>& extensions) {
+ std::vector<RtpExtension> filtered;
+ for (auto it = extensions.begin(); it != extensions.end(); ++it) {
+ if (it->encrypt) {
+ filtered.push_back(*it);
+ } else {
+ // Only add non-encrypted extension if no encrypted with the same URI
+ // is also present...
+ bool found = false;
+ for (auto it2 = it + 1; it2 != extensions.end(); ++it2) {
+ if (it->uri == it2->uri) {
+ found = true;
+ break;
+ }
+ }
+
+ if (!found) {
+ // ...and has not been added before.
+ for (const RtpExtension& existing : filtered) {
+ if (it->uri == existing.uri) {
+ found = true;
+ break;
+ }
+ }
+
+ if (!found) {
+ filtered.push_back(*it);
+ }
+ }
+ }
+ }
+ return filtered;
+}
+
VideoStream::VideoStream()
: width(0),
height(0),
« 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