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

Side by Side 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: Fix the static initializer problem. 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 unified diff | Download patch
« no previous file with comments | « no previous file | webrtc/pc/mediasession_unittest.cc » ('j') | webrtc/pc/mediasession_unittest.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2004 The WebRTC project authors. All Rights Reserved. 2 * Copyright 2004 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 1097 matching lines...) Expand 10 before | Expand all | Expand 10 after
1108 : MD_SENDRECV); 1108 : MD_SENDRECV);
1109 break; 1109 break;
1110 default: 1110 default:
1111 RTC_DCHECK(false && "MediaContentDescription has unexpected direction."); 1111 RTC_DCHECK(false && "MediaContentDescription has unexpected direction.");
1112 break; 1112 break;
1113 } 1113 }
1114 1114
1115 return true; 1115 return true;
1116 } 1116 }
1117 1117
1118 static bool IsProtocolFound(const std::vector<std::string> protocols,
tommi 2016/04/14 12:59:09 Maybe this is by accident - but please don't pass
pthatcher1 2016/04/14 19:31:08 Good catch.
1119 const std::string& protocol) {
1120 return std::find(protocols.begin(), protocols.end(), protocol) !=
1121 protocols.end();
1122 }
1123
1118 static bool IsMediaProtocolSupported(MediaType type, 1124 static bool IsMediaProtocolSupported(MediaType type,
1119 const std::string& protocol, 1125 const std::string& protocol,
1120 bool secure_transport) { 1126 bool secure_transport) {
1127 // The accepted pattern for media protocol (JSEP Section 5.1.3)
1128 const std::vector<std::string> kMediaProtocols = {"RTP/SAVPF", "RTP/SAVP",
1129 "RTP/AVPF", "RTP/AVP"};
tommi 2016/04/14 12:59:09 I don't think this needs to be std::vector. It co
pthatcher1 2016/04/14 19:31:08 Your idea of using static const char* is a good o
1130 const std::vector<std::string> kMediaProtocolsDtls = {
1131 "UDP/TLS/RTP/SAVPF", "UDP/TLS/RTP/SAVP", "TCP/TLS/RTP/SAVPF",
1132 "TCP/TLS/RTP/SAVP"};
1133
1121 // Data channels can have a protocol of SCTP or SCTP/DTLS. 1134 // Data channels can have a protocol of SCTP or SCTP/DTLS.
1122 if (type == MEDIA_TYPE_DATA && 1135 if (type == MEDIA_TYPE_DATA &&
1123 ((protocol == kMediaProtocolSctp && !secure_transport)|| 1136 ((protocol == kMediaProtocolSctp && !secure_transport)||
tommi 2016/04/14 12:59:09 check secure_transport first here and on the next
1124 (protocol == kMediaProtocolDtlsSctp && secure_transport))) { 1137 (protocol == kMediaProtocolDtlsSctp && secure_transport))) {
1125 return true; 1138 return true;
1126 } 1139 }
1127 1140
1128 // Since not all applications serialize and deserialize the media protocol, 1141 // Since not all applications serialize and deserialize the media protocol,
tommi 2016/04/14 12:59:10 If type is MEDIA_TYPE_DATA when we get here, shoul
Taylor Brandstetter 2016/04/14 16:54:28 This is for RTP data channels, which some downstre
1129 // we will have to accept |protocol| to be empty. 1142 // we will have to accept |protocol| to be empty.
1130 return protocol == kMediaProtocolAvpf || protocol.empty() || 1143 return protocol.empty() || IsProtocolFound(kMediaProtocols, protocol) ||
tommi 2016/04/14 12:59:09 the |protocol.empty()| check should be done at the
1131 protocol == kMediaProtocolSavpf || 1144 (IsProtocolFound(kMediaProtocolsDtls, protocol) && secure_transport);
tommi 2016/04/14 12:59:10 |secure_transport| should be checked before doing
Taylor Brandstetter 2016/04/14 16:54:28 Yes. JSEP says we should accept these protocols as
1132 (protocol == kMediaProtocolDtlsSavpf && secure_transport);
1133 } 1145 }
1134 1146
1135 static void SetMediaProtocol(bool secure_transport, 1147 static void SetMediaProtocol(bool secure_transport,
1136 MediaContentDescription* desc) { 1148 MediaContentDescription* desc) {
1137 if (!desc->cryptos().empty()) 1149 if (!desc->cryptos().empty())
1138 desc->set_protocol(kMediaProtocolSavpf); 1150 desc->set_protocol(kMediaProtocolSavpf);
1139 else if (secure_transport) 1151 else if (secure_transport)
1140 desc->set_protocol(kMediaProtocolDtlsSavpf); 1152 desc->set_protocol(kMediaProtocolDtlsSavpf);
1141 else 1153 else
1142 desc->set_protocol(kMediaProtocolAvpf); 1154 desc->set_protocol(kMediaProtocolAvpf);
(...skipping 861 matching lines...) Expand 10 before | Expand all | Expand 10 after
2004 GetFirstMediaContentDescription(sdesc, MEDIA_TYPE_VIDEO)); 2016 GetFirstMediaContentDescription(sdesc, MEDIA_TYPE_VIDEO));
2005 } 2017 }
2006 2018
2007 const DataContentDescription* GetFirstDataContentDescription( 2019 const DataContentDescription* GetFirstDataContentDescription(
2008 const SessionDescription* sdesc) { 2020 const SessionDescription* sdesc) {
2009 return static_cast<const DataContentDescription*>( 2021 return static_cast<const DataContentDescription*>(
2010 GetFirstMediaContentDescription(sdesc, MEDIA_TYPE_DATA)); 2022 GetFirstMediaContentDescription(sdesc, MEDIA_TYPE_DATA));
2011 } 2023 }
2012 2024
2013 } // namespace cricket 2025 } // namespace cricket
OLDNEW
« no previous file with comments | « no previous file | webrtc/pc/mediasession_unittest.cc » ('j') | webrtc/pc/mediasession_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698