Move have_pending_rtp_data_channel_ to sdp_offer_answer
Also use accessors for the last few member variable references in PeerConnection. This completes removing the variable accesses from SdpOfferAnswerHandler to PeerConnection. Bug: webrtc:11995 Change-Id: I70c78b43035c15f20559f7a6a5b50c3a613fe907 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/186200 Reviewed-by: Björn Terelius <terelius@webrtc.org> Commit-Queue: Harald Alvestrand <hta@webrtc.org> Cr-Commit-Position: refs/heads/master@{#32272}
This commit is contained in:

committed by
Commit Bot

parent
c06e374a55
commit
75b9ab6751
@ -3925,7 +3925,7 @@ bool PeerConnection::CreateDataChannel(const std::string& mid) {
|
||||
this, &PeerConnection::OnSentPacket_w);
|
||||
data_channel_controller_.rtp_data_channel()->SetRtpTransport(
|
||||
rtp_transport);
|
||||
have_pending_rtp_data_channel_ = true;
|
||||
sdp_handler_.SetHavePendingRtpDataChannel();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -683,7 +683,8 @@ class PeerConnection : public PeerConnectionInternal,
|
||||
// to the user. If this is false, Plan B semantics are assumed.
|
||||
// TODO(bugs.webrtc.org/8530): Flip the default to be Unified Plan once
|
||||
// sufficient time has passed.
|
||||
bool IsUnifiedPlan() const RTC_RUN_ON(signaling_thread()) {
|
||||
bool IsUnifiedPlan() const {
|
||||
RTC_DCHECK_RUN_ON(signaling_thread());
|
||||
return configuration_.sdp_semantics == SdpSemantics::kUnifiedPlan;
|
||||
}
|
||||
|
||||
@ -1048,9 +1049,6 @@ class PeerConnection : public PeerConnectionInternal,
|
||||
RTC_GUARDED_BY(signaling_thread()); // A pointer is passed to senders_
|
||||
rtc::scoped_refptr<RTCStatsCollector> stats_collector_
|
||||
RTC_GUARDED_BY(signaling_thread());
|
||||
// Used when rolling back RTP data channels.
|
||||
bool have_pending_rtp_data_channel_ RTC_GUARDED_BY(signaling_thread()) =
|
||||
false;
|
||||
TransceiverList transceivers_;
|
||||
|
||||
// MIDs will be generated using this generator which will keep track of
|
||||
|
@ -2271,11 +2271,10 @@ RTCError SdpOfferAnswerHandler::UpdateSessionState(
|
||||
? PeerConnectionInterface::kHaveLocalPrAnswer
|
||||
: PeerConnectionInterface::kHaveRemotePrAnswer);
|
||||
} else {
|
||||
RTC_DCHECK_RUN_ON(pc_->signaling_thread());
|
||||
RTC_DCHECK(type == SdpType::kAnswer);
|
||||
ChangeSignalingState(PeerConnectionInterface::kStable);
|
||||
pc_->transceivers_.DiscardStableStates();
|
||||
pc_->have_pending_rtp_data_channel_ = false;
|
||||
have_pending_rtp_data_channel_ = false;
|
||||
}
|
||||
|
||||
// Update internal objects according to the session description's media
|
||||
@ -2378,14 +2377,11 @@ RTCError SdpOfferAnswerHandler::Rollback(SdpType desc_type) {
|
||||
transceiver->internal()->set_mline_index(state.mline_index());
|
||||
}
|
||||
pc_->transport_controller_->RollbackTransports();
|
||||
{
|
||||
RTC_DCHECK_RUN_ON(pc_->signaling_thread());
|
||||
if (pc_->have_pending_rtp_data_channel_) {
|
||||
pc_->DestroyDataChannelTransport();
|
||||
pc_->have_pending_rtp_data_channel_ = false;
|
||||
}
|
||||
pc_->transceivers_.DiscardStableStates();
|
||||
if (have_pending_rtp_data_channel_) {
|
||||
pc_->DestroyDataChannelTransport();
|
||||
have_pending_rtp_data_channel_ = false;
|
||||
}
|
||||
pc_->transceivers_.DiscardStableStates();
|
||||
pending_local_description_.reset();
|
||||
pending_remote_description_.reset();
|
||||
ChangeSignalingState(PeerConnectionInterface::kStable);
|
||||
@ -2416,7 +2412,6 @@ RTCError SdpOfferAnswerHandler::Rollback(SdpType desc_type) {
|
||||
}
|
||||
|
||||
bool SdpOfferAnswerHandler::IsUnifiedPlan() const {
|
||||
RTC_DCHECK_RUN_ON(pc_->signaling_thread());
|
||||
return pc_->IsUnifiedPlan();
|
||||
}
|
||||
|
||||
@ -3030,8 +3025,8 @@ RTCError SdpOfferAnswerHandler::UpdateDataChannel(
|
||||
RTC_LOG(LS_INFO) << "Rejected data channel, mid=" << content.mid();
|
||||
pc_->DestroyDataChannelTransport();
|
||||
} else {
|
||||
if (!pc_->data_channel_controller_.rtp_data_channel() &&
|
||||
!pc_->data_channel_controller_.data_channel_transport()) {
|
||||
if (!pc_->data_channel_controller()->rtp_data_channel() &&
|
||||
!pc_->data_channel_controller()->data_channel_transport()) {
|
||||
RTC_LOG(LS_INFO) << "Creating data channel, mid=" << content.mid();
|
||||
if (!pc_->CreateDataChannel(content.name)) {
|
||||
LOG_AND_RETURN_ERROR(RTCErrorType::INTERNAL_ERROR,
|
||||
@ -3041,7 +3036,7 @@ RTCError SdpOfferAnswerHandler::UpdateDataChannel(
|
||||
if (source == cricket::CS_REMOTE) {
|
||||
const MediaContentDescription* data_desc = content.media_description();
|
||||
if (data_desc && cricket::IsRtpProtocol(data_desc->protocol())) {
|
||||
pc_->data_channel_controller_.UpdateRemoteRtpDataChannels(
|
||||
pc_->data_channel_controller()->UpdateRemoteRtpDataChannels(
|
||||
GetActiveStreams(data_desc));
|
||||
}
|
||||
}
|
||||
|
@ -130,6 +130,10 @@ class SdpOfferAnswerHandler {
|
||||
bool HasNewIceCredentials();
|
||||
bool IceRestartPending(const std::string& content_name) const;
|
||||
void UpdateNegotiationNeeded();
|
||||
void SetHavePendingRtpDataChannel() {
|
||||
RTC_DCHECK_RUN_ON(signaling_thread());
|
||||
have_pending_rtp_data_channel_ = true;
|
||||
}
|
||||
|
||||
// Returns the media section in the given session description that is
|
||||
// associated with the RtpTransceiver. Returns null if none found or this
|
||||
@ -362,6 +366,10 @@ class SdpOfferAnswerHandler {
|
||||
rtc::scoped_refptr<MediaStreamInterface> missing_msid_default_stream_
|
||||
RTC_GUARDED_BY(signaling_thread());
|
||||
|
||||
// Used when rolling back RTP data channels.
|
||||
bool have_pending_rtp_data_channel_ RTC_GUARDED_BY(signaling_thread()) =
|
||||
false;
|
||||
|
||||
rtc::WeakPtrFactory<SdpOfferAnswerHandler> weak_ptr_factory_
|
||||
RTC_GUARDED_BY(signaling_thread());
|
||||
};
|
||||
|
Reference in New Issue
Block a user