OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2012 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 |
11 // Implements the IceCandidateInterface. | 11 // Implements the IceCandidateInterface. |
12 | 12 |
13 #ifndef WEBRTC_API_JSEPICECANDIDATE_H_ | 13 #ifndef WEBRTC_API_JSEPICECANDIDATE_H_ |
14 #define WEBRTC_API_JSEPICECANDIDATE_H_ | 14 #define WEBRTC_API_JSEPICECANDIDATE_H_ |
15 | 15 |
16 #include <string> | 16 #include <string> |
17 | 17 |
18 #include "webrtc/api/jsep.h" | 18 #include "webrtc/api/jsep.h" |
19 #include "webrtc/base/constructormagic.h" | 19 #include "webrtc/base/constructormagic.h" |
20 #include "webrtc/p2p/base/candidate.h" | 20 #include "webrtc/p2p/base/candidate.h" |
21 | 21 |
22 namespace webrtc { | 22 namespace webrtc { |
23 | 23 |
24 class JsepIceCandidate : public IceCandidateInterface { | 24 class JsepIceCandidate : public rtc::RefCountedObject<IceCandidateInterface> { |
25 public: | 25 public: |
26 JsepIceCandidate(const std::string& sdp_mid, int sdp_mline_index); | 26 JsepIceCandidate(const std::string& sdp_mid, int sdp_mline_index); |
27 JsepIceCandidate(const std::string& sdp_mid, int sdp_mline_index, | 27 JsepIceCandidate(const std::string& sdp_mid, int sdp_mline_index, |
28 const cricket::Candidate& candidate); | 28 const cricket::Candidate& candidate); |
29 ~JsepIceCandidate(); | 29 ~JsepIceCandidate(); |
30 // |error| can be NULL if don't care about the failure reason. | 30 // |error| can be NULL if don't care about the failure reason. |
31 bool Initialize(const std::string& sdp, SdpParseError* err); | 31 bool Initialize(const std::string& sdp, SdpParseError* err); |
32 void SetCandidate(const cricket::Candidate& candidate) { | 32 void SetCandidate(const cricket::Candidate& candidate) { |
33 candidate_ = candidate; | 33 candidate_ = candidate; |
34 } | 34 } |
(...skipping 28 matching lines...) Expand all Loading... |
63 return candidates_.size(); | 63 return candidates_.size(); |
64 } | 64 } |
65 virtual bool HasCandidate(const IceCandidateInterface* candidate) const; | 65 virtual bool HasCandidate(const IceCandidateInterface* candidate) const; |
66 // Adds and takes ownership of the JsepIceCandidate. | 66 // Adds and takes ownership of the JsepIceCandidate. |
67 virtual void add(JsepIceCandidate* candidate) { | 67 virtual void add(JsepIceCandidate* candidate) { |
68 candidates_.push_back(candidate); | 68 candidates_.push_back(candidate); |
69 } | 69 } |
70 virtual const IceCandidateInterface* at(size_t index) const { | 70 virtual const IceCandidateInterface* at(size_t index) const { |
71 return candidates_[index]; | 71 return candidates_[index]; |
72 } | 72 } |
| 73 // Removes candidates that have a matching address and protocol. |
| 74 // Returns the number of candidates that were removed. |
| 75 int remove(const IceCandidateInterface* candidate); |
73 | 76 |
74 private: | 77 private: |
75 std::vector<JsepIceCandidate*> candidates_; | 78 std::vector<JsepIceCandidate*> candidates_; |
76 | 79 |
77 RTC_DISALLOW_COPY_AND_ASSIGN(JsepCandidateCollection); | 80 RTC_DISALLOW_COPY_AND_ASSIGN(JsepCandidateCollection); |
78 }; | 81 }; |
79 | 82 |
80 } // namespace webrtc | 83 } // namespace webrtc |
81 | 84 |
82 #endif // WEBRTC_API_JSEPICECANDIDATE_H_ | 85 #endif // WEBRTC_API_JSEPICECANDIDATE_H_ |
OLD | NEW |