2013-07-10 00:45:36 +00:00
|
|
|
/*
|
2016-02-10 07:54:43 -08:00
|
|
|
* Copyright 2012 The WebRTC project authors. All Rights Reserved.
|
2013-07-10 00:45:36 +00:00
|
|
|
*
|
2016-02-10 07:54:43 -08:00
|
|
|
* Use of this source code is governed by a BSD-style license
|
|
|
|
|
* that can be found in the LICENSE file in the root of the source
|
|
|
|
|
* tree. An additional intellectual property rights grant can be found
|
|
|
|
|
* in the file PATENTS. All contributing project authors may
|
|
|
|
|
* be found in the AUTHORS file in the root of the source tree.
|
2013-07-10 00:45:36 +00:00
|
|
|
*/
|
|
|
|
|
|
2017-02-08 01:38:21 -08:00
|
|
|
// TODO(deadbeef): Move this out of api/; it's an implementation detail and
|
|
|
|
|
// shouldn't be used externally.
|
2013-07-10 00:45:36 +00:00
|
|
|
|
2016-02-10 10:53:12 +01:00
|
|
|
#ifndef WEBRTC_API_JSEPSESSIONDESCRIPTION_H_
|
|
|
|
|
#define WEBRTC_API_JSEPSESSIONDESCRIPTION_H_
|
2013-07-10 00:45:36 +00:00
|
|
|
|
2016-04-27 06:47:29 -07:00
|
|
|
#include <memory>
|
2013-07-10 00:45:36 +00:00
|
|
|
#include <string>
|
|
|
|
|
#include <vector>
|
|
|
|
|
|
2016-02-10 10:53:12 +01:00
|
|
|
#include "webrtc/api/jsep.h"
|
|
|
|
|
#include "webrtc/api/jsepicecandidate.h"
|
2016-03-14 11:59:18 -07:00
|
|
|
#include "webrtc/p2p/base/candidate.h"
|
2017-07-06 19:44:34 +02:00
|
|
|
#include "webrtc/rtc_base/constructormagic.h"
|
2013-07-10 00:45:36 +00:00
|
|
|
|
|
|
|
|
namespace cricket {
|
|
|
|
|
class SessionDescription;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
namespace webrtc {
|
|
|
|
|
|
2017-02-08 01:38:21 -08:00
|
|
|
// Implementation of SessionDescriptionInterface.
|
2013-07-10 00:45:36 +00:00
|
|
|
class JsepSessionDescription : public SessionDescriptionInterface {
|
|
|
|
|
public:
|
|
|
|
|
explicit JsepSessionDescription(const std::string& type);
|
|
|
|
|
virtual ~JsepSessionDescription();
|
|
|
|
|
|
|
|
|
|
// Takes ownership of |description|.
|
2017-02-08 01:38:21 -08:00
|
|
|
// TODO(deadbeef): Make this use an std::unique_ptr<>, so ownership logic is
|
|
|
|
|
// more clear.
|
2013-07-10 00:45:36 +00:00
|
|
|
bool Initialize(cricket::SessionDescription* description,
|
|
|
|
|
const std::string& session_id,
|
|
|
|
|
const std::string& session_version);
|
|
|
|
|
|
|
|
|
|
virtual cricket::SessionDescription* description() {
|
|
|
|
|
return description_.get();
|
|
|
|
|
}
|
|
|
|
|
virtual const cricket::SessionDescription* description() const {
|
|
|
|
|
return description_.get();
|
|
|
|
|
}
|
|
|
|
|
virtual std::string session_id() const {
|
|
|
|
|
return session_id_;
|
|
|
|
|
}
|
|
|
|
|
virtual std::string session_version() const {
|
|
|
|
|
return session_version_;
|
|
|
|
|
}
|
|
|
|
|
virtual std::string type() const {
|
|
|
|
|
return type_;
|
|
|
|
|
}
|
2017-02-08 01:38:21 -08:00
|
|
|
// Allows changing the type. Used for testing.
|
2013-07-10 00:45:36 +00:00
|
|
|
void set_type(const std::string& type) { type_ = type; }
|
|
|
|
|
virtual bool AddCandidate(const IceCandidateInterface* candidate);
|
2016-03-14 11:59:18 -07:00
|
|
|
virtual size_t RemoveCandidates(
|
|
|
|
|
const std::vector<cricket::Candidate>& candidates);
|
2013-07-10 00:45:36 +00:00
|
|
|
virtual size_t number_of_mediasections() const;
|
|
|
|
|
virtual const IceCandidateCollection* candidates(
|
|
|
|
|
size_t mediasection_index) const;
|
|
|
|
|
virtual bool ToString(std::string* out) const;
|
|
|
|
|
|
|
|
|
|
static const int kDefaultVideoCodecId;
|
|
|
|
|
static const char kDefaultVideoCodecName[];
|
|
|
|
|
|
|
|
|
|
private:
|
2016-04-27 06:47:29 -07:00
|
|
|
std::unique_ptr<cricket::SessionDescription> description_;
|
2013-07-10 00:45:36 +00:00
|
|
|
std::string session_id_;
|
|
|
|
|
std::string session_version_;
|
|
|
|
|
std::string type_;
|
|
|
|
|
std::vector<JsepCandidateCollection> candidate_collection_;
|
|
|
|
|
|
|
|
|
|
bool GetMediasectionIndex(const IceCandidateInterface* candidate,
|
|
|
|
|
size_t* index);
|
2016-03-14 11:59:18 -07:00
|
|
|
int GetMediasectionIndex(const cricket::Candidate& candidate);
|
2013-07-10 00:45:36 +00:00
|
|
|
|
2015-09-16 05:37:44 -07:00
|
|
|
RTC_DISALLOW_COPY_AND_ASSIGN(JsepSessionDescription);
|
2013-07-10 00:45:36 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace webrtc
|
|
|
|
|
|
2016-02-10 10:53:12 +01:00
|
|
|
#endif // WEBRTC_API_JSEPSESSIONDESCRIPTION_H_
|