mirror of
https://github.com/mollyim/webrtc.git
synced 2025-05-13 05:40:42 +01:00
Convert P2PtransportChannel.GatheringState to CallbackList
Earlier attempts have shown that this signal is multiply listened to. Bug: webrtc:11943 Change-Id: I382df9a554925d214872d788c5d7a36f2f7c7b7e Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/348661 Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org> Commit-Queue: Harald Alvestrand <hta@webrtc.org> Cr-Commit-Position: refs/heads/main@{#42139}
This commit is contained in:
parent
5bd0a32859
commit
6f170a05dc
2 changed files with 11 additions and 9 deletions
|
@ -306,10 +306,14 @@ class RTC_EXPORT IceTransportInternal : public rtc::PacketTransportInternal {
|
|||
|
||||
// Signal Exposed for backwards compatibility.
|
||||
sigslot::signal1<IceTransportInternal*> SignalGatheringState;
|
||||
void SetGatheringStateCallback(
|
||||
void AddGatheringStateCallback(
|
||||
const void* removal_tag,
|
||||
absl::AnyInvocable<void(IceTransportInternal*)> callback) {
|
||||
RTC_DCHECK(!gathering_state_callback_);
|
||||
gathering_state_callback_ = std::move(callback);
|
||||
gathering_state_callback_list_.AddReceiver(removal_tag,
|
||||
std::move(callback));
|
||||
}
|
||||
void RemoveGatheringStateCallback(const void* removal_tag) {
|
||||
gathering_state_callback_list_.RemoveReceivers(removal_tag);
|
||||
}
|
||||
|
||||
// Handles sending and receiving of candidates.
|
||||
|
@ -393,7 +397,7 @@ class RTC_EXPORT IceTransportInternal : public rtc::PacketTransportInternal {
|
|||
webrtc::CallbackList<IceTransportInternal*, const StunDictionaryWriter&>
|
||||
dictionary_writer_synced_callback_list_;
|
||||
|
||||
absl::AnyInvocable<void(IceTransportInternal*)> gathering_state_callback_;
|
||||
webrtc::CallbackList<IceTransportInternal*> gathering_state_callback_list_;
|
||||
|
||||
absl::AnyInvocable<void(IceTransportInternal*, const IceCandidateErrorEvent&)>
|
||||
candidate_error_callback_;
|
||||
|
@ -407,9 +411,7 @@ class RTC_EXPORT IceTransportInternal : public rtc::PacketTransportInternal {
|
|||
private:
|
||||
// TODO(bugs.webrtc.org/11943): remove when removing Signal
|
||||
void SignalGatheringStateFired(IceTransportInternal* transport) {
|
||||
if (gathering_state_callback_) {
|
||||
gathering_state_callback_(transport);
|
||||
}
|
||||
gathering_state_callback_list_.Send(transport);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -439,8 +439,8 @@ JsepTransportController::CreateDtlsTransport(
|
|||
this, &JsepTransportController::OnTransportWritableState_n);
|
||||
dtls->SignalReceivingState.connect(
|
||||
this, &JsepTransportController::OnTransportReceivingState_n);
|
||||
dtls->ice_transport()->SetGatheringStateCallback(
|
||||
[this](cricket::IceTransportInternal* transport) {
|
||||
dtls->ice_transport()->AddGatheringStateCallback(
|
||||
this, [this](cricket::IceTransportInternal* transport) {
|
||||
RTC_DCHECK_RUN_ON(network_thread_);
|
||||
OnTransportGatheringState_n(transport);
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue