Remove DtlsHandShakeError and replace it with a Function Pointer.
- Remove the last sigslot from JsepTransportController. - Tested the potential test failure on chromium blink test by importing this CL to chromium source. Bug: webrtc:11943 Change-Id: I107d05606350aff655ca73a5cb640dff1a7036ee Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/202741 Reviewed-by: Harald Alvestrand <hta@webrtc.org> Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> Cr-Commit-Position: refs/heads/master@{#33085}
This commit is contained in:
@ -87,6 +87,7 @@ JsepTransportController::JsepTransportController(
|
|||||||
RTC_DCHECK(config_.transport_observer);
|
RTC_DCHECK(config_.transport_observer);
|
||||||
RTC_DCHECK(config_.rtcp_handler);
|
RTC_DCHECK(config_.rtcp_handler);
|
||||||
RTC_DCHECK(config_.ice_transport_factory);
|
RTC_DCHECK(config_.ice_transport_factory);
|
||||||
|
RTC_DCHECK(config_.on_dtls_handshake_error_);
|
||||||
}
|
}
|
||||||
|
|
||||||
JsepTransportController::~JsepTransportController() {
|
JsepTransportController::~JsepTransportController() {
|
||||||
@ -1411,7 +1412,7 @@ void JsepTransportController::OnRtcpPacketReceived_n(
|
|||||||
|
|
||||||
void JsepTransportController::OnDtlsHandshakeError(
|
void JsepTransportController::OnDtlsHandshakeError(
|
||||||
rtc::SSLHandshakeError error) {
|
rtc::SSLHandshakeError error) {
|
||||||
SignalDtlsHandshakeError(error);
|
config_.on_dtls_handshake_error_(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace webrtc
|
} // namespace webrtc
|
||||||
|
|||||||
@ -103,6 +103,7 @@ class JsepTransportController : public sigslot::has_slots<> {
|
|||||||
|
|
||||||
// Factory for SCTP transports.
|
// Factory for SCTP transports.
|
||||||
SctpTransportFactoryInterface* sctp_factory = nullptr;
|
SctpTransportFactoryInterface* sctp_factory = nullptr;
|
||||||
|
std::function<void(const rtc::SSLHandshakeError)> on_dtls_handshake_error_;
|
||||||
};
|
};
|
||||||
|
|
||||||
// The ICE related events are signaled on the |signaling_thread|.
|
// The ICE related events are signaled on the |signaling_thread|.
|
||||||
@ -192,8 +193,6 @@ class JsepTransportController : public sigslot::has_slots<> {
|
|||||||
// and deletes unused transports, but doesn't consider anything more complex.
|
// and deletes unused transports, but doesn't consider anything more complex.
|
||||||
void RollbackTransports();
|
void RollbackTransports();
|
||||||
|
|
||||||
sigslot::signal1<rtc::SSLHandshakeError> SignalDtlsHandshakeError;
|
|
||||||
|
|
||||||
// F: void(const std::string&, const std::vector<cricket::Candidate>&)
|
// F: void(const std::string&, const std::vector<cricket::Candidate>&)
|
||||||
template <typename F>
|
template <typename F>
|
||||||
void SubscribeIceCandidateGathered(F&& callback) {
|
void SubscribeIceCandidateGathered(F&& callback) {
|
||||||
|
|||||||
@ -82,6 +82,7 @@ class JsepTransportControllerTest : public JsepTransportController::Observer,
|
|||||||
int64_t packet_time_us) { RTC_NOTREACHED(); };
|
int64_t packet_time_us) { RTC_NOTREACHED(); };
|
||||||
config.ice_transport_factory = fake_ice_transport_factory_.get();
|
config.ice_transport_factory = fake_ice_transport_factory_.get();
|
||||||
config.dtls_transport_factory = fake_dtls_transport_factory_.get();
|
config.dtls_transport_factory = fake_dtls_transport_factory_.get();
|
||||||
|
config.on_dtls_handshake_error_ = [](rtc::SSLHandshakeError s) {};
|
||||||
transport_controller_ = std::make_unique<JsepTransportController>(
|
transport_controller_ = std::make_unique<JsepTransportController>(
|
||||||
signaling_thread, network_thread, port_allocator,
|
signaling_thread, network_thread, port_allocator,
|
||||||
nullptr /* async_resolver_factory */, config);
|
nullptr /* async_resolver_factory */, config);
|
||||||
|
|||||||
@ -453,7 +453,8 @@ PeerConnection::PeerConnection(
|
|||||||
call_(std::move(call)),
|
call_(std::move(call)),
|
||||||
call_ptr_(call_.get()),
|
call_ptr_(call_.get()),
|
||||||
data_channel_controller_(this),
|
data_channel_controller_(this),
|
||||||
message_handler_(signaling_thread()) {}
|
message_handler_(signaling_thread()),
|
||||||
|
weak_factory_(this) {}
|
||||||
|
|
||||||
PeerConnection::~PeerConnection() {
|
PeerConnection::~PeerConnection() {
|
||||||
TRACE_EVENT0("webrtc", "PeerConnection::~PeerConnection");
|
TRACE_EVENT0("webrtc", "PeerConnection::~PeerConnection");
|
||||||
@ -602,18 +603,22 @@ RTCError PeerConnection::Initialize(
|
|||||||
}
|
}
|
||||||
|
|
||||||
config.ice_transport_factory = ice_transport_factory_.get();
|
config.ice_transport_factory = ice_transport_factory_.get();
|
||||||
|
config.on_dtls_handshake_error_ =
|
||||||
|
[weak_ptr = weak_factory_.GetWeakPtr()](rtc::SSLHandshakeError s) {
|
||||||
|
if (weak_ptr) {
|
||||||
|
weak_ptr->OnTransportControllerDtlsHandshakeError(s);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
transport_controller_.reset(new JsepTransportController(
|
transport_controller_.reset(new JsepTransportController(
|
||||||
signaling_thread(), network_thread(), port_allocator_.get(),
|
signaling_thread(), network_thread(), port_allocator_.get(),
|
||||||
async_resolver_factory_.get(), config));
|
async_resolver_factory_.get(), config));
|
||||||
|
|
||||||
transport_controller_->SignalDtlsHandshakeError.connect(
|
// The following RTC_DCHECKs are added by looking at the caller thread.
|
||||||
this, &PeerConnection::OnTransportControllerDtlsHandshakeError);
|
|
||||||
|
|
||||||
// Following RTC_DCHECKs are added by looking at the caller thread.
|
|
||||||
// If this is incorrect there might not be test failures
|
// If this is incorrect there might not be test failures
|
||||||
// due to lack of unit tests which trigger these scenarios.
|
// due to lack of unit tests which trigger these scenarios.
|
||||||
// TODO(bugs.webrtc.org/12160): Remove above comments.
|
// TODO(bugs.webrtc.org/12160): Remove above comments.
|
||||||
|
// callbacks for signaling_thread.
|
||||||
transport_controller_->SubscribeIceConnectionState(
|
transport_controller_->SubscribeIceConnectionState(
|
||||||
[this](cricket::IceConnectionState s) {
|
[this](cricket::IceConnectionState s) {
|
||||||
RTC_DCHECK_RUN_ON(signaling_thread());
|
RTC_DCHECK_RUN_ON(signaling_thread());
|
||||||
|
|||||||
@ -692,6 +692,8 @@ class PeerConnection : public PeerConnectionInternal,
|
|||||||
// Administration of senders, receivers and transceivers
|
// Administration of senders, receivers and transceivers
|
||||||
// Accessed on both signaling and network thread. Const after Initialize().
|
// Accessed on both signaling and network thread. Const after Initialize().
|
||||||
std::unique_ptr<RtpTransmissionManager> rtp_manager_;
|
std::unique_ptr<RtpTransmissionManager> rtp_manager_;
|
||||||
|
|
||||||
|
rtc::WeakPtrFactory<PeerConnection> weak_factory_;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace webrtc
|
} // namespace webrtc
|
||||||
|
|||||||
Reference in New Issue
Block a user