From d45aea8f42308060860f8c51dd56415a62d560c1 Mon Sep 17 00:00:00 2001 From: deadbeef Date: Sat, 16 Sep 2017 01:24:29 -0700 Subject: [PATCH] Serialize "a=x-google-flag:conference". There was a test for deserialization but not serialization. This was probably always broken and no one noticed. I only noticed while debugging something else. BUG=None TBR=pthatcher@webrtc.org Review-Url: https://codereview.webrtc.org/3012383002 Cr-Commit-Position: refs/heads/master@{#19875} --- pc/webrtcsdp.cc | 6 ++++++ pc/webrtcsdp_unittest.cc | 21 +++++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/pc/webrtcsdp.cc b/pc/webrtcsdp.cc index dba2ba8544..648d78c76b 100644 --- a/pc/webrtcsdp.cc +++ b/pc/webrtcsdp.cc @@ -1508,6 +1508,12 @@ void BuildRtpContentAttributes(const MediaContentDescription* media_desc, AddLine(os.str(), message); } + if (media_desc->conference_mode()) { + InitAttrLine(kAttributeXGoogleFlag, &os); + os << kSdpDelimiterColon << kValueConference; + AddLine(os.str(), message); + } + // RFC 4568 // a=crypto: [] for (std::vector::const_iterator it = diff --git a/pc/webrtcsdp_unittest.cc b/pc/webrtcsdp_unittest.cc index eea8e01aac..75dac2505b 100644 --- a/pc/webrtcsdp_unittest.cc +++ b/pc/webrtcsdp_unittest.cc @@ -2777,6 +2777,27 @@ TEST_F(WebRtcSdpTest, DeserializeSdpWithConferenceFlag) { EXPECT_TRUE(video->conference_mode()); } +TEST_F(WebRtcSdpTest, SerializeSdpWithConferenceFlag) { + JsepSessionDescription jdesc(kDummyString); + + // We tested deserialization already above, so just test that if we serialize + // and deserialize the flag doesn't disappear. + EXPECT_TRUE(SdpDeserialize(kSdpConferenceString, &jdesc)); + std::string reserialized = webrtc::SdpSerialize(jdesc, false); + EXPECT_TRUE(SdpDeserialize(reserialized, &jdesc)); + + // Verify. + cricket::AudioContentDescription* audio = + static_cast( + jdesc.description()->GetContentDescriptionByName(cricket::CN_AUDIO)); + EXPECT_TRUE(audio->conference_mode()); + + cricket::VideoContentDescription* video = + static_cast( + jdesc.description()->GetContentDescriptionByName(cricket::CN_VIDEO)); + EXPECT_TRUE(video->conference_mode()); +} + TEST_F(WebRtcSdpTest, DeserializeBrokenSdp) { const char kSdpDestroyer[] = "!@#$%^&"; const char kSdpEmptyType[] = " =candidate";