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
diff --git a/talk/app/webrtc/webrtcsdp.cc b/talk/app/webrtc/webrtcsdp.cc
index b2d8a30..412825e 100644
--- a/talk/app/webrtc/webrtcsdp.cc
+++ b/talk/app/webrtc/webrtcsdp.cc
@@ -913,6 +913,12 @@
std::vector<cricket::Candidate> candidates;
candidates.push_back(candidate.candidate());
BuildCandidate(candidates, &message);
+ // From WebRTC draft section 4.8.1.1 candidate-attribute will be
+ // just candidate:<candidate> not a=candidate:<blah>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 64776e2..e28599f 100644
--- a/talk/app/webrtc/webrtcsdp_unittest.cc
+++ b/talk/app/webrtc/webrtcsdp_unittest.cc
@@ -1575,7 +1575,7 @@
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) {