Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(14)

Unified Diff: webrtc/api/webrtcsdp.cc

Issue 1648813004: Remove candidates when doing continual gathering (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Address Alex's comments Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/api/webrtcsdp.h ('k') | webrtc/api/webrtcsession.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/api/webrtcsdp.cc
diff --git a/webrtc/api/webrtcsdp.cc b/webrtc/api/webrtcsdp.cc
index 2ee0747627654dbe19830b8fa0c141535b26c2ed..b13220eb755ac394a6ae7daf432a321bae005fcd 100644
--- a/webrtc/api/webrtcsdp.cc
+++ b/webrtc/api/webrtcsdp.cc
@@ -154,8 +154,7 @@ static const char kValueConference[] = "conference";
// Candidate
static const char kCandidateHost[] = "host";
static const char kCandidateSrflx[] = "srflx";
-// TODO: How to map the prflx with circket candidate type
-// static const char kCandidatePrflx[] = "prflx";
+static const char kCandidatePrflx[] = "prflx";
static const char kCandidateRelay[] = "relay";
static const char kTcpCandidateType[] = "tcptype";
@@ -859,11 +858,14 @@ std::string SdpSerialize(const JsepSessionDescription& jdesc,
// Serializes the passed in IceCandidateInterface to a SDP string.
// candidate - The candidate to be serialized.
-std::string SdpSerializeCandidate(
- const IceCandidateInterface& candidate) {
+std::string SdpSerializeCandidate(const IceCandidateInterface& candidate) {
+ return SdpSerializeCandidate(candidate.candidate());
+}
+
+// Serializes a cricket Candidate.
+std::string SdpSerializeCandidate(const cricket::Candidate& candidate) {
std::string message;
- std::vector<cricket::Candidate> candidates;
- candidates.push_back(candidate.candidate());
+ std::vector<cricket::Candidate> candidates(1, candidate);
BuildCandidate(candidates, true, &message);
// From WebRTC draft section 4.8.1.1 candidate-attribute will be
// just candidate:<candidate> not a=candidate:<blah>CRLF
@@ -926,6 +928,18 @@ bool SdpDeserializeCandidate(const std::string& message,
return true;
}
+bool SdpDeserializeCandidate(const std::string& transport_name,
+ const std::string& message,
+ cricket::Candidate* candidate,
+ SdpParseError* error) {
+ ASSERT(candidate != nullptr);
+ if (!ParseCandidate(message, candidate, error, true)) {
+ return false;
+ }
+ candidate->set_transport_name(transport_name);
+ return true;
+}
+
bool ParseCandidate(const std::string& message, Candidate* candidate,
SdpParseError* error, bool is_raw) {
ASSERT(candidate != NULL);
@@ -1014,6 +1028,8 @@ bool ParseCandidate(const std::string& message, Candidate* candidate,
candidate_type = cricket::STUN_PORT_TYPE;
} else if (type == kCandidateRelay) {
candidate_type = cricket::RELAY_PORT_TYPE;
+ } else if (type == kCandidatePrflx) {
+ candidate_type = cricket::PRFLX_PORT_TYPE;
} else {
return ParseFailed(first_line, "Unsupported candidate type.", error);
}
@@ -1749,6 +1765,9 @@ void BuildCandidate(const std::vector<Candidate>& candidates,
type = kCandidateSrflx;
} else if (it->type() == cricket::RELAY_PORT_TYPE) {
type = kCandidateRelay;
+ } else if (it->type() == cricket::PRFLX_PORT_TYPE) {
+ type = kCandidatePrflx;
+ // Peer reflexive candidate may be signaled for being removed.
} else {
ASSERT(false);
// Never write out candidates if we don't know the type.
« no previous file with comments | « webrtc/api/webrtcsdp.h ('k') | webrtc/api/webrtcsession.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698