Bug 1626278: Move sigslot stuff to STS, and ensure we disconnect before releasing our ref to the MediaTransportHandler. r=mjf

This patch fixes an intermittent crash in pre-existing mochitests/wpt.

Differential Revision: https://phabricator.services.mozilla.com/D90626
This commit is contained in:
Byron Campen [:bwc] 2020-10-12 20:02:53 +00:00
Родитель 4e17277690
Коммит 414ee0525d
1 изменённых файлов: 17 добавлений и 5 удалений

Просмотреть файл

@ -89,10 +89,16 @@ TransceiverImpl::TransceiverImpl(
mTransmitPipeline->SetTrack(mSendTrack);
mTransportHandler->SignalStateChange.connect(
this, &TransceiverImpl::UpdateDtlsTransportState);
mTransportHandler->SignalRtcpStateChange.connect(
this, &TransceiverImpl::UpdateDtlsTransportState);
auto self = nsMainThreadPtrHandle<TransceiverImpl>(
new nsMainThreadPtrHolder<TransceiverImpl>(
"TransceiverImpl::TransceiverImpl::self", this, false));
mStsThread->Dispatch(
NS_NewRunnableFunction("TransceiverImpl::TransceiverImpl", [self] {
self->mTransportHandler->SignalStateChange.connect(
self.get(), &TransceiverImpl::UpdateDtlsTransportState);
self->mTransportHandler->SignalRtcpStateChange.connect(
self.get(), &TransceiverImpl::UpdateDtlsTransportState);
}));
}
TransceiverImpl::~TransceiverImpl() = default;
@ -168,7 +174,13 @@ void TransceiverImpl::Shutdown_m() {
}
Stop();
mTransmitPipeline = nullptr;
mTransportHandler = nullptr;
auto self = nsMainThreadPtrHandle<TransceiverImpl>(
new nsMainThreadPtrHolder<TransceiverImpl>(
"TransceiverImpl::Shutdown_m::self", this, false));
mStsThread->Dispatch(NS_NewRunnableFunction(__func__, [self] {
self->disconnect_all();
self->mTransportHandler = nullptr;
}));
}
nsresult TransceiverImpl::UpdateSendTrack(dom::MediaStreamTrack* aSendTrack) {