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

Unified Diff: webrtc/pc/mediasession.cc

Issue 1880913002: Accept all the media profiles required by JSEP. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: No changes. Rerun trybots. Created 4 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
« no previous file with comments | « no previous file | webrtc/pc/mediasession_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/pc/mediasession.cc
diff --git a/webrtc/pc/mediasession.cc b/webrtc/pc/mediasession.cc
index 6b05736f0a3f3e74d662bb305e2458b7b7eba8ed..b077e0f83ff9e2146ebeb4a925764b3d2a379bff 100644
--- a/webrtc/pc/mediasession.cc
+++ b/webrtc/pc/mediasession.cc
@@ -1115,21 +1115,55 @@ static bool CreateMediaContentAnswer(
return true;
}
+static bool IsDtlsRtp(const std::string& protocol) {
+ // Most-likely values first.
+ return protocol == "UDP/TLS/RTP/SAVPF" || protocol == "TCP/TLS/RTP/SAVPF" ||
+ protocol == "UDP/TLS/RTP/SAVP" || protocol == "TCP/TLS/RTP/SAVP";
+}
+
+static bool IsPlainRtp(const std::string& protocol) {
+ // Most-likely values first.
+ return protocol == "RTP/SAVPF" || protocol == "RTP/AVPF" ||
+ protocol == "RTP/SAVP" || protocol == "RTP/AVP";
+}
+
+static bool IsDtlsSctp(const std::string& protocol) {
+ return protocol == "DTLS/SCTP";
+}
+
+static bool IsPlainSctp(const std::string& protocol) {
+ return protocol == "SCTP";
+}
+
static bool IsMediaProtocolSupported(MediaType type,
const std::string& protocol,
bool secure_transport) {
- // Data channels can have a protocol of SCTP or SCTP/DTLS.
- if (type == MEDIA_TYPE_DATA &&
- ((protocol == kMediaProtocolSctp && !secure_transport)||
- (protocol == kMediaProtocolDtlsSctp && secure_transport))) {
+ // Since not all applications serialize and deserialize the media protocol,
+ // we will have to accept |protocol| to be empty.
+ if (protocol.empty()) {
return true;
}
- // Since not all applications serialize and deserialize the media protocol,
- // we will have to accept |protocol| to be empty.
- return protocol == kMediaProtocolAvpf || protocol.empty() ||
- protocol == kMediaProtocolSavpf ||
- (protocol == kMediaProtocolDtlsSavpf && secure_transport);
+ if (type == MEDIA_TYPE_DATA) {
+ // Check for SCTP, but also for RTP for RTP-based data channels.
+ // TODO(pthatcher): Remove RTP once RTP-based data channels are gone.
+ if (secure_transport) {
+ // Most likely scenarios first.
+ return IsDtlsSctp(protocol) || IsDtlsRtp(protocol) ||
+ IsPlainRtp(protocol);
+ } else {
+ return IsPlainSctp(protocol) || IsPlainRtp(protocol);
+ }
+ }
+
+ // Allow for non-DTLS RTP protocol even when using DTLS because that's what
+ // JSEP specifies.
+ if (secure_transport) {
+ // Most likely scenarios first.
+ return IsDtlsRtp(protocol) || IsPlainRtp(protocol);
+ } else {
+ return IsPlainRtp(protocol);
+ }
}
static void SetMediaProtocol(bool secure_transport,
« no previous file with comments | « no previous file | webrtc/pc/mediasession_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698