Replace IceTransportInternal::SignalCandidateError
with a callback function.
Bug: webrtc:11943
Change-Id: Ieed740a36f86be6dd45d6a495cc4fd023ea98477
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/328862
Reviewed-by: Per Kjellander <perkj@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#41249}
diff --git a/p2p/base/ice_transport_internal.h b/p2p/base/ice_transport_internal.h
index eb21596..d80dc99 100644
--- a/p2p/base/ice_transport_internal.h
+++ b/p2p/base/ice_transport_internal.h
@@ -310,8 +310,12 @@
sigslot::signal2<IceTransportInternal*, const Candidate&>
SignalCandidateGathered;
- sigslot::signal2<IceTransportInternal*, const IceCandidateErrorEvent&>
- SignalCandidateError;
+ void SetCandidateErrorCallback(
+ absl::AnyInvocable<void(IceTransportInternal*,
+ const IceCandidateErrorEvent&)> callback) {
+ RTC_DCHECK(!candidate_error_callback_);
+ candidate_error_callback_ = std::move(callback);
+ }
sigslot::signal2<IceTransportInternal*, const Candidates&>
SignalCandidatesRemoved;
@@ -372,6 +376,9 @@
dictionary_view_updated_callback_list_;
webrtc::CallbackList<IceTransportInternal*, const StunDictionaryWriter&>
dictionary_writer_synced_callback_list_;
+
+ absl::AnyInvocable<void(IceTransportInternal*, const IceCandidateErrorEvent&)>
+ candidate_error_callback_;
};
} // namespace cricket
diff --git a/p2p/base/p2p_transport_channel.cc b/p2p/base/p2p_transport_channel.cc
index 5ddab77..cb097c3 100644
--- a/p2p/base/p2p_transport_channel.cc
+++ b/p2p/base/p2p_transport_channel.cc
@@ -996,7 +996,9 @@
PortAllocatorSession* session,
const IceCandidateErrorEvent& event) {
RTC_DCHECK(network_thread_ == rtc::Thread::Current());
- SignalCandidateError(this, event);
+ if (candidate_error_callback_) {
+ candidate_error_callback_(this, event);
+ }
}
void P2PTransportChannel::OnCandidatesAllocationDone(
diff --git a/pc/jsep_transport_controller.cc b/pc/jsep_transport_controller.cc
index 2a701cc..a710cff 100644
--- a/pc/jsep_transport_controller.cc
+++ b/pc/jsep_transport_controller.cc
@@ -437,8 +437,12 @@
this, &JsepTransportController::OnTransportGatheringState_n);
dtls->ice_transport()->SignalCandidateGathered.connect(
this, &JsepTransportController::OnTransportCandidateGathered_n);
- dtls->ice_transport()->SignalCandidateError.connect(
- this, &JsepTransportController::OnTransportCandidateError_n);
+ dtls->ice_transport()->SetCandidateErrorCallback(
+ [this](cricket::IceTransportInternal* transport,
+ const cricket::IceCandidateErrorEvent& error) {
+ RTC_DCHECK_RUN_ON(network_thread_);
+ OnTransportCandidateError_n(transport, error);
+ });
dtls->ice_transport()->SignalCandidatesRemoved.connect(
this, &JsepTransportController::OnTransportCandidatesRemoved_n);
dtls->ice_transport()->SignalRoleConflict.connect(