From ec9f5fb34cc612f26ec30f357ea3e3aa5d96c5c2 Mon Sep 17 00:00:00 2001 From: "wu@webrtc.org" Date: Tue, 24 Jun 2014 17:05:10 +0000 Subject: [PATCH] Change SdpSerializeCandidate to output candidate line without the "a=" and without the leading \r\n", i.e. candidate-attribute as defined in section 15.1 of [ICE]. BUG=crbug/387632 R=juberti@google.com Review URL: https://webrtc-codereview.appspot.com/17779004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@6533 4adac7df-926f-26a2-2b94-8c16560cd09d --- talk/app/webrtc/webrtcsdp.cc | 6 ++++++ talk/app/webrtc/webrtcsdp_unittest.cc | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/talk/app/webrtc/webrtcsdp.cc b/talk/app/webrtc/webrtcsdp.cc index b2d8a30ec5..412825e5cd 100644 --- a/talk/app/webrtc/webrtcsdp.cc +++ b/talk/app/webrtc/webrtcsdp.cc @@ -913,6 +913,12 @@ std::string SdpSerializeCandidate( std::vector candidates; candidates.push_back(candidate.candidate()); BuildCandidate(candidates, &message); + // From WebRTC draft section 4.8.1.1 candidate-attribute will be + // just candidate: not a=candidate:CRLF + ASSERT(message.find("a=") == 0); + message.erase(0, 2); + ASSERT(message.find(kLineBreak) == message.size() - 2); + message.resize(message.size() - 2); return message; } diff --git a/talk/app/webrtc/webrtcsdp_unittest.cc b/talk/app/webrtc/webrtcsdp_unittest.cc index 64776e29e1..e28599fc67 100644 --- a/talk/app/webrtc/webrtcsdp_unittest.cc +++ b/talk/app/webrtc/webrtcsdp_unittest.cc @@ -1575,7 +1575,7 @@ TEST_F(WebRtcSdpTest, SerializeSessionDescriptionWithBufferLatency) { TEST_F(WebRtcSdpTest, SerializeCandidates) { std::string message = webrtc::SdpSerializeCandidate(*jcandidate_); - EXPECT_EQ(std::string(kSdpOneCandidate), message); + EXPECT_EQ(std::string(kRawCandidate), message); } TEST_F(WebRtcSdpTest, DeserializeSessionDescription) {