henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 1 | /* |
kjellander | b24317b | 2016-02-10 07:54:43 -0800 | [diff] [blame] | 2 | * Copyright 2012 The WebRTC project authors. All Rights Reserved. |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 3 | * |
kjellander | b24317b | 2016-02-10 07:54:43 -0800 | [diff] [blame] | 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. |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 9 | */ |
| 10 | |
| 11 | // Implements the SessionDescriptionInterface. |
| 12 | |
Henrik Kjellander | 15583c1 | 2016-02-10 10:53:12 +0100 | [diff] [blame] | 13 | #ifndef WEBRTC_API_JSEPSESSIONDESCRIPTION_H_ |
| 14 | #define WEBRTC_API_JSEPSESSIONDESCRIPTION_H_ |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 15 | |
| 16 | #include <string> |
| 17 | #include <vector> |
| 18 | |
Henrik Kjellander | 15583c1 | 2016-02-10 10:53:12 +0100 | [diff] [blame] | 19 | #include "webrtc/api/jsep.h" |
| 20 | #include "webrtc/api/jsepicecandidate.h" |
buildbot@webrtc.org | d4e598d | 2014-07-29 17:36:52 +0000 | [diff] [blame] | 21 | #include "webrtc/base/scoped_ptr.h" |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 22 | |
| 23 | namespace cricket { |
| 24 | class SessionDescription; |
| 25 | } |
| 26 | |
| 27 | namespace webrtc { |
| 28 | |
| 29 | class JsepSessionDescription : public SessionDescriptionInterface { |
| 30 | public: |
| 31 | explicit JsepSessionDescription(const std::string& type); |
| 32 | virtual ~JsepSessionDescription(); |
| 33 | |
| 34 | // |error| can be NULL if don't care about the failure reason. |
| 35 | bool Initialize(const std::string& sdp, SdpParseError* error); |
| 36 | |
| 37 | // Takes ownership of |description|. |
| 38 | bool Initialize(cricket::SessionDescription* description, |
| 39 | const std::string& session_id, |
| 40 | const std::string& session_version); |
| 41 | |
| 42 | virtual cricket::SessionDescription* description() { |
| 43 | return description_.get(); |
| 44 | } |
| 45 | virtual const cricket::SessionDescription* description() const { |
| 46 | return description_.get(); |
| 47 | } |
| 48 | virtual std::string session_id() const { |
| 49 | return session_id_; |
| 50 | } |
| 51 | virtual std::string session_version() const { |
| 52 | return session_version_; |
| 53 | } |
| 54 | virtual std::string type() const { |
| 55 | return type_; |
| 56 | } |
| 57 | // Allow changing the type. Used for testing. |
| 58 | void set_type(const std::string& type) { type_ = type; } |
| 59 | virtual bool AddCandidate(const IceCandidateInterface* candidate); |
| 60 | virtual size_t number_of_mediasections() const; |
| 61 | virtual const IceCandidateCollection* candidates( |
| 62 | size_t mediasection_index) const; |
| 63 | virtual bool ToString(std::string* out) const; |
| 64 | |
| 65 | // Default video encoder settings. The resolution is the max resolution. |
| 66 | // TODO(perkj): Implement proper negotiation of video resolution. |
| 67 | static const int kDefaultVideoCodecId; |
| 68 | static const int kDefaultVideoCodecFramerate; |
| 69 | static const char kDefaultVideoCodecName[]; |
| 70 | static const int kMaxVideoCodecWidth; |
| 71 | static const int kMaxVideoCodecHeight; |
| 72 | static const int kDefaultVideoCodecPreference; |
| 73 | |
| 74 | private: |
buildbot@webrtc.org | d4e598d | 2014-07-29 17:36:52 +0000 | [diff] [blame] | 75 | rtc::scoped_ptr<cricket::SessionDescription> description_; |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 76 | std::string session_id_; |
| 77 | std::string session_version_; |
| 78 | std::string type_; |
| 79 | std::vector<JsepCandidateCollection> candidate_collection_; |
| 80 | |
| 81 | bool GetMediasectionIndex(const IceCandidateInterface* candidate, |
| 82 | size_t* index); |
| 83 | |
henrikg | 3c089d7 | 2015-09-16 05:37:44 -0700 | [diff] [blame] | 84 | RTC_DISALLOW_COPY_AND_ASSIGN(JsepSessionDescription); |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 85 | }; |
| 86 | |
| 87 | } // namespace webrtc |
| 88 | |
Henrik Kjellander | 15583c1 | 2016-02-10 10:53:12 +0100 | [diff] [blame] | 89 | #endif // WEBRTC_API_JSEPSESSIONDESCRIPTION_H_ |