зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1626570 - Improve handling of copying arrays in media/webrtc/signaling/src/. r=bwc
Differential Revision: https://phabricator.services.mozilla.com/D72347
This commit is contained in:
Родитель
9600160bc6
Коммит
a673d9e93a
|
@ -115,7 +115,7 @@ int32_t WebrtcMediaDataDecoder::Decode(
|
|||
media::Await(
|
||||
do_AddRef(mThreadPool), mDecoder->Decode(compressedFrame),
|
||||
[&](const MediaDataDecoder::DecodedData& aResults) {
|
||||
mResults = aResults;
|
||||
mResults = aResults.Clone();
|
||||
mError = NS_OK;
|
||||
},
|
||||
[&](const MediaResult& aError) { mError = aError; });
|
||||
|
|
|
@ -520,10 +520,11 @@ void MediaTransportHandlerSTS::ActivateTransport(
|
|||
bool aPrivacyRequested) {
|
||||
mInitPromise->Then(
|
||||
mStsThread, __func__,
|
||||
[=, self = RefPtr<MediaTransportHandlerSTS>(this)]() {
|
||||
[=, keyDer = aKeyDer.Clone(), certDer = aCertDer.Clone(),
|
||||
self = RefPtr<MediaTransportHandlerSTS>(this)]() {
|
||||
MOZ_ASSERT(aComponentCount);
|
||||
RefPtr<DtlsIdentity> dtlsIdentity(
|
||||
DtlsIdentity::Deserialize(aKeyDer, aCertDer, aAuthType));
|
||||
DtlsIdentity::Deserialize(keyDer, certDer, aAuthType));
|
||||
if (!dtlsIdentity) {
|
||||
MOZ_ASSERT(false);
|
||||
return;
|
||||
|
@ -611,7 +612,8 @@ void MediaTransportHandlerSTS::StartIceGathering(
|
|||
const nsTArray<NrIceStunAddr>& aStunAddrs) {
|
||||
mInitPromise->Then(
|
||||
mStsThread, __func__,
|
||||
[=, self = RefPtr<MediaTransportHandlerSTS>(this)]() {
|
||||
[=, stunAddrs = aStunAddrs.Clone(),
|
||||
self = RefPtr<MediaTransportHandlerSTS>(this)]() {
|
||||
mObfuscateHostAddresses = aObfuscateHostAddresses;
|
||||
|
||||
// Belt and suspenders - in e10s mode, the call below to SetStunAddrs
|
||||
|
@ -620,8 +622,8 @@ void MediaTransportHandlerSTS::StartIceGathering(
|
|||
// just set them here, and only do it here.
|
||||
mIceCtx->SetCtxFlags(aDefaultRouteOnly);
|
||||
|
||||
if (aStunAddrs.Length()) {
|
||||
mIceCtx->SetStunAddrs(aStunAddrs);
|
||||
if (stunAddrs.Length()) {
|
||||
mIceCtx->SetStunAddrs(stunAddrs);
|
||||
}
|
||||
|
||||
// Start gathering, but only if there are streams
|
||||
|
|
|
@ -136,10 +136,12 @@ nsresult MediaTransportHandlerIPC::CreateIceCtx(
|
|||
|
||||
mInitPromise->Then(
|
||||
mCallbackThread, __func__,
|
||||
[=, self = RefPtr<MediaTransportHandlerIPC>(this)](bool /*dummy*/) {
|
||||
[=, iceServers = aIceServers.Clone(),
|
||||
self = RefPtr<MediaTransportHandlerIPC>(this)](bool /*dummy*/) {
|
||||
if (mChild) {
|
||||
CSFLogDebug(LOGTAG, "%s starting", __func__);
|
||||
if (!mChild->SendCreateIceCtx(aName, aIceServers, aIcePolicy)) {
|
||||
if (!mChild->SendCreateIceCtx(aName, std::move(iceServers),
|
||||
aIcePolicy)) {
|
||||
CSFLogError(LOGTAG, "%s failed!", __func__);
|
||||
}
|
||||
}
|
||||
|
@ -213,10 +215,11 @@ void MediaTransportHandlerIPC::StartIceGathering(
|
|||
const nsTArray<NrIceStunAddr>& aStunAddrs) {
|
||||
mInitPromise->Then(
|
||||
mCallbackThread, __func__,
|
||||
[=, self = RefPtr<MediaTransportHandlerIPC>(this)](bool /*dummy*/) {
|
||||
[=, stunAddrs = aStunAddrs.Clone(),
|
||||
self = RefPtr<MediaTransportHandlerIPC>(this)](bool /*dummy*/) {
|
||||
if (mChild) {
|
||||
mChild->SendStartIceGathering(aDefaultRouteOnly,
|
||||
aObfuscateHostAddresses, aStunAddrs);
|
||||
aObfuscateHostAddresses, stunAddrs);
|
||||
}
|
||||
},
|
||||
[](const nsCString& aError) {});
|
||||
|
@ -231,12 +234,13 @@ void MediaTransportHandlerIPC::ActivateTransport(
|
|||
bool aPrivacyRequested) {
|
||||
mInitPromise->Then(
|
||||
mCallbackThread, __func__,
|
||||
[=, self = RefPtr<MediaTransportHandlerIPC>(this)](bool /*dummy*/) {
|
||||
[=, keyDer = aKeyDer.Clone(), certDer = aCertDer.Clone(),
|
||||
self = RefPtr<MediaTransportHandlerIPC>(this)](bool /*dummy*/) {
|
||||
if (mChild) {
|
||||
mChild->SendActivateTransport(
|
||||
aTransportId, aLocalUfrag, aLocalPwd, aComponentCount, aUfrag,
|
||||
aPassword, aKeyDer, aCertDer, aAuthType, aDtlsClient, aDigests,
|
||||
aPrivacyRequested);
|
||||
mChild->SendActivateTransport(aTransportId, aLocalUfrag, aLocalPwd,
|
||||
aComponentCount, aUfrag, aPassword,
|
||||
keyDer, certDer, aAuthType, aDtlsClient,
|
||||
aDigests, aPrivacyRequested);
|
||||
}
|
||||
},
|
||||
[](const nsCString& aError) {});
|
||||
|
|
|
@ -1506,7 +1506,7 @@ already_AddRefed<dom::Promise> PeerConnectionImpl::GetStats(
|
|||
|
||||
void PeerConnectionImpl::GetRemoteStreams(
|
||||
nsTArray<RefPtr<DOMMediaStream>>& aStreamsOut) const {
|
||||
aStreamsOut = mReceiveStreams;
|
||||
aStreamsOut = mReceiveStreams.Clone();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -2583,11 +2583,12 @@ void PeerConnectionImpl::RecordConduitTelemetry() {
|
|||
}
|
||||
}
|
||||
|
||||
mSTSThread->Dispatch(NS_NewRunnableFunction(__func__, [conduits]() {
|
||||
for (const auto& conduit : conduits) {
|
||||
conduit->RecordTelemetry();
|
||||
}
|
||||
}));
|
||||
mSTSThread->Dispatch(
|
||||
NS_NewRunnableFunction(__func__, [conduits = std::move(conduits)]() {
|
||||
for (const auto& conduit : conduits) {
|
||||
conduit->RecordTelemetry();
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
template <class T>
|
||||
|
|
|
@ -69,7 +69,7 @@ void PeerConnectionMedia::StunAddrsHandler::OnStunAddrsAvailable(
|
|||
CSFLogInfo(LOGTAG, "%s: receiving (%d) stun addrs", __FUNCTION__,
|
||||
(int)addrs.Length());
|
||||
if (pcm_) {
|
||||
pcm_->mStunAddrs = addrs;
|
||||
pcm_->mStunAddrs = addrs.Clone();
|
||||
pcm_->mLocalAddrsRequestState = STUN_ADDR_REQUEST_COMPLETE;
|
||||
pcm_->FlushIceCtxOperationQueueIfReady();
|
||||
// If parent process returns 0 STUN addresses, change ICE connection
|
||||
|
|
Загрузка…
Ссылка в новой задаче