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 <deadbeef@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30552}
This commit is contained in:
Taylor Brandstetter 2020-02-18 14:05:07 -08:00 committed by Commit Bot
parent 567f03f7a0
commit 4256df09bf
2 changed files with 18 additions and 2 deletions

View File

@ -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<std::string> stream_ids;
std::string track_id;
if (msid_signaling & cricket::kMsidSignalingMediaSection) {

View File

@ -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));
}