OLD | NEW |
| (Empty) |
1 /* | |
2 * Copyright 2012 The WebRTC project authors. All Rights Reserved. | |
3 * | |
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 | |
6 * tree. An additional intellectual property rights grant can be found | |
7 * in the file PATENTS. All contributing project authors may | |
8 * be found in the AUTHORS file in the root of the source tree. | |
9 */ | |
10 | |
11 // Implements the SessionDescriptionInterface. | |
12 | |
13 #ifndef WEBRTC_API_JSEPSESSIONDESCRIPTION_H_ | |
14 #define WEBRTC_API_JSEPSESSIONDESCRIPTION_H_ | |
15 | |
16 #include <memory> | |
17 #include <string> | |
18 #include <vector> | |
19 | |
20 #include "webrtc/api/jsep.h" | |
21 #include "webrtc/api/jsepicecandidate.h" | |
22 #include "webrtc/base/constructormagic.h" | |
23 #include "webrtc/p2p/base/candidate.h" | |
24 | |
25 namespace cricket { | |
26 class SessionDescription; | |
27 } | |
28 | |
29 namespace webrtc { | |
30 | |
31 class JsepSessionDescription : public SessionDescriptionInterface { | |
32 public: | |
33 explicit JsepSessionDescription(const std::string& type); | |
34 virtual ~JsepSessionDescription(); | |
35 | |
36 // |error| can be NULL if don't care about the failure reason. | |
37 bool Initialize(const std::string& sdp, SdpParseError* error); | |
38 | |
39 // Takes ownership of |description|. | |
40 bool Initialize(cricket::SessionDescription* description, | |
41 const std::string& session_id, | |
42 const std::string& session_version); | |
43 | |
44 virtual cricket::SessionDescription* description() { | |
45 return description_.get(); | |
46 } | |
47 virtual const cricket::SessionDescription* description() const { | |
48 return description_.get(); | |
49 } | |
50 virtual std::string session_id() const { | |
51 return session_id_; | |
52 } | |
53 virtual std::string session_version() const { | |
54 return session_version_; | |
55 } | |
56 virtual std::string type() const { | |
57 return type_; | |
58 } | |
59 // Allow changing the type. Used for testing. | |
60 void set_type(const std::string& type) { type_ = type; } | |
61 virtual bool AddCandidate(const IceCandidateInterface* candidate); | |
62 virtual size_t RemoveCandidates( | |
63 const std::vector<cricket::Candidate>& candidates); | |
64 virtual size_t number_of_mediasections() const; | |
65 virtual const IceCandidateCollection* candidates( | |
66 size_t mediasection_index) const; | |
67 virtual bool ToString(std::string* out) const; | |
68 | |
69 static const int kDefaultVideoCodecId; | |
70 static const char kDefaultVideoCodecName[]; | |
71 | |
72 private: | |
73 std::unique_ptr<cricket::SessionDescription> description_; | |
74 std::string session_id_; | |
75 std::string session_version_; | |
76 std::string type_; | |
77 std::vector<JsepCandidateCollection> candidate_collection_; | |
78 | |
79 bool GetMediasectionIndex(const IceCandidateInterface* candidate, | |
80 size_t* index); | |
81 int GetMediasectionIndex(const cricket::Candidate& candidate); | |
82 | |
83 RTC_DISALLOW_COPY_AND_ASSIGN(JsepSessionDescription); | |
84 }; | |
85 | |
86 } // namespace webrtc | |
87 | |
88 #endif // WEBRTC_API_JSEPSESSIONDESCRIPTION_H_ | |
OLD | NEW |