summaryrefslogtreecommitdiffstats
path: root/third_party/libwebrtc/pc/dtls_transport.cc
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--third_party/libwebrtc/pc/dtls_transport.cc34
1 files changed, 19 insertions, 15 deletions
diff --git a/third_party/libwebrtc/pc/dtls_transport.cc b/third_party/libwebrtc/pc/dtls_transport.cc
index 15eed9e47b..4888d9f9e7 100644
--- a/third_party/libwebrtc/pc/dtls_transport.cc
+++ b/third_party/libwebrtc/pc/dtls_transport.cc
@@ -41,8 +41,18 @@ DtlsTransport::DtlsTransport(
}
DtlsTransport::~DtlsTransport() {
+ // TODO(tommi): Due to a reference being held by the RtpSenderBase
+ // implementation, the last reference to the `DtlsTransport` instance can
+ // be released on the signaling thread.
+ // RTC_DCHECK_RUN_ON(owner_thread_);
+
// We depend on the signaling thread to call Clear() before dropping
// its last reference to this object.
+
+ // If there are non `owner_thread_` references outstanding, and those
+ // references are the last ones released, we depend on Clear() having been
+ // called from the owner_thread before the last reference is deleted.
+ // `Clear()` is currently called from `JsepTransport::~JsepTransport`.
RTC_DCHECK(owner_thread_->IsCurrent() || !internal_dtls_transport_);
}
@@ -72,14 +82,8 @@ void DtlsTransport::Clear() {
RTC_DCHECK(internal());
bool must_send_event =
(internal()->dtls_state() != DtlsTransportState::kClosed);
- // The destructor of cricket::DtlsTransportInternal calls back
- // into DtlsTransport, so we can't hold the lock while releasing.
- std::unique_ptr<cricket::DtlsTransportInternal> transport_to_release;
- {
- MutexLock lock(&lock_);
- transport_to_release = std::move(internal_dtls_transport_);
- ice_transport_->Clear();
- }
+ internal_dtls_transport_.reset();
+ ice_transport_->Clear();
UpdateInformation();
if (observer_ && must_send_event) {
observer_->OnStateChange(Information());
@@ -100,7 +104,6 @@ void DtlsTransport::OnInternalDtlsState(
void DtlsTransport::UpdateInformation() {
RTC_DCHECK_RUN_ON(owner_thread_);
- MutexLock lock(&lock_);
if (internal_dtls_transport_) {
if (internal_dtls_transport_->dtls_state() ==
DtlsTransportState::kConnected) {
@@ -125,23 +128,24 @@ void DtlsTransport::UpdateInformation() {
success &= internal_dtls_transport_->GetSslCipherSuite(&ssl_cipher_suite);
success &= internal_dtls_transport_->GetSrtpCryptoSuite(&srtp_cipher);
if (success) {
- info_ = DtlsTransportInformation(
+ set_info(DtlsTransportInformation(
internal_dtls_transport_->dtls_state(), role, tls_version,
ssl_cipher_suite, srtp_cipher,
- internal_dtls_transport_->GetRemoteSSLCertChain());
+ internal_dtls_transport_->GetRemoteSSLCertChain()));
} else {
RTC_LOG(LS_ERROR) << "DtlsTransport in connected state has incomplete "
"TLS information";
- info_ = DtlsTransportInformation(
+ set_info(DtlsTransportInformation(
internal_dtls_transport_->dtls_state(), role, absl::nullopt,
absl::nullopt, absl::nullopt,
- internal_dtls_transport_->GetRemoteSSLCertChain());
+ internal_dtls_transport_->GetRemoteSSLCertChain()));
}
} else {
- info_ = DtlsTransportInformation(internal_dtls_transport_->dtls_state());
+ set_info(
+ DtlsTransportInformation(internal_dtls_transport_->dtls_state()));
}
} else {
- info_ = DtlsTransportInformation(DtlsTransportState::kClosed);
+ set_info(DtlsTransportInformation(DtlsTransportState::kClosed));
}
}