From 4256df09bf26f594f601a1f0a281627a92f2c8be Mon Sep 17 00:00:00 2001 From: Taylor Brandstetter Date: Tue, 18 Feb 2020 14:05:07 -0800 Subject: Make CNAME optional. Before this change, lack of a CNAME results in losing all SSRC information. This isn't necessary; we don't even use the CNAME for anything on the receiving side. Note that lack of a CNAME is technically a violation of https://tools.ietf.org/html/rfc5576#section-6.1. Bug: webrtc:10385 Change-Id: If9836b6c518367b29ffa1fb00752e52d51915d37 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/168581 Commit-Queue: Taylor Reviewed-by: Harald Alvestrand Cr-Commit-Position: refs/heads/master@{#30552} --- pc/webrtc_sdp.cc | 6 ++++-- pc/webrtc_sdp_unittest.cc | 14 ++++++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) (limited to 'pc') diff --git a/pc/webrtc_sdp.cc b/pc/webrtc_sdp.cc index d49684e209..29a9030483 100644 --- a/pc/webrtc_sdp.cc +++ b/pc/webrtc_sdp.cc @@ -686,10 +686,12 @@ void CreateTracksFromSsrcInfos(const SsrcInfoVec& ssrc_infos, int msid_signaling) { RTC_DCHECK(tracks != NULL); for (const SsrcInfo& ssrc_info : ssrc_infos) { + // According to https://tools.ietf.org/html/rfc5576#section-6.1, the CNAME + // attribute is mandatory, but we relax that restriction. if (ssrc_info.cname.empty()) { - continue; + RTC_LOG(LS_WARNING) << "CNAME attribute missing for SSRC " + << ssrc_info.ssrc_id; } - std::vector stream_ids; std::string track_id; if (msid_signaling & cricket::kMsidSignalingMediaSection) { diff --git a/pc/webrtc_sdp_unittest.cc b/pc/webrtc_sdp_unittest.cc index 5bb4ffcd5a..476955d26b 100644 --- a/pc/webrtc_sdp_unittest.cc +++ b/pc/webrtc_sdp_unittest.cc @@ -4672,3 +4672,17 @@ TEST_F(WebRtcSdpTest, DeserializeWithAllSctpProtocols) { EXPECT_TRUE(webrtc::SdpDeserialize(message, &jsep_output, &error)); } } + +// According to https://tools.ietf.org/html/rfc5576#section-6.1, the CNAME +// attribute is mandatory, but we relax that restriction. +TEST_F(WebRtcSdpTest, DeserializeSessionDescriptionWithoutCname) { + std::string sdp_without_cname = kSdpFullString; + Replace("a=ssrc:1 cname:stream_1_cname\r\n", "", &sdp_without_cname); + JsepSessionDescription new_jdesc(kDummyType); + EXPECT_TRUE(SdpDeserialize(sdp_without_cname, &new_jdesc)); + + audio_desc_->mutable_streams()[0].cname = ""; + ASSERT_TRUE(jdesc_.Initialize(desc_.Clone(), jdesc_.session_id(), + jdesc_.session_version())); + EXPECT_TRUE(CompareSessionDescription(jdesc_, new_jdesc)); +} -- cgit v1.2.3