Add support for JSEP offer/answer with transceivers
This change adds support to PeerConnection's CreateOffer/ CreateAnswer/SetLocalDescription/SetRemoteDescription for Unified Plan SDP mapping to/from RtpTransceivers. This behavior is enabled using the kUnifiedPlan SDP semantics in the PeerConnection configuration. Bug: webrtc:7600 Change-Id: I4b44f5d3690887d387bf9c47eac00db8ec974571 Reviewed-on: https://webrtc-review.googlesource.com/28341 Commit-Queue: Steve Anton <steveanton@webrtc.org> Reviewed-by: Peter Thatcher <pthatcher@webrtc.org> Cr-Commit-Position: refs/heads/master@{#21442}
This commit is contained in:
@ -179,6 +179,45 @@ bool PeerConnectionWrapper::SetSdp(
|
||||
return observer->result();
|
||||
}
|
||||
|
||||
bool PeerConnectionWrapper::ExchangeOfferAnswerWith(
|
||||
PeerConnectionWrapper* answerer) {
|
||||
RTC_DCHECK(answerer);
|
||||
if (answerer == this) {
|
||||
RTC_LOG(LS_ERROR) << "Cannot exchange offer/answer with ourself!";
|
||||
return false;
|
||||
}
|
||||
auto offer = CreateOffer();
|
||||
EXPECT_TRUE(offer);
|
||||
if (!offer) {
|
||||
return false;
|
||||
}
|
||||
bool set_local_offer =
|
||||
SetLocalDescription(CloneSessionDescription(offer.get()));
|
||||
EXPECT_TRUE(set_local_offer);
|
||||
if (!set_local_offer) {
|
||||
return false;
|
||||
}
|
||||
bool set_remote_offer = answerer->SetRemoteDescription(std::move(offer));
|
||||
EXPECT_TRUE(set_remote_offer);
|
||||
if (!set_remote_offer) {
|
||||
return false;
|
||||
}
|
||||
auto answer = answerer->CreateAnswer();
|
||||
EXPECT_TRUE(answer);
|
||||
if (!answer) {
|
||||
return false;
|
||||
}
|
||||
bool set_local_answer =
|
||||
answerer->SetLocalDescription(CloneSessionDescription(answer.get()));
|
||||
EXPECT_TRUE(set_local_answer);
|
||||
if (!set_local_answer) {
|
||||
return false;
|
||||
}
|
||||
bool set_remote_answer = SetRemoteDescription(std::move(answer));
|
||||
EXPECT_TRUE(set_remote_answer);
|
||||
return set_remote_answer;
|
||||
}
|
||||
|
||||
rtc::scoped_refptr<RtpTransceiverInterface>
|
||||
PeerConnectionWrapper::AddTransceiver(cricket::MediaType media_type) {
|
||||
RTCErrorOr<rtc::scoped_refptr<RtpTransceiverInterface>> result =
|
||||
|
||||
Reference in New Issue
Block a user