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
|
|
|
|
2019-01-11 09:11:00 -08:00
|
|
|
#ifndef API_JSEP_SESSION_DESCRIPTION_H_
|
|
|
|
|
#define API_JSEP_SESSION_DESCRIPTION_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>
|
|
|
|
|
|
2018-12-11 10:15:23 -08:00
|
|
|
#include "absl/strings/string_view.h"
|
2017-10-05 14:53:33 +02:00
|
|
|
#include "api/candidate.h"
|
2017-09-15 06:47:31 +02:00
|
|
|
#include "api/jsep.h"
|
2019-01-11 09:11:00 -08:00
|
|
|
#include "api/jsep_ice_candidate.h"
|
|
|
|
|
#include "rtc_base/constructor_magic.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:
|
2017-12-05 12:47:32 -08:00
|
|
|
explicit JsepSessionDescription(SdpType type);
|
|
|
|
|
// TODO(steveanton): Remove this once callers have switched to SdpType.
|
2013-07-10 00:45:36 +00:00
|
|
|
explicit JsepSessionDescription(const std::string& type);
|
2018-12-11 10:15:23 -08:00
|
|
|
JsepSessionDescription(
|
|
|
|
|
SdpType type,
|
|
|
|
|
std::unique_ptr<cricket::SessionDescription> description,
|
|
|
|
|
absl::string_view session_id,
|
|
|
|
|
absl::string_view session_version);
|
2013-07-10 00:45:36 +00:00
|
|
|
virtual ~JsepSessionDescription();
|
|
|
|
|
|
|
|
|
|
// Takes ownership of |description|.
|
2019-04-12 07:01:29 +02:00
|
|
|
bool Initialize(std::unique_ptr<cricket::SessionDescription> description,
|
|
|
|
|
const std::string& session_id,
|
|
|
|
|
const std::string& session_version);
|
2013-07-10 00:45:36 +00:00
|
|
|
|
2020-12-17 19:28:29 +00:00
|
|
|
virtual std::unique_ptr<SessionDescriptionInterface> Clone() const;
|
2020-12-15 15:18:28 +00:00
|
|
|
|
2013-07-10 00:45:36 +00:00
|
|
|
virtual cricket::SessionDescription* description() {
|
|
|
|
|
return description_.get();
|
|
|
|
|
}
|
|
|
|
|
virtual const cricket::SessionDescription* description() const {
|
|
|
|
|
return description_.get();
|
|
|
|
|
}
|
2018-06-19 15:03:05 +02:00
|
|
|
virtual std::string session_id() const { return session_id_; }
|
|
|
|
|
virtual std::string session_version() const { return session_version_; }
|
2017-12-05 12:47:32 -08:00
|
|
|
virtual SdpType GetType() const { return type_; }
|
|
|
|
|
virtual std::string type() const { return SdpTypeToString(type_); }
|
2017-02-08 01:38:21 -08:00
|
|
|
// Allows changing the type. Used for testing.
|
2013-07-10 00:45:36 +00:00
|
|
|
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_;
|
2017-12-05 12:47:32 -08:00
|
|
|
SdpType type_;
|
2013-07-10 00:45:36 +00:00
|
|
|
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
|
|
|
|
|
|
2019-01-11 09:11:00 -08:00
|
|
|
#endif // API_JSEP_SESSION_DESCRIPTION_H_
|