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

Side by Side Diff: talk/app/webrtc/webrtcsdp.cc

Issue 1648813004: Remove candidates when doing continual gathering (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Created 4 years, 10 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * libjingle 2 * libjingle
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 Google Inc.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright notice, 8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer. 9 * this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright notice, 10 * 2. Redistributions in binary form must reproduce the above copyright notice,
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 // a=sctp-port 162 // a=sctp-port
163 static const char kAttributeSctpPort[] = "sctp-port"; 163 static const char kAttributeSctpPort[] = "sctp-port";
164 164
165 // Experimental flags 165 // Experimental flags
166 static const char kAttributeXGoogleFlag[] = "x-google-flag"; 166 static const char kAttributeXGoogleFlag[] = "x-google-flag";
167 static const char kValueConference[] = "conference"; 167 static const char kValueConference[] = "conference";
168 168
169 // Candidate 169 // Candidate
170 static const char kCandidateHost[] = "host"; 170 static const char kCandidateHost[] = "host";
171 static const char kCandidateSrflx[] = "srflx"; 171 static const char kCandidateSrflx[] = "srflx";
172 // TODO: How to map the prflx with circket candidate type 172 static const char kCandidatePrflx[] = "prflx";
173 // static const char kCandidatePrflx[] = "prflx";
174 static const char kCandidateRelay[] = "relay"; 173 static const char kCandidateRelay[] = "relay";
175 static const char kTcpCandidateType[] = "tcptype"; 174 static const char kTcpCandidateType[] = "tcptype";
176 175
177 static const char kSdpDelimiterEqual = '='; 176 static const char kSdpDelimiterEqual = '=';
178 static const char kSdpDelimiterSpace = ' '; 177 static const char kSdpDelimiterSpace = ' ';
179 static const char kSdpDelimiterColon = ':'; 178 static const char kSdpDelimiterColon = ':';
180 static const char kSdpDelimiterSemicolon = ';'; 179 static const char kSdpDelimiterSemicolon = ';';
181 static const char kSdpDelimiterSlash = '/'; 180 static const char kSdpDelimiterSlash = '/';
182 static const char kNewLine = '\n'; 181 static const char kNewLine = '\n';
183 static const char kReturn = '\r'; 182 static const char kReturn = '\r';
(...skipping 838 matching lines...) Expand 10 before | Expand all | Expand 10 after
1022 } 1021 }
1023 1022
1024 std::string candidate_type; 1023 std::string candidate_type;
1025 const std::string& type = fields[7]; 1024 const std::string& type = fields[7];
1026 if (type == kCandidateHost) { 1025 if (type == kCandidateHost) {
1027 candidate_type = cricket::LOCAL_PORT_TYPE; 1026 candidate_type = cricket::LOCAL_PORT_TYPE;
1028 } else if (type == kCandidateSrflx) { 1027 } else if (type == kCandidateSrflx) {
1029 candidate_type = cricket::STUN_PORT_TYPE; 1028 candidate_type = cricket::STUN_PORT_TYPE;
1030 } else if (type == kCandidateRelay) { 1029 } else if (type == kCandidateRelay) {
1031 candidate_type = cricket::RELAY_PORT_TYPE; 1030 candidate_type = cricket::RELAY_PORT_TYPE;
1031 } else if (type == kCandidatePrflx) {
1032 candidate_type = cricket::PRFLX_PORT_TYPE;
1032 } else { 1033 } else {
1033 return ParseFailed(first_line, "Unsupported candidate type.", error); 1034 return ParseFailed(first_line, "Unsupported candidate type.", error);
1034 } 1035 }
1035 1036
1036 size_t current_position = expected_min_fields; 1037 size_t current_position = expected_min_fields;
1037 SocketAddress related_address; 1038 SocketAddress related_address;
1038 // The 2 optional fields for related address 1039 // The 2 optional fields for related address
1039 // [raddr <connection-address>] [rport <port>] 1040 // [raddr <connection-address>] [rport <port>]
1040 if (fields.size() >= (current_position + 2) && 1041 if (fields.size() >= (current_position + 2) &&
1041 fields[current_position] == kAttributeCandidateRaddr) { 1042 fields[current_position] == kAttributeCandidateRaddr) {
(...skipping 692 matching lines...) Expand 10 before | Expand all | Expand 10 after
1734 // [raddr <connection-address>] [rport <port>] 1735 // [raddr <connection-address>] [rport <port>]
1735 // *(SP extension-att-name SP extension-att-value) 1736 // *(SP extension-att-name SP extension-att-value)
1736 std::string type; 1737 std::string type;
1737 // Map the cricket candidate type to "host" / "srflx" / "prflx" / "relay" 1738 // Map the cricket candidate type to "host" / "srflx" / "prflx" / "relay"
1738 if (it->type() == cricket::LOCAL_PORT_TYPE) { 1739 if (it->type() == cricket::LOCAL_PORT_TYPE) {
1739 type = kCandidateHost; 1740 type = kCandidateHost;
1740 } else if (it->type() == cricket::STUN_PORT_TYPE) { 1741 } else if (it->type() == cricket::STUN_PORT_TYPE) {
1741 type = kCandidateSrflx; 1742 type = kCandidateSrflx;
1742 } else if (it->type() == cricket::RELAY_PORT_TYPE) { 1743 } else if (it->type() == cricket::RELAY_PORT_TYPE) {
1743 type = kCandidateRelay; 1744 type = kCandidateRelay;
1745 } else if (it->type() == cricket::PRFLX_PORT_TYPE) {
1746 type = kCandidatePrflx;
1747 // Peer reflexive candidate should only be signaled with priority 0 for
1748 // being removed.
1749 ASSERT(it->priority() == 0);
1744 } else { 1750 } else {
1745 ASSERT(false); 1751 ASSERT(false);
1746 // Never write out candidates if we don't know the type. 1752 // Never write out candidates if we don't know the type.
1747 continue; 1753 continue;
1748 } 1754 }
1749 1755
1750 InitAttrLine(kAttributeCandidate, &os); 1756 InitAttrLine(kAttributeCandidate, &os);
1751 os << kSdpDelimiterColon 1757 os << kSdpDelimiterColon
1752 << it->foundation() << " " 1758 << it->foundation() << " "
1753 << it->component() << " " 1759 << it->component() << " "
(...skipping 1320 matching lines...) Expand 10 before | Expand all | Expand 10 after
3074 UpdateCodec<AudioContentDescription, cricket::AudioCodec>( 3080 UpdateCodec<AudioContentDescription, cricket::AudioCodec>(
3075 media_desc, payload_type, feedback_param); 3081 media_desc, payload_type, feedback_param);
3076 } else if (media_type == cricket::MEDIA_TYPE_VIDEO) { 3082 } else if (media_type == cricket::MEDIA_TYPE_VIDEO) {
3077 UpdateCodec<VideoContentDescription, cricket::VideoCodec>( 3083 UpdateCodec<VideoContentDescription, cricket::VideoCodec>(
3078 media_desc, payload_type, feedback_param); 3084 media_desc, payload_type, feedback_param);
3079 } 3085 }
3080 return true; 3086 return true;
3081 } 3087 }
3082 3088
3083 } // namespace webrtc 3089 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698