Replace IcetransportInternal::SignalCandidatesRemoved sigslot

with an one-user callback.

Bug: webrtc:11943
Change-Id: Ia61c7811f0058fa7238d47ef13fadfd547f052ce
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/328900
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Per Kjellander <perkj@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#41250}
This commit is contained in:
Harald Alvestrand 2023-11-27 13:43:07 +00:00 committed by WebRTC LUCI CQ
parent 50a238fbd4
commit abc5066bd9
4 changed files with 22 additions and 7 deletions

View File

@ -317,8 +317,12 @@ class RTC_EXPORT IceTransportInternal : public rtc::PacketTransportInternal {
candidate_error_callback_ = std::move(callback);
}
sigslot::signal2<IceTransportInternal*, const Candidates&>
SignalCandidatesRemoved;
void SetCandidatesRemovedCallback(
absl::AnyInvocable<void(IceTransportInternal*, const Candidates&)>
callback) {
RTC_DCHECK(!candidates_removed_callback_);
candidates_removed_callback_ = std::move(callback);
}
// Deprecated by PacketTransportInternal::SignalNetworkRouteChanged.
// This signal occurs when there is a change in the way that packets are
@ -379,6 +383,9 @@ class RTC_EXPORT IceTransportInternal : public rtc::PacketTransportInternal {
absl::AnyInvocable<void(IceTransportInternal*, const IceCandidateErrorEvent&)>
candidate_error_callback_;
absl::AnyInvocable<void(IceTransportInternal*, const Candidates&)>
candidates_removed_callback_;
};
} // namespace cricket

View File

@ -2202,7 +2202,9 @@ void P2PTransportChannel::OnCandidatesRemoved(
candidate.set_transport_name(transport_name());
candidates_to_remove.push_back(candidate);
}
SignalCandidatesRemoved(this, candidates_to_remove);
if (candidates_removed_callback_) {
candidates_removed_callback_(this, candidates_to_remove);
}
}
void P2PTransportChannel::PruneAllPorts() {

View File

@ -488,8 +488,10 @@ class P2PTransportChannelTestBase : public ::testing::Test,
this, &P2PTransportChannelTestBase::OnReadyToSend);
channel->SignalCandidateGathered.connect(
this, &P2PTransportChannelTestBase::OnCandidateGathered);
channel->SignalCandidatesRemoved.connect(
this, &P2PTransportChannelTestBase::OnCandidatesRemoved);
channel->SetCandidatesRemovedCallback(
[this](IceTransportInternal* transport, const Candidates& candidates) {
OnCandidatesRemoved(transport, candidates);
});
channel->SignalReadPacket.connect(
this, &P2PTransportChannelTestBase::OnReadPacket);
channel->SignalRoleConflict.connect(

View File

@ -443,8 +443,12 @@ JsepTransportController::CreateDtlsTransport(
RTC_DCHECK_RUN_ON(network_thread_);
OnTransportCandidateError_n(transport, error);
});
dtls->ice_transport()->SignalCandidatesRemoved.connect(
this, &JsepTransportController::OnTransportCandidatesRemoved_n);
dtls->ice_transport()->SetCandidatesRemovedCallback(
[this](cricket::IceTransportInternal* transport,
const cricket::Candidates& candidates) {
RTC_DCHECK_RUN_ON(network_thread_);
OnTransportCandidatesRemoved_n(transport, candidates);
});
dtls->ice_transport()->SignalRoleConflict.connect(
this, &JsepTransportController::OnTransportRoleConflict_n);
dtls->ice_transport()->SignalStateChanged.connect(