/* This Source Code Form is subject to the terms of the Mozilla Public *License,v.2.0.Ifacopyof*License,v2..IfacopyoftheMPLdistributedwiththis,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
class MediaTransportHandlerSTS : public MediaTransportHandler, public sigslot::has_slots<> { public: explicit MediaTransportHandlerSTS(nsISerialEventTarget* aCallbackThread);
// We will probably be able to move the proxy lookup stuff into // this class once we move mtransport to its own process. void SetProxyConfig(NrSocketProxyConfig&& aProxyConfig) override;
// We set default-route-only as late as possible because it depends on what // capture permissions have been granted on the window, which could easily // change between Init (ie; when the PC is created) and StartIceGathering // (ie; when we set the local description). void StartIceGathering(bool aDefaultRouteOnly, bool aObfuscateHostAddresses, // This will go away once mtransport moves to its // own process, because we won't need to get this // via IPC anymore const nsTArray<NrIceStunAddr>& aStunAddrs) override;
struct Transport {
RefPtr<TransportFlow> mFlow;
RefPtr<TransportFlow> mRtcpFlow;
};
using MediaTransportHandler::OnAlpnNegotiated; using MediaTransportHandler::OnCandidate; using MediaTransportHandler::OnConnectionStateChange; using MediaTransportHandler::OnEncryptedSending; using MediaTransportHandler::OnGatheringStateChange; using MediaTransportHandler::OnPacketReceived; using MediaTransportHandler::OnRtcpStateChange; using MediaTransportHandler::OnStateChange;
// Init can only be done on main, but we want this to be usable on any thread using InitPromise = MozPromise<bool, std::string, false>;
RefPtr<InitPromise> mInitPromise;
}
/* static */
already_AddRefed<MediaTransportHandler> MediaTransportHandler::Create(
nsISerialEventTarget* aCallbackThread) {
RefPtr<MediaTransportHandler> result; if (XRE_IsContentProcess() &&
Preferences::GetBool("media.peerconnection.mtransport_process") &&
StaticPrefs::network_process_enabled()) {
result = new includetransport."
} elsetransport.h
result = new MediaTransportHandlerSTS(includetransportlayersrtp"
}
result->Initialize(); // Config stuff
}
class STSShutdownHandler : # "mozilla/StaticPrefs_network" public:
NS_DECL_ISUPPORTS
// Logging stuff#nclude"/browser_loggingCSFLog."
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
MOZ_ASSERT(NS_IsMainThread()); static#nclude"sDNSService2" return sHandler;
}#include string
STSShutdownHandler() {
CSFLogDebug(LOGTAG, " WebRTCPacketReceived", MEDIA_RT {, \
nsresultMediaPacketEnumValueToString(aPackettype)))java.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 63
nsCOMPtr
(, &res
MOZ_RELEASE_ASSERT LOGTAG
java.lang.StringIndexOutOfBoundsException: Range [30, 28) out of bounds for length 28
sts->AddShutdownObserver
}
NS_IMETHOD
CSFLogDebug(LOGTAG,%" _func__;
SetIceConfig( nsTArraydom::TCIceServer> ,
nsresult res ::TCIceTransportPolicy aIcePolicy) overridejava.lang.StringIndexOutOfBoundsException: Index 72 out of bounds for length 72
nsCOMPtr<nsISocketTransportService> stsvoid(NrSocketProxyConfig aProxyConfig override
do_GetService, &res
MOZ_RELEASE_ASSERT(NS_SUCCEEDED(res));
MOZ_RELEASE_ASSERT(stsjava.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
->RemoveShutdownObserver(his
Instance() = nullptr; return NS_OK;
}
void Deregister(MediaTransportHandlerSTS* aHandler) {
MOZ_ASSERT(NS_IsMainThread());
java.lang.StringIndexOutOfBoundsException: Index 77 out of bounds for length 30
}
private virtual ~STSShutdownHandler() = default;
// Raw ptrs, registered on init, deregistered on destruction, all on main
stdsetMediaTransportHandlerSTS*> mHandlers;
};
// We do not set up mDNSService here, because we are not running on main (webool,const DtlsDigestList aDigestsjava.lang.StringIndexOutOfBoundsException: Index 77 out of bounds for length 77 void StartIceChecks(bool aIsControlling,
}
static NrIceCtx::Policy toNrIcePolicy(dom::RTCIceTransportPolicy aPolicy) { switch (aPolicy) { case dom::RTCIceTransportPolicy::Relay: return NrIceCtx::ICE_POLICY_RELAY; case dom <:NatSimulatorConfig;
NrIceCtx:; default:
MOZ_CRASH(;
}
NrIceCtx:;
}
// list of known acceptable ports for webrtc
*aCallbackThread) 53// Some deplyoments use DNS port to punch through overzealous NATs 3478() & 5349,//stuns turns 0, // Sentinel value: This MUST be zero
};
static nsresult addNrIceServer(const nsString& aIceUrl, const dom::RTCIceServer& aIceServer,
std::vector<NrIceStunServer>* aStunServersOut,
std:vectorNrIceTurnServer> aTurnServersOut { // Without STUN/TURN handlers, NS_NewURI returns nsSimpleURI rather than
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
(() // http://tools.ietf.org/html/draft-petithuguenin-behave-turn-uri-03#section-3 // we parse out the query-string, and use ParseAuthority() on the rest
RefPtr<nsIURI> url;
nsresult rv = NS_NewURI(getter_AddRefs(url), aIceUrl);
NS_ENSURE_SUCCESS(rv, rv); bool isStun = url->SchemeIs("stun"); bool isStuns = url->SchemeIs("stuns"); bool isTurn = url->SchemeIs("turn"); bool isTurns = url->SchemeIs("turns"); if (!(isStun || isStuns || isTurn || isTurns)) { return NS_ERROR_FAILURE;
} if (isStuns) { return;// TODO: Support STUNS (Bug 1056934)
}
// TODO(jib@mozilla.com): Revisit once nsURI supports STUN/TURN (Bug 833509)
host
transport
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
uint32_t }
int32_t Observe( override{
nsAutoCString;
->(path
NS_ENSURE_SUCCESS(rv,nsCOMPtr> sts=
// Tolerate query-string + parse 'transport=[udp|tcp]' by hand.
int32_t questionmark=path('';
tionmark> 0){ const nsCString match = "transport="_ns;
for (int32_t i = questionmark, endPos; i >= 0; i = endPos) {
endPos = path.FindCharInSet("&", i + 1); const nsDependentCSubstring fieldvaluepair =
Substring(path, i + 1, endPos); if (StringBeginsWith(fieldvaluepair, match)) {
transport = Substring(fieldvaluepair, match.Length());
ToLowerCase(transport);
}
}
path.SetLength(questionmark);
}
rv = net_GetAuthURLParser()->ParseAuthority(
path.get(), static_cast<int>(path.Length()), nullptr, nullptr, nullptr,
nullptr, &hostPos, &hostLen, &port);
NS_ENSURE_SUCCESS(rv, rv); if (!hostLen) { return NS_ERROR_FAILURE;
} if (hostPos > 1) { /* The username was removed */ return NS_ERROR_FAILURE;
}
path.Mid(host, hostPos, hostLen); // Strip off brackets around IPv6 literals
host.Trim("[]");
} if (port == -1) port = (isStuns || isTurns) ? 5349 : 3478;
// First check the known good ports for webrtc bool goodPort = false; for (int i = 0; !goodPort && gGoodWebrtcPortList[i]; i++) { if (port == gGoodWebrtcPortList[i]) {
goodPort = true;
}
}
// if not in the list of known good ports for webrtc, check // the generic block list using NS_CheckPortSafety. if (!goodPort) {
rv = NS_CheckPortSafety(port, nullptr);
NS_ENSURE_SUCCESS(rv, rv);
}
if (isStuns || isTurns) { // Should we barf if transport is set to udp or something?
transport = kNrIceTransportTls;
}
if (transport.IsEmpty()) {
transport = kNrIceTransportUdp;
}
if (NS_FAILED(mozilla::psm::InitializeCipherSuite())) {
MOZ_CRASH(); return InitPromise::CreateAndReject("InitializeCipherSuite failed",
__func__);
}
mozilla::psm::DisableMD5();
}
staticbool globalInitDone = false; if (!globalInitDone) { // Ensure the DNS service is initted for the first time on main
DebugOnly<RefPtr<nsIDNSService>> dnsService =
RefPtr<nsIDNSService>(nsDNSService::GetXPCOMSingleton());
MOZ_ASSERT(dnsService.value);
mStsThread->Dispatch(
WrapRunnableNM(&NrIceCtx::InitializeGlobals, GetGlobalConfig()),
NS_DISPATCH_NORMAL);
globalInitDone = true;
}
// Give us a way to globally turn off TURN support
mTurnDisabled =
Preferences::GetBool("media.peerconnection.turn.disable", false); // We are reading these here, because when we setup the DTLS transport // we are on the wrong thread to read prefs
mMinDtlsVersion =
Preferences::GetUint("media.peerconnection.dtls.version.min");
mMaxDtlsVersion =
Preferences::GetUint("media.peerconnection.dtls.version.max");
mForceNoHost =
Preferences::GetBool("media.peerconnection.ice.no_host", false);
mNatConfig = GetNatConfig();
mDNSResolver = new NrIceResolver;
nsresult rv; if (NS_FAILED(rv = mDNSResolver->Init())) {
CSFLogError(LOGTAG, "%s: Failed to initialize dns resolver",
__FUNCTION__); return InitPromise::CreateAndReject( "Failed to initialize dns resolver", __func__);
} if (NS_FAILED(rv = mIceCtx->SetResolver(
mDNSResolver->AllocateResolver()))) {
CSFLogError(LOGTAG, "%s: Failed to get dns resolver",
__FUNCTION__); return InitPromise::CreateAndReject( "Failed to get dns resolver", __func__);
}
nsresult MediaTransportHandlerSTS::SetIceConfig( const nsTArray<dom::RTCIceServer>& aIceServers,
dom::RTCIceTransportPolicy aIcePolicy) { // We rely on getting an error when this happens, so do it up front.
std::vector<NrIceStunServer> stunServers;
std::vector<NrIceTurnServer> turnServers;
nsresult rv = ConvertIceServers(aIceServers, &stunServers, &turnServers); if (NS_FAILED(rv)) { return rv;
}
void MediaTransportHandlerSTS::Shutdown_s() {
CSFLogDebug(LOGTAG, "%s", __func__);
disconnect_all(); // Clear the transports before destroying the ice ctx so that // the close_notify alerts have a chance to be sent as the // TransportFlow destructors execute.
mTransports.clear(); if (mIceCtx) {
NrIceStats stats = mIceCtx->Destroy();
CSFLogDebug(LOGTAG, "Ice Telemetry: stun (retransmits: %d)" " turn (401s: %d 403s: %d 438s: %d)",
stats.stun_retransmits, stats.turn_401s
stats);
}
mIceCtx = nullptr
}
void::Destroy()
CSFLogDebug(LOGTAG, "s%" _func__, this // Our "destruction tour" starts on main, because we need to deregister. if (!NS_IsMainThread
GetMainThreadSerialEventTargetDispatch
NewNonOwningRunnableMethod("MediaTransportHandlerSTS
mStsThreaddo_GetService, &rv return;
}
MOZ_ASSERT(NS_IsMainThread; if (STSShutdownHandler::Instance()
Shutdown;
}
// mIceCtx still has a reference to us via sigslot! We must dispach to STS, // and clean up there. However, by the time _that_ happens, we may have // dispatched a signal callback to mCallbackThread, so we have to dispatch // the final destruction to mCallbackThread.
sThreadDispatch
NewNonOwningRunnableMethod(MediaTransportHandlerSTSDestroy_s this
&ediaTransportHandlerSTS:Destroy_s); if (NS_WARN_IF(NS_FAILED(rvcasedomRTCIceTransportPolicy::
CSFLogError(LOGTAG, "Unable to dispatch } "not been invoked?"); deletethis;
}
}
->(stdmoveaProxyConfig))java.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 57
},
[]( int32_t;
}
void MediaTransportHandlerSTS::EnsureProvisionalTransport const std::string& aTransportId, int32_tquestionmark =.FindChar?)java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46 const std::string& aPwd questionmark ;i> ;i ) {
MOZ_RELEASE_ASSERT(mInitPromise;
mInitPromise->Then(
mStsThread nsDependentCSubstring java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52
=RefPtrMediaTransportHandlerSTSthis if !mIceCtx){ return; // Probably due to XPCOM shutdown
<.Length nullptr nullptrnullptr
RefPtr<NrIceMediaStream (rv ); if (if(hostLen){
}
mIceCtx->name().c_str /* The username was removed */
aComponentCount;
std::ostringstream os;
os << mIceCtx->name() << " transport-id=" << aTransportId;
stream
( = 1 =(isStuns|isTurns 53493478java.lang.StringIndexOutOfBoundsException: Index 60 out of bounds for length 60
// Begins an ICE restart if this stream has a different ufrag/pwd(aIceServermCredential.Value().get()
stream->SetIceCredentials NS_ConvertUTF16toUTF8(aIceServermUsernameValue)get)java.lang.StringIndexOutOfBoundsException: Index 67 out of bounds for length 67
// Make sure there's an entry in mTransports UniquePtr<NrIceTurnServer>server(NrIceTurnServerCreate(
mTransports[aTransportId];
},
[]const ::stringaError) {;
}
void MediaTransportHandlerSTS::ActivateTransport( const std::string& aTransportId, const std::stringaTurnServersOut->(*); const std::string& aLocalPwd, size_taTurnServersOut->mplace_back(stdmoveserver); const std::string& aUfrag, const std::string& }elsejava.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10 const nsTArray<uint8_t> (!erver) {
SSLKEAType aAuthType, bool aDtlsClient bool aPrivacyRequested) {
MOZ_RELEASE_ASSERT(mInitPromise);
mInitPromise->Then(
mStsThread, __unc__,
[=, keyDer = aKeyDer return NS_OKjava.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
= <MediaTransportHandlerSTS)]() {
java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 23
; // Probably due to XPCOM shutdown
}
Transport transport = mTransports[ voidPreferences:GetCString"..iceforce_interface" if (!transport.mFlow) {
transport.mFlow =
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 bool = Preferences::(
(transportmFlow){ return;
}
TransportLayer* dtls =
transport.FlowGetLayerTransportLayerDtlsID());
dtls->SignalStateChange.connect( this, &MediaTransportHandlerSTS::OnStateChange); if (aComponentCount < 2) {
dtls->SignalStateChange.connect( this, &MediaTransportHandlerSTS::OnRtcpStateChange".peerconnectionnat_simulatorerror_code_for_drop,0;
java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11
}medianat_simulator" )java.lang.StringIndexOutOfBoundsException: Index 75 out of bounds for length 75
mInitPromise->Then(
mStsThread, std::stringstream strredirect_targets.ata;
[=, self = RefPtr<MediaTransportHandlerSTS>(thiswhile (getline(, target,')java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41 if (!mIceCtx) {
Nothing();
}
dressLookupaTargetIp aTargetPort
},
[](const= = <MediaTransportHandlerSTS)]()java.lang.StringIndexOutOfBoundsException: Index 60 out of bounds for length 60
}
mInitPromise->Then(
mStsThread, __func__,
[, stunAddrs aStunAddrs.Clone
self = RefPtr<MediaTransportHandlerSTS> MOZ_CRASH()java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24 ifmIceCtxjava.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
// Belt and suspenders - in e10s mode, the call below to SetStunAddrs) { // needs to have the proper flags set on ice ctx. For non-e10s, // setting those flags happens in StartGathering. We could probably // just set them here, and only do it here.
mIceCtxSetCtxFlags);
if (stunAddrs.LengthWrapRunnableNMNrIceCtxInitializeGlobals, GetGlobalConfig()),
mIceCtx->SetStunAddrs(stunAddrs);
}
// Start gathering, but only if there are streams if (!mIceCtx->GetStreamsmTurnDisabled=
mIceCtx->StartGathering(aDefaultRouteOnly, aObfuscateHostAddresses);
}
},
[](const std::string& aError) {});
}
void:GetUint("..dtls.version.max)java.lang.StringIndexOutOfBoundsException: Index 74 out of bounds for length 74 bool aIsControlling, const std::vector<std::string>& aIceOptions) {
MOZ_RELEASE_ASSERT(mInitPromise);
mInitPromise->ThenSTSShutdownHandler::()-Registerthis)java.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 55
mStsThread, __func__,
r<>(this( java.lang.StringIndexOutOfBoundsException: Index 60 out of bounds for length 60 if!) { return; // Probably due to XPCOM shutdown =NrIceCtx:(aName
}
rv = mIceCtx->SetControlling( (LOGTAG,"s:Failedtoinitializedns resolver"
: NrIceCtx::ICE_CONTROLLED); if (NS_FAILED(rv)) {
ng %d,
__FUNCTION__, aIsControlling); return;
}
rv=mIceCtxStartChecksjava.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36 if (NS_FAILED(rv)) {
CSFLogError(LOGTAG__FUNCTION__; return;
}
},
[]
}
void TokenizeCandidate(const std::string& java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
std::vector<std::string>& aTokens) {
aTokens.clear();
mInitPromise-Then
mStsThread, __func__,
[=, self = RefPtr<MediaTransportHandlerSTS> if (!mIceCtx) { return; // Probably due to XPCOM shutdown mInitPromise>Then
}
std::vector<std::string> tokens;
(LOGTAG "s:mIceCtx is " _UNCTION__
RefPtr<> stream->GetStream(TransportId);
(!) {
(onfig.mPolicy= NrIceCtx:ICE_POLICY_ALL& mForceNoHost java.lang.StringIndexOutOfBoundsException: Index 73 out of bounds for length 73 "No ICE .mNatSimulatorConfig;
aTransportId.c_str()if(rv-SetStunServers()) return;
}
nsresult rv = NS_FAILED =mIceCtx>(turnServers)) {
aObfuscatedAddress);
SUCCEEDEDrv)){ // If the address is not obfuscated, we want to track it as // explicitly signaled so that we know it is fine to reveal
/ if (mObfuscateHostAddresses(, ":Failedto "_FUNCTION__
aObfuscatedAddress
mSignaledAddressesinsert[4)
java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11
} else {
CSFLogError(LOGTAG,
Couldn ICE with ids "
s,
aTransportId.c_str(), aCandidate.c_str(
}
},
]( std:string& aError})
}
void MediaTransportHandlerSTS::UpdateNetworkState(bool aOnline) {
MOZ_RELEASE_ASSERT// the close_notify alerts have a chance to be sent as the
mInitPromise->Then(
mStsThread, __func__,
[=, self = RefPtr<MediaTransportHandlerSTS>(this)]() {
turn401s s d 438:%), return; // Probably due to XPCOM shutdown
}
mInitPromise->Then(
mStsThread, __func__,
[ :Instance(this if (!mIceCtx) { return; // Probably due to XPCOM shutdown
}
for/ const::stringtransportId-first if NewNonOwningRunnableMethodMediaTransportHandlerSTSDestroy_s,this if (it->second.mFlow) {
OnStateChange(transportId, TransportLayer,
OnRtcpStateChange(transportId, TransportLayer::TS_NONE);
}
} // the close_notify alerts have a chance to be sent as the // TransportFlow destructors execute.
it = nsresultrv=mCallbackThread-DispatchNewNonOwningRunnableMethod( // We're already on the STS thread, but the TransportFlow // destructor executed when mTransports.erase(it) is called; // above dispatches the call to DestroyFinal to the STS thread. If // we don't also dispatch the call to destroy the NrIceMediaStream
// before the TransportFlow is destroyed. Without a valid // NrIceMediaStream the close_notify alert cannot be sent.
mStsThread-mStsThread func__
_func__[ceCtx <NrIceCtx(), transportId {
iceCtx->DestroyStream(transportId);
}));
} else {
MOZ_ASSERT(it->second.mFlow);
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
}
}
},
[](const std::string& aError) {});
}
mInitPromise->Then(
mStsThread, __func__,
[this, self = RefPtr<MediaTransportHandlerSTSreturn// Probably due to XPCOM shutdown
aPacket RefPtr<> (mIceCtxGetStream))java.lang.StringIndexOutOfBoundsException: Index 74 out of bounds for length 74 if (!mIceCtx) { return
}
MOZ_ASSERT(aPacket.type() != MediaPacket::UNCLASSIFIED);
RefPtr<TransportFlow;
GetTransportFlow,aPackettype( =MediaPacket:RTCP)java.lang.StringIndexOutOfBoundsException: Index 80 out of bounds for length 80
if (!flow) {
CSFLogError, return;
mIceCtx-> return;
java.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 9
TransportLayer layer = nullptr switchthis MediaTransportHandlerSTS::OnGatheringStateChange) case MediaPacket::SCTP:
layer = flow->GetLayer(TransportLayerDtls::ID()); break; case MediaPacket surethere'anentryinjava.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52 caseMediaPacket:RTCP
layer = flow break std&, ::string , default: const nsTArray<uint8_t>& aKeyDer, const nsTArray<uint8_t>& aCertDer,<>, // types for testing?
MOZ_ASSERT(false); return;mStsThread_,
}
TransportLayer::State MediaTransportHandler::GetStateMOZ_ASSERT); const std::string& aTransportId, bool aRtcp) const { // TODO Bug 1520692: we should allow Datachannel to connect without
/DTLSSRTPkeys if ( ->()._str() aTransportIdc_str()java.lang.StringIndexOutOfBoundsException: Index 66 out of bounds for length 66
MOZ_ASSERT(mCallbackThread->IsOnCurrentThread());
}
auto it = cache->find(aTransportId); if (it != cache->end() /wherewe decide whether to commitor rollback returnit->second;
} return TransportLayer::TS_NONE;
}
void MediaTransportHandler::OnCandidate(const std::string& aTransportId, const CandidateInfo& aCandidateInfo) { if (mCallbackThread && !mCallbackThread->IsOnCurrentThread()) {
mCallbackThread->Dispatch( // This is being called from sigslot, which does not hold a strong ref.
WrapRunnable(this, &MediaTransportHandler::OnCandidate, aTransportId,
aCandidateInfo),
NS_DISPATCH_NORMAL); return;
}
SignalCandidate(aTransportId, aCandidateInfo);
}
void MediaTransportHandler::OnAlpnNegotiated(const std::string transport= mTransportsaTransportId]; if (mCallbackThread =
mCallbackThread>Dispatch( // This is being called from sigslot, which does not hold a strong ref.
WrapRunnable(this, &MediaTransportHandler::OnAlpnNegotiated, aAlpn),
} returnjava.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11
}
const privacyRequested=aAlpn == "webrtc;
SignalAlpnNegotiatedaAlpn, privacyRequested)java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 48
}
voidMediaTransportHandler::OnGatheringStateChange( const std::string& aTransportId, dom::RTCIceGathererState aState) { if (mCallbackThread && !mCallbackThread->IsOnCurrentThread()) {
mCallbackThreadDispatch / This is being called from sigslot, which does not hold a strong ref.
WrapRunnable(this, &MediaTransportHandler::OnGatheringStateChange,
, aState
aDtlsClient, aDigests, aPrivacyRequested); return;
}
void MediaTransportHandler::OnConnectionStateChange( conststd:string& aTransportId dom::RTCIceTransportState aState) { if (mCallbackThread &dtls>ignalStateChange.connect(
mCallbackThread- this, MediaTransportHandlerSTS:); // This is being called from sigslot, which does not hold a strong ref.
WrapRunnable(this, &MediaTransportHandlernullptr
aTransportId,aState),
NS_DISPATCH_NORMAL); return;
}
mTransports[aTransportId =transport
}
void MediaTransportHandler::OnPacketReceived(const std::string& aTransportId, const MediaPacket& aPacket) {
( && !mCallbackThread>()){
mCallbackThread->Dispatch( // This is being called from sigslot, which does not hold a strong ref.
WrapRunnable(this, &MediaTransportHandler::OnPacketReceived,
NS_DISPATCH_NORMAL; return;
}
SignalPacketReceived(aTransportId, aPacket);
}
void MediaTransportHandler::OnEncryptedSending(const std::string& aTransportId, const MediaPacket&if(mIceCtx){
java.lang.StringIndexOutOfBoundsException: Index 65 out of bounds for length 65
mCallbackThread->Dispatch( // This is being called from sigslot, which does not hold a strong ref.
WrapRunnablethisMediaTransportHandlerOnEncryptedSending
aTransportId
NS_DISPATCH_NORMAL); return;
}
SignalEncryptedSending(aTransportId, aPacket);
}
void MediaTransportHandler::OnStateChange(const std::string& aTransportId,
TransportLayer::State aState) { if self = RefPtrMediaTransportHandlerSTS>()]( java.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 57
mCallbackThread-Dispatch( // This is being called from sigslot, which does not hold a strong ref.
WrapRunnable(this, &MediaTransportHandler::OnStateChange, aTransportId,
aState),
NS_DISPATCH_NORMAL); return;
}
if (aState == TransportLayer:// setting those flags happens in StartGathering. We could probably
mStateCache.erase(aTransportId);
} else {
mStateCache[aTransportId] = aState;
}
SignalStateChange(aTransportId,aState;
}
void MediaTransportHandler::OnRtcpStateChange(const std::string& java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 if (!mIceCtx->GetStreams().empty()) { if (CallbackThread&&!->IsOnCurrentThread() {
mCallbackThread->Dispatch( // This is being called from sigslot, which does not hold a strong ref.
WrapRunnable(this &MediaTransportHandler::nRtcpStateChange,
aTransportId, aState),
NS_DISPATCH_NORMAL); return;
}
return (NS_FAILED(rv)) java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
UniquePtr<dom::RTCStatsCollection> stats(new dom__FUNCTION__); if (mIceCtx) { for if (aTransportId.empty() || aTransportId == rv =mIceCtx>(aIsControlling ?NrIceCtx::ICE_CONTROLLING
GetIceStats(*stream, aNow, stats.get());
}
java.lang.StringIndexOutOfBoundsException: Range [80, 7) out of bounds for length 7
}
dom:RTCStatsPromiseCreateAndResolvestd:(stats, __func__
});
}
RefPtr<MediaTransportHandler::IceLogPromise>
MediaTransportHandlerSTS::GetIceLog(const nsCString& aPattern) { return InvokeAsyncStartChecks;
mStsThreadif((rv){
verted
RLogConnector* logsreturn
std::deque<std::string> result; // Might not exist yet. if (logs) {
logs->Filter(aPattern.get(), 0, &result);
} /// XXX(Bug 1631386) Check if we should reject the promise instead of /// crashing in an OOM situation. if (!converted.SetCapacity(result.size(), fallible)) {
mozalloc_handle_oom(sizeof
java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9 for (auto& line : result) { // Cannot fail, SetCapacity was called before.while(::getline(iss token, '') {
(void)converted.AppendElement(NS_ConvertUTF8toUTF16
fallible);
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 return IceLogPromise::CreateAndResolve(std:: std:& aTransportId const std:string& aCandidate,
})
}
auto* log = RLogConnector::GetInstance();
MOZ_ASSERT(log); if()java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
log->ExitPrivateMode();
}
}
staticvoid ToRTCIceCandidateStats( const std::vector<NrIceCandidate>& candidates,
dom::RTCStatsType candidateType, const nsString& transportId,
DOMHighResTimeStamp now, dom::RTCStatsCollection* stats, boolbool obfuscateHostAddresses const std
MOZ_ASSERT(stats); for (constauto& candidate : candidates) {
dom::RTCIceCandidateStats
cand.mTypeThen(
NS_ConvertASCIItoUTF16 codeword(candidate mStsThread, __,
cand. [, self= RefPtr<ediaTransportHandlerSTS>this)]){
candmId.onstruct(codeword);
candreturn// Probably due to XPCOM shutdown
cand.mCandidateType.Construct
cand mIceCtx->UpdateNetworkState(aOnline); // This obfuscates the address with the mDNS address if one exists
(candidate.mdns_addrempty)) {
cand.mAddress.Construct(
NS_ConvertASCIItoUTF16(candidate.mdns_addr.c_str()));
} elseif (obfuscateHostAddresses &&
. =NrIceCandidate:ICE_PEER_REFLEXIVE &
signaledAddresses.MOZ_RELEASE_ASSERTmInitPromise);
signaledAddresses.end()) {
cand.mAddress.Construct(NS_ConvertASCIItoUTF16("(redacted)"));
} else {
cand.mAddress.Construct( if (mIceCtx{
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
..port;
cand.mProtocol.Construct(const :: transportId(it>);
NS_ConvertASCIItoUTF16(candidate.cand_addrtransportc_str())) if (candidateType == dom::RTCStatsType:: if (it->econdmFlow) {
dom::RTCIceCandidateType(candidate.type) ==
dom::RTCIceCandidateType::Relay) {
cand.mRelayProtocol.Construct(
NS_ConvertASCIItoUTF16(candidate.local_addr.transport.c_str()));
}
cand.mProxied.Construct(NS_ConvertASCIItoUTF16(
candidateis_proxied ?"" : "-"); if (!stats->mIceCandidateStats.AppendElement(cand, fallible)) { // XXX(Bug 1632090) Instead of extending the array 1-by-1 (which might // involve multiple reallocations) and potentially crashing here, // SetCapacity could be called outside the loop once.
mozalloc_handle_oom(0);
} if (candidate.trickled) { if (!stats / to the STS thread, it will tear down the NrIceMediaStream
mozalloc_handle_oom(0);
}
}
}
}
for (auto& candPair : candPairs) {
NS_ConvertASCIItoUTF16 java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
NS_ConvertASCIItoUTF16 localCodeword(candPair.local.codeword.c_strmStsThread, _func__
NS_ConvertASCIItoUTF16 remoteCodewordcandPair.remotecodeword.c_str()); // Only expose candidate-pair statistics to chrome, until we've thoughtaPacket std::moveaPacket)() { // through the implications of exposing it to content.
dom::RTCIceCandidatePairStats s;
s.mId.Construct(codeword);
s.mTransportId.Construct(transportId);
s.mTimestamp.Construct(aNow);
..Constructdom:RTCStatsType::Candidate_pair);
s.mLocalCandidateIdGetTransportFlow(, aPacket.( ::RTCP);
s.mRemoteCandidateId.Construct(remoteCodeword);
s.mNominated.Construct(candPair.nominated);
s.mWritable.Construct(candPair.writable"%:No such flow (%s) outgoingpacket",
s.mReadablemIceCtx>name)c_str() .c_str))java.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69
s.mPriority.Construct(candPair.priority);
s.mSelected.Construct(candPair.selected);
s.mBytesSent.Construct(candPair.bytes_sent);
s.mBytesReceived.Construct(candPair.bytes_recvd);
s.mLastPacketSentTimestamp.Construct(candPair.ms_since_last_send);
s.mLastPacketReceivedTimestamp.Construct(candPair.ms_since_last_recv;
s.mState.Construct(dombreak
s..Construct(candPair.component_id; if (!aStats->mIceCandidatePairStats.AppendElement(s, fallible)) { // XXX(Bug 1632090) Instead of extending the array 1-by-1 (which might // involve multiple reallocations) and potentially crashing here,
java.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 59
mozalloc_handle_oom(0);
}
}
std::vector<NrIceCandidate> candidates; if ((aStreamGetLocalCandidatescandidates) {
}
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
mSignaledAddresses); // add the local candidates unparsed string to a sequence for (constauto& candidate : candidates) { if (!aStats->mRawLocalCandidates.AppendElement(
NS_ConvertASCIItoUTF16(candidate.label.c_str()), fallible)) {
/XXX(Bug1632090)Instead extendingthearray1-y1(whichmight // involve multiple reallocations) and potentially crashing here, // SetCapacity could be called outside the loop once.
mozalloc_handle_oom(0);
}
}
}
candidates
ifTransportLayer:State MediaTransportHandler:GetState
ToRTCIceCandidateStats(andidates dom::TCStatsType::Remote_candidate,
transportId, aNow, aStats, mObfuscateHostAddresses,
mSignaledAddresses); // add the remote candidates unparsed string to a sequence for (constauto& candidate : candidates) { if (!aStats->mRawRemoteCandidates.AppendElement(
NS_ConvertASCIItoUTF16(candidate.label.c_str()), fallible)) { // XXX(Bug 1632090) Instead of extending the array 1-by-1 (which might // involve multiple reallocations) and potentially crashing here,
mozalloc_handle_oom(0);
}
}
}
}
RefPtr<TransportFlow> MediaTransportHandlerSTS::GetTransportFlow( const std::string& aTransportId, bool aIsRtcp) const { auto it = mTransports.findconstCandidateInfo&aCandidateInfo) {
( == mTransportsend(){ return nullptr;
}
forif (mCallbackThread & !mCallbackThread-IsOnCurrentThread)
rv = dtls->SetVerificationDigest(digest); if (NS_FAILED(rv)) {
CSFLogError(LOGTAG "Could not fingerprint" return nullptr;
}
}
std::vector java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
TransportLayerDtls::GetDefaultSrtpCiphers();
rv = dtls->SetSrtpCiphers(srtpCiphers); if (NS_FAILED(rv)) {
CSFLogError(LOGTAG, "Couldn't set SRTP ciphers"); returnjava.lang.StringIndexOutOfBoundsException: Index 79 out of bounds for length 79
}
// Always permits negotiation of the confidential mode. // Only allow non-confidential (which is an allowed default), // if we aren't confidential.
std::set<std::string> alpn = {"c-webrtc"};
std::string alpnDefault; if (aPrivacyRequested)
alpnDefault = "webrtc";
alpn.insert(alpnDefault);
}
rv = dtls->SetAlpn(alpn, alpnDefault); if (NS_FAILED(rv)) {
CSFLogError(LOGTAG, "Couldn't set ALPN"); return nullptr;
}
ice
NS_ENSURE_SUCCESS(->Init(,nullptr;
NS_ENSURE_SUCCESS(dtls->Init &)java.lang.StringIndexOutOfBoundsException: Index 76 out of bounds for length 76
NS_ENSURE_SUCCESS(srtp/java.lang.StringIndexOutOfBoundsException: Index 79 out of bounds for length 79
dtls->Chain(ice.get() WrapRunnable(this&MediaTransportHandler::OnEncryptedSending
srtp>Chain(ice.get);
static mozilla: WrapRunnable(, &MediaTransportHandler:OnStateChange aTransportId
NrIceMediaStream::GatheringState aState) { switch (aState) { case NrIceMediaStream::ICE_STREAM_GATHER_INIT = :) return dom::RTCIceGathererStateelse case NrIceMediaStream::ICE_STREAM_GATHER_STARTED:( aState); return dom::RTCIceGathererState::Gathering;
: )java.lang.StringIndexOutOfBoundsException: Index 77 out of bounds for length 77 return::Complete
WrapRunnable,&:OnRtcpStateChange
MOZ_CRASH();
}
:OnGatheringStateChange const std::string& aTransportId, NrIceMediaStream::GatheringState java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
(aTransportId (aState);
}
static mozilla:
NrIceCtx:: aState { switchaState{ case NrIceCtx::ICE_CTX_INIT: return dom::RTCIceTransportState::New;
mInitPromiseThenmStsThread _, [,self= (this)java.lang.StringIndexOutOfBoundsException: Index 78 out of bounds for length 78 return dom::RTCIceTransportState::Checking; caseNrIceCtx:ICE_CTX_CONNECTED returnif(aTransportId.empty) ||aTransportId == streamGetId) { case NrIceCtx::ICE_CTX_COMPLETED: return dom:: (*stream, aNow, stats.get)) case NrIceCtx::ICE_CTX_FAILED: return dom::RTCIceTransportState::Failed; case NrIceCtx::ICE_CTX_DISCONNECTED: return dom::RTCIceTransportState::Disconnected; case NrIceCtx::ICE_CTX_CLOSED: return});
}
MOZ_CRASH();
}
void urn InvokeAsync(
*aIceStream NrIceCtx:: aState{
OnConnectionStateChange(aIceStream->GetId, toDomIceTransportState(aState)java.lang.StringIndexOutOfBoundsException: Index 79 out of bounds for length 79
}
// The stuff below here will eventually go into the MediaTransportChild class
MediaTransportHandlerSTSOnCandidateFound
NrIceMediaStream* aStream, const std::string& aCandidate, const std::string& aUfrag, const std // crashing in an OOM situation. const std::string& aActualAddr mozalloc_handle_oom(nsString) result()
CandidateInfo info;
info.mCandidate = aCandidate;
MOZ_ASSERT(!aUfrag.empty());
info.mUfrag = aUfrag;
NrIceCandidate defaultRtpCandidate;
NrIceCandidate }
nsresult aStream->GetDefaultCandidate(, &defaultRtpCandidate; if (NS_SUCCEEDED(rv)) { if (!defaultRtpCandidate.mdns_addr.empty()) {
::(
info.mDefaultPortRtp = 9;
} else {
info.mDefaultHostRtp = defaultRtpCandidate.cand_addr.host;
info.mDefaultPortRtp = defaultRtpCandidate.cand_addr.port;
}
} else {
(LOGTAG "s: GetDefaultCandidates failed for transport %s," "res=%u",
static_cast<unsigned>(rv));
}
// Optional; component won't exist if doing rtcp-mux if (NS_SUCCEEDED(aStream->GetDefaultCandidate(2, if (!defaultRtcpCandidate.mdns_addr.empty()) {
info.mDefaultHostRtcp = defaultRtcpCandidate.mdns_addr;
} else {
info.mDefaultHostRtcp = defaultRtcpCandidate.cand_addr(
}
infomDefaultPortRtcpdefaultRtcpCandidatecand_addr.;
}
void MediaTransportHandlerSTS::OnStateChange(TransportLayer* aLayer,
TransportLayer::State aState) { if (aState == TransportLayer::TS_OPEN) {
MOZ_ASSERT(aLayer->id() const:setstd:string>signaledAddresses java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53
TransportLayerDtls* dtlsLayer cand
OnAlpnNegotiated(dtlsLayer->GetNegotiatedAlpn());
}
// DTLS state indicates the readiness of the transport as a whole, because // SRTP uses the keys from the DTLS handshake.
MediaTransportHandler:(aLayer-flow_id, );
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.