Add CreateSessionDescription overload which takes a cricket::SessionDescription
This gives clients a way to create a SessionDescriptionInterface from a parsed cricket::SessionDescription other than depending on JsepSessionDescription. Bug: webrtc:9544 Change-Id: I3eec87b24aa005e6cbc4a018ad452c0d6823435d Reviewed-on: https://webrtc-review.googlesource.com/90382 Reviewed-by: Seth Hampson <shampson@webrtc.org> Commit-Queue: Steve Anton <steveanton@webrtc.org> Cr-Commit-Position: refs/heads/master@{#24105}
This commit is contained in:
parent
a3df0f2d05
commit
d9e4a06374
@ -197,6 +197,14 @@ std::unique_ptr<SessionDescriptionInterface> CreateSessionDescription(
|
||||
const std::string& sdp,
|
||||
SdpParseError* error_out);
|
||||
|
||||
// Creates a SessionDescriptionInterface based on a parsed SDP structure and the
|
||||
// given type, ID and version.
|
||||
std::unique_ptr<SessionDescriptionInterface> CreateSessionDescription(
|
||||
SdpType type,
|
||||
const std::string& session_id,
|
||||
const std::string& session_version,
|
||||
std::unique_ptr<cricket::SessionDescription> description);
|
||||
|
||||
// CreateOffer and CreateAnswer callback interface.
|
||||
class CreateSessionDescriptionObserver : public rtc::RefCountInterface {
|
||||
public:
|
||||
|
||||
@ -167,6 +167,18 @@ std::unique_ptr<SessionDescriptionInterface> CreateSessionDescription(
|
||||
return std::move(jsep_desc);
|
||||
}
|
||||
|
||||
std::unique_ptr<SessionDescriptionInterface> CreateSessionDescription(
|
||||
SdpType type,
|
||||
const std::string& session_id,
|
||||
const std::string& session_version,
|
||||
std::unique_ptr<cricket::SessionDescription> description) {
|
||||
auto jsep_description = absl::make_unique<JsepSessionDescription>(type);
|
||||
bool initialize_success = jsep_description->Initialize(
|
||||
description.release(), session_id, session_version);
|
||||
RTC_DCHECK(initialize_success);
|
||||
return std::move(jsep_description);
|
||||
}
|
||||
|
||||
JsepSessionDescription::JsepSessionDescription(SdpType type) : type_(type) {}
|
||||
|
||||
JsepSessionDescription::JsepSessionDescription(const std::string& type) {
|
||||
|
||||
@ -3200,10 +3200,11 @@ TEST_P(PeerConnectionInterfaceTest,
|
||||
std::unique_ptr<SessionDescriptionInterface> offer;
|
||||
ASSERT_TRUE(DoCreateOffer(&offer, nullptr));
|
||||
// Grab a copy of the offer before it gets passed into the PC.
|
||||
auto modified_offer = absl::make_unique<webrtc::JsepSessionDescription>(
|
||||
webrtc::SdpType::kOffer);
|
||||
modified_offer->Initialize(offer->description()->Copy(), offer->session_id(),
|
||||
offer->session_version());
|
||||
std::unique_ptr<SessionDescriptionInterface> modified_offer =
|
||||
webrtc::CreateSessionDescription(
|
||||
webrtc::SdpType::kOffer, offer->session_id(),
|
||||
offer->session_version(),
|
||||
absl::WrapUnique(offer->description()->Copy()));
|
||||
EXPECT_TRUE(DoSetLocalDescription(std::move(offer)));
|
||||
|
||||
auto senders = pc_->GetSenders();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user