Move a part of ApplyRemoteDescription() into a separate function.
This part is specific to unified plan and doesn't need most of the state related to the remote description (and doesn't return an error). Bug: none Change-Id: I0de66bdb2e925072a6d9010e4444e75d4574ae04 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/245102 Reviewed-by: Danil Chapovalov <danilchap@webrtc.org> Auto-Submit: Tomas Gunnarsson <tommi@webrtc.org> Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org> Cr-Commit-Position: refs/heads/main@{#35642}
This commit is contained in:

committed by
WebRTC LUCI CQ

parent
b625edfa47
commit
651586c4e1
@ -1678,6 +1678,41 @@ RTCError SdpOfferAnswerHandler::ApplyRemoteDescription(
|
||||
}
|
||||
|
||||
if (is_unified_plan) {
|
||||
ApplyRemoteDescriptionUpdateTransceiverState(type);
|
||||
}
|
||||
|
||||
const cricket::AudioContentDescription* audio_desc =
|
||||
GetFirstAudioContentDescription(remote_description()->description());
|
||||
const cricket::VideoContentDescription* video_desc =
|
||||
GetFirstVideoContentDescription(remote_description()->description());
|
||||
|
||||
// Check if the descriptions include streams, just in case the peer supports
|
||||
// MSID, but doesn't indicate so with "a=msid-semantic".
|
||||
if (remote_description()->description()->msid_supported() ||
|
||||
(audio_desc && !audio_desc->streams().empty()) ||
|
||||
(video_desc && !video_desc->streams().empty())) {
|
||||
remote_peer_supports_msid_ = true;
|
||||
}
|
||||
|
||||
if (!is_unified_plan) {
|
||||
PlanBUpdateSendersAndReceivers(
|
||||
GetFirstAudioContent(remote_description()->description()), audio_desc,
|
||||
GetFirstVideoContent(remote_description()->description()), video_desc);
|
||||
}
|
||||
|
||||
if (type == SdpType::kAnswer &&
|
||||
local_ice_credentials_to_replace_->SatisfiesIceRestart(
|
||||
*current_local_description_)) {
|
||||
local_ice_credentials_to_replace_->ClearIceCredentials();
|
||||
}
|
||||
|
||||
return RTCError::OK();
|
||||
}
|
||||
|
||||
void SdpOfferAnswerHandler::ApplyRemoteDescriptionUpdateTransceiverState(
|
||||
SdpType sdp_type) {
|
||||
RTC_DCHECK_RUN_ON(signaling_thread());
|
||||
RTC_DCHECK(IsUnifiedPlan());
|
||||
std::vector<rtc::scoped_refptr<RtpTransceiverInterface>>
|
||||
now_receiving_transceivers;
|
||||
std::vector<rtc::scoped_refptr<RtpTransceiverInterface>> remove_list;
|
||||
@ -1717,8 +1752,7 @@ RTCError SdpOfferAnswerHandler::ApplyRemoteDescription(
|
||||
// process the addition of a remote track for the media description.
|
||||
if (!transceiver->fired_direction() ||
|
||||
!RtpTransceiverDirectionHasRecv(*transceiver->fired_direction())) {
|
||||
RTC_LOG(LS_INFO)
|
||||
<< "Processing the addition of a remote track for MID="
|
||||
RTC_LOG(LS_INFO) << "Processing the addition of a remote track for MID="
|
||||
<< content->name << ".";
|
||||
// Since the transceiver is passed to the user in an
|
||||
// OnTrack event, we must use the proxied transceiver.
|
||||
@ -1739,15 +1773,14 @@ RTCError SdpOfferAnswerHandler::ApplyRemoteDescription(
|
||||
transceiver->set_fired_direction(local_direction);
|
||||
// 2.2.8.1.11: If description is of type "answer" or "pranswer", then run
|
||||
// the following steps:
|
||||
if (type == SdpType::kPrAnswer || type == SdpType::kAnswer) {
|
||||
if (sdp_type == SdpType::kPrAnswer || sdp_type == SdpType::kAnswer) {
|
||||
// 2.2.8.1.11.1: Set transceiver's [[CurrentDirection]] slot to
|
||||
// direction.
|
||||
transceiver->set_current_direction(local_direction);
|
||||
// 2.2.8.1.11.[3-6]: Set the transport internal slots.
|
||||
if (transceiver->mid()) {
|
||||
auto dtls_transport = LookupDtlsTransportByMid(pc_->network_thread(),
|
||||
transport_controller(),
|
||||
*transceiver->mid());
|
||||
auto dtls_transport = LookupDtlsTransportByMid(
|
||||
pc_->network_thread(), transport_controller(), *transceiver->mid());
|
||||
transceiver->sender_internal()->set_transport(dtls_transport);
|
||||
transceiver->receiver_internal()->set_transport(dtls_transport);
|
||||
}
|
||||
@ -1759,8 +1792,7 @@ RTCError SdpOfferAnswerHandler::ApplyRemoteDescription(
|
||||
<< " since the media section was rejected.";
|
||||
transceiver->StopTransceiverProcedure();
|
||||
}
|
||||
if (!content->rejected &&
|
||||
RtpTransceiverDirectionHasRecv(local_direction)) {
|
||||
if (!content->rejected && RtpTransceiverDirectionHasRecv(local_direction)) {
|
||||
if (!media_desc->streams().empty() &&
|
||||
media_desc->streams()[0].has_ssrcs()) {
|
||||
uint32_t ssrc = media_desc->streams()[0].first_ssrc();
|
||||
@ -1789,34 +1821,6 @@ RTCError SdpOfferAnswerHandler::ApplyRemoteDescription(
|
||||
}
|
||||
}
|
||||
|
||||
const cricket::AudioContentDescription* audio_desc =
|
||||
GetFirstAudioContentDescription(remote_description()->description());
|
||||
const cricket::VideoContentDescription* video_desc =
|
||||
GetFirstVideoContentDescription(remote_description()->description());
|
||||
|
||||
// Check if the descriptions include streams, just in case the peer supports
|
||||
// MSID, but doesn't indicate so with "a=msid-semantic".
|
||||
if (remote_description()->description()->msid_supported() ||
|
||||
(audio_desc && !audio_desc->streams().empty()) ||
|
||||
(video_desc && !video_desc->streams().empty())) {
|
||||
remote_peer_supports_msid_ = true;
|
||||
}
|
||||
|
||||
if (!is_unified_plan) {
|
||||
PlanBUpdateSendersAndReceivers(
|
||||
GetFirstAudioContent(remote_description()->description()), audio_desc,
|
||||
GetFirstVideoContent(remote_description()->description()), video_desc);
|
||||
}
|
||||
|
||||
if (type == SdpType::kAnswer &&
|
||||
local_ice_credentials_to_replace_->SatisfiesIceRestart(
|
||||
*current_local_description_)) {
|
||||
local_ice_credentials_to_replace_->ClearIceCredentials();
|
||||
}
|
||||
|
||||
return RTCError::OK();
|
||||
}
|
||||
|
||||
void SdpOfferAnswerHandler::PlanBUpdateSendersAndReceivers(
|
||||
const cricket::ContentInfo* audio_content,
|
||||
const cricket::AudioContentDescription* audio_desc,
|
||||
|
@ -236,6 +236,9 @@ class SdpOfferAnswerHandler : public SdpStateProvider,
|
||||
const std::map<std::string, const cricket::ContentGroup*>&
|
||||
bundle_groups_by_mid);
|
||||
|
||||
// Part of ApplyRemoteDescription steps specific to Unified Plan.
|
||||
void ApplyRemoteDescriptionUpdateTransceiverState(SdpType sdp_type);
|
||||
|
||||
// Part of ApplyRemoteDescription steps specific to plan b.
|
||||
void PlanBUpdateSendersAndReceivers(
|
||||
const cricket::ContentInfo* audio_content,
|
||||
|
Reference in New Issue
Block a user