OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2011 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 // a=sctp-port | 147 // a=sctp-port |
148 static const char kAttributeSctpPort[] = "sctp-port"; | 148 static const char kAttributeSctpPort[] = "sctp-port"; |
149 | 149 |
150 // Experimental flags | 150 // Experimental flags |
151 static const char kAttributeXGoogleFlag[] = "x-google-flag"; | 151 static const char kAttributeXGoogleFlag[] = "x-google-flag"; |
152 static const char kValueConference[] = "conference"; | 152 static const char kValueConference[] = "conference"; |
153 | 153 |
154 // Candidate | 154 // Candidate |
155 static const char kCandidateHost[] = "host"; | 155 static const char kCandidateHost[] = "host"; |
156 static const char kCandidateSrflx[] = "srflx"; | 156 static const char kCandidateSrflx[] = "srflx"; |
157 // TODO: How to map the prflx with circket candidate type | 157 static const char kCandidatePrflx[] = "prflx"; |
158 // static const char kCandidatePrflx[] = "prflx"; | |
159 static const char kCandidateRelay[] = "relay"; | 158 static const char kCandidateRelay[] = "relay"; |
160 static const char kTcpCandidateType[] = "tcptype"; | 159 static const char kTcpCandidateType[] = "tcptype"; |
161 | 160 |
162 static const char kSdpDelimiterEqual = '='; | 161 static const char kSdpDelimiterEqual = '='; |
163 static const char kSdpDelimiterSpace = ' '; | 162 static const char kSdpDelimiterSpace = ' '; |
164 static const char kSdpDelimiterColon = ':'; | 163 static const char kSdpDelimiterColon = ':'; |
165 static const char kSdpDelimiterSemicolon = ';'; | 164 static const char kSdpDelimiterSemicolon = ';'; |
166 static const char kSdpDelimiterSlash = '/'; | 165 static const char kSdpDelimiterSlash = '/'; |
167 static const char kNewLine = '\n'; | 166 static const char kNewLine = '\n'; |
168 static const char kReturn = '\r'; | 167 static const char kReturn = '\r'; |
(...skipping 838 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1007 } | 1006 } |
1008 | 1007 |
1009 std::string candidate_type; | 1008 std::string candidate_type; |
1010 const std::string& type = fields[7]; | 1009 const std::string& type = fields[7]; |
1011 if (type == kCandidateHost) { | 1010 if (type == kCandidateHost) { |
1012 candidate_type = cricket::LOCAL_PORT_TYPE; | 1011 candidate_type = cricket::LOCAL_PORT_TYPE; |
1013 } else if (type == kCandidateSrflx) { | 1012 } else if (type == kCandidateSrflx) { |
1014 candidate_type = cricket::STUN_PORT_TYPE; | 1013 candidate_type = cricket::STUN_PORT_TYPE; |
1015 } else if (type == kCandidateRelay) { | 1014 } else if (type == kCandidateRelay) { |
1016 candidate_type = cricket::RELAY_PORT_TYPE; | 1015 candidate_type = cricket::RELAY_PORT_TYPE; |
| 1016 } else if (type == kCandidatePrflx) { |
| 1017 candidate_type = cricket::PRFLX_PORT_TYPE; |
1017 } else { | 1018 } else { |
1018 return ParseFailed(first_line, "Unsupported candidate type.", error); | 1019 return ParseFailed(first_line, "Unsupported candidate type.", error); |
1019 } | 1020 } |
1020 | 1021 |
1021 size_t current_position = expected_min_fields; | 1022 size_t current_position = expected_min_fields; |
1022 SocketAddress related_address; | 1023 SocketAddress related_address; |
1023 // The 2 optional fields for related address | 1024 // The 2 optional fields for related address |
1024 // [raddr <connection-address>] [rport <port>] | 1025 // [raddr <connection-address>] [rport <port>] |
1025 if (fields.size() >= (current_position + 2) && | 1026 if (fields.size() >= (current_position + 2) && |
1026 fields[current_position] == kAttributeCandidateRaddr) { | 1027 fields[current_position] == kAttributeCandidateRaddr) { |
(...skipping 718 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1745 // [raddr <connection-address>] [rport <port>] | 1746 // [raddr <connection-address>] [rport <port>] |
1746 // *(SP extension-att-name SP extension-att-value) | 1747 // *(SP extension-att-name SP extension-att-value) |
1747 std::string type; | 1748 std::string type; |
1748 // Map the cricket candidate type to "host" / "srflx" / "prflx" / "relay" | 1749 // Map the cricket candidate type to "host" / "srflx" / "prflx" / "relay" |
1749 if (it->type() == cricket::LOCAL_PORT_TYPE) { | 1750 if (it->type() == cricket::LOCAL_PORT_TYPE) { |
1750 type = kCandidateHost; | 1751 type = kCandidateHost; |
1751 } else if (it->type() == cricket::STUN_PORT_TYPE) { | 1752 } else if (it->type() == cricket::STUN_PORT_TYPE) { |
1752 type = kCandidateSrflx; | 1753 type = kCandidateSrflx; |
1753 } else if (it->type() == cricket::RELAY_PORT_TYPE) { | 1754 } else if (it->type() == cricket::RELAY_PORT_TYPE) { |
1754 type = kCandidateRelay; | 1755 type = kCandidateRelay; |
| 1756 } else if (it->type() == cricket::PRFLX_PORT_TYPE) { |
| 1757 type = kCandidatePrflx; |
| 1758 // Peer reflexive candidate may be signaled for being removed. |
1755 } else { | 1759 } else { |
1756 ASSERT(false); | 1760 ASSERT(false); |
1757 // Never write out candidates if we don't know the type. | 1761 // Never write out candidates if we don't know the type. |
1758 continue; | 1762 continue; |
1759 } | 1763 } |
1760 | 1764 |
1761 InitAttrLine(kAttributeCandidate, &os); | 1765 InitAttrLine(kAttributeCandidate, &os); |
1762 os << kSdpDelimiterColon | 1766 os << kSdpDelimiterColon |
1763 << it->foundation() << " " | 1767 << it->foundation() << " " |
1764 << it->component() << " " | 1768 << it->component() << " " |
(...skipping 1362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3127 UpdateCodec<AudioContentDescription, cricket::AudioCodec>( | 3131 UpdateCodec<AudioContentDescription, cricket::AudioCodec>( |
3128 media_desc, payload_type, feedback_param); | 3132 media_desc, payload_type, feedback_param); |
3129 } else if (media_type == cricket::MEDIA_TYPE_VIDEO) { | 3133 } else if (media_type == cricket::MEDIA_TYPE_VIDEO) { |
3130 UpdateCodec<VideoContentDescription, cricket::VideoCodec>( | 3134 UpdateCodec<VideoContentDescription, cricket::VideoCodec>( |
3131 media_desc, payload_type, feedback_param); | 3135 media_desc, payload_type, feedback_param); |
3132 } | 3136 } |
3133 return true; | 3137 return true; |
3134 } | 3138 } |
3135 | 3139 |
3136 } // namespace webrtc | 3140 } // namespace webrtc |
OLD | NEW |