diff --git a/pc/webrtc_sdp.cc b/pc/webrtc_sdp.cc index 7f61a26293..14eb0df922 100644 --- a/pc/webrtc_sdp.cc +++ b/pc/webrtc_sdp.cc @@ -3128,38 +3128,44 @@ bool ParseContent(const std::string& message, if (!ParseDtlsSetup(line, &(transport->connection_role), error)) { return false; } - } else if (cricket::IsDtlsSctp(protocol) && - HasAttribute(line, kAttributeSctpPort)) { - if (media_type != cricket::MEDIA_TYPE_DATA) { - return ParseFailed( - line, "sctp-port attribute found in non-data media description.", - error); + } else if (cricket::IsDtlsSctp(protocol)) { + // + // SCTP specific attributes + // + if (HasAttribute(line, kAttributeSctpPort)) { + if (media_type != cricket::MEDIA_TYPE_DATA) { + return ParseFailed( + line, "sctp-port attribute found in non-data media description.", + error); + } + if (media_desc->as_sctp()->use_sctpmap()) { + return ParseFailed( + line, "sctp-port attribute can't be used with sctpmap.", error); + } + int sctp_port; + if (!ParseSctpPort(line, &sctp_port, error)) { + return false; + } + media_desc->as_sctp()->set_port(sctp_port); + } else if (HasAttribute(line, kAttributeMaxMessageSize)) { + if (media_type != cricket::MEDIA_TYPE_DATA) { + return ParseFailed( + line, + "max-message-size attribute found in non-data media description.", + error); + } + int max_message_size; + if (!ParseSctpMaxMessageSize(line, &max_message_size, error)) { + return false; + } + media_desc->as_sctp()->set_max_message_size(max_message_size); + } else if (HasAttribute(line, kAttributeSctpmap)) { + // Ignore a=sctpmap: from early versions of draft-ietf-mmusic-sctp-sdp + continue; } - if (media_desc->as_sctp()->use_sctpmap()) { - return ParseFailed( - line, "sctp-port attribute can't be used with sctpmap.", error); - } - int sctp_port; - if (!ParseSctpPort(line, &sctp_port, error)) { - return false; - } - media_desc->as_sctp()->set_port(sctp_port); - } else if (cricket::IsDtlsSctp(protocol) && - HasAttribute(line, kAttributeMaxMessageSize)) { - if (media_type != cricket::MEDIA_TYPE_DATA) { - return ParseFailed( - line, - "max-message-size attribute found in non-data media description.", - error); - } - int max_message_size; - if (!ParseSctpMaxMessageSize(line, &max_message_size, error)) { - return false; - } - media_desc->as_sctp()->set_max_message_size(max_message_size); } else if (cricket::IsRtpProtocol(protocol)) { // - // RTP specific attrubtes + // RTP specific attributes // if (HasAttribute(line, kAttributeRtcpMux)) { media_desc->set_rtcp_mux(true);