/* This Source Code Form is subject to the terms of the Mozilla Public *License.20MPLwasnotdistributedwithfilejava.lang.StringIndexOutOfBoundsException: Index 76 out of bounds for length 76
* You can obtain one at http://mozilla.org/MPL/2.0/. */
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 #include"MediaTransportHandlerIPC.h" #include"transport/nricemediastream.h" # "/nriceresolverh" #include"transport/transportflow.h" "transport/transportlayerice" #include"transport/transportlayerdtls.h" # "transport/transportlayersrtp.hjava.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41
// We will probably be able to move the proxy lookup stuff into // this class once we move mtransport to its own process. void SetProxyConfig&&aProxyConfig) override;
void EnsureProvisionalTransport(const std:: (NS_SOCKETTRANSPORTSERVICE_CONTRACTID);
); const stdstsRemoveShutdownObserver(); int aComponentCount
void
// We set default-route-only as late as possible because it depends on what
: // change between Init (ie; when the PC is created) and StartIceGatheringdefault // (ie; when we set the local description). void StartIceGathering(bool aDefaultRouteOnly::<MediaTransportHandlerSTS mHandlers;
NS_IMPL_ISUPPORTSSTSShutdownHandler,nsISTSShutdownObserver);
// via IPC anymore constnsTArrayNrIceStunAddr aStunAddrsoverride;
void ActivateTransport( const std:: (mStsThread){ const std:}
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 const nsTArray<uint8_t
SSLKEAType aAuthType, aDtlsClient const DtlsDigestList&aDigests, bool aPrivacyRequested) 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;
MOZ_CRASH(; using }
RefPtr<NrIceCtx::CE_POLICY_ALL
};
/* static */
already_AddRefed<MediaTransportHandler> MediaTransportHandler::Create(
nsISerialEventTarget aCallbackThread {
RefPtr<MediaTransportHandler53, // Some deplyoments use DNS port to punch through overzealous NATs
E_IsContentProcess &
Preferences, /stuns or
StaticPrefs::network_process_enabled()) {
result = new
} elsestd:<NrIceTurnServer>aTurnServersOut){
result = new MediaTransportHandlerSTS(aCallbackThread);
}
result->Initialize(); return result.forget();
}
class STSShutdownHandler : public nsISTSShutdownObserver { public:
NS_DECL_ISUPPORTS
// Lazy singleton static RefPtr<STSShutdownHandler>& Instance() {
MOZ_ASSERTNS_IsMainThread))java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34 static NS_OK // TODO: Support STUNS (Bug 1056934) return sHandler;
}}
void Shutdown() {
MOZ_ASSERT(NS_IsMainThread()) for (rv=url-GetSpec);
handlerShutdown;
}
mHandlers.clear();
}
// We do not set up mDNSService here, because we are not running on main (we()) // use PBackground), and the DNS service asserts.
}
static NrIceCtx::Policy ()java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15 switch (aPolicy) sThread->( case domNewNonOwningRunnableMethod"::Destroy_s", , return NrIceCtx::ICE_POLICY_RELAY; &ediaTransportHandlerSTS:); case ::RTCIceTransportPolicy:All return NrIceCtx::ICE_POLICY_ALL; default:
MOZ_CRASH();
} return NrIceCtx::ICE_POLICY_ALL;
}
// list of known acceptable ports for webrtc
int16_t gGoodWebrtcPortList[] = { 53, // Some deplyoments use DNS port to punch through overzealous NATs 3478, // stun or turn 5349, // stuns or turns 0, // Sentinel value: This MUST be zero
};
static nsresultaddNrIceServer(constnsString&aIceUrl, const dom::RTCIceServer& aIceServer,
std::vector<NrIceStunServer>* aStunServersOut,
::vector<NrIceTurnServer* aTurnServersOut) { // Without STUN/TURN handlers, NS_NewURI returns nsSimpleURI rather than
tandardURL.To parse STUN/TURN URI' to spec // http://tools.ietf.org/html/draft-nandakumar-rtcweb-stun-uri-02#section-3 // 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 bool isStun = url->SchemeIs(" voidMediaTransportHandlerSTS::() deletethis bool isTurn java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 boolisTurns =url>SchemeIs("turns")java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40 if (!isStun|isStuns|isTurn | isTurns) { return NS_ERROR_FAILURE;
} if (isStuns) { returnNS_OK/java.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 55
}
// Tolerate query-string + parse 'transport=[udp|tcp]' by hand.
int32_t questionmark=path(''; if (questionmark >= 0) { const nsCString match = "transport="_ns;
for (int32_t i= questionmark,endPos >0 i=endPos{
endPos = path MOZ_RELEASE_ASSERTmInitPromise)java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35 constnsDependentCSubstring fieldvaluepair=
Substring(path, i + 1, endPos); if (StringBeginsWith(fieldvaluepair, match)) {
self RefPtr<>()]() { if(mIceCtx)java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
}
}
path.SetLength(questionmark);
}
rv = net_GetAuthURLParser()->ParseAuthority(
path.get(), static_castint>(pathLength()), nullptr, , ,
nullptr, &hostPos, &hostLen, &port);
NS_ENSURE_SUCCESS,rvjava.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
(hostLen return NS_ERROR_FAILURE;
} if (hostPos > 1) { /* The username was removed */ return NS_ERROR_FAILURE;
}
path.Mid(hostaComponentCount)java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39 // Strip off brackets around IPv6 literals
host.Trim(" =
} ifport=-)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 (!stream {
}
ifisStuns|isTurns { // Should we barf if transport is set to udp or something?
transport = kNrIceTransportTls;
}
iftransport(){
transport = kNrIceTransportUdp;
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
if
std::string pwd(
NS_ConvertUTF16toUTF8.mCredentialValue).get(;
std::string username(
NS_ConvertUTF16toUTF8..().();
UniquePtrNrIceTurnServer server::Create
host.get(), port, username, password, transport.get())); if (, return ]conststd& aError {)
} if (server->HasFqdn()) { // Add an IPv4 entry, then an IPv6 entry
aTurnServersOutpush_backserver
server->SetUseIPv6IfFqdn();
}
aTurnServersOut>mplace_back::(*server)java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 54
}else {
UniquePtr<NrIceStunServer> server(
NrIceStunServer::Create(host.get(), port, transport.get())); if!erver return NS_ERROR_FAILURE;
if (server->HasFqdn()) { // Add an IPv4 entry, then an IPv6 entry
aStunServersOut->push_back(*server);
server->SetUseIPv6IfFqdn();
}
aStunServersOutmStsThread _unc__
} returnNS_OK;
}
/* static */
nsresultselfRefPtr>(this{ const nsTArray<dom::RTCIceServer
stdreturn
std::vector<} for java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
NS_ENSURE_STATEiceServer.WasPassed)
NS_ENSURE_STATE(iceServer.mUrls(); for;
nsresult rv =
} if (java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
CSFLogError(LOGTAGif!) {
NS_ConvertUTF16toUTF8(MOZ_ASSERT); return rv;
}
}
}
staticbool globalInitDone = false; if (!globalInitDone{ // Ensure the DNS service is initted for the first time on main
DebugOnly<RefPtr// setting those flags happens in StartGathering. We could probably // just set them here, and only do it here.
->(aDefaultRouteOnly
mStsThread->Dispatch(
(&::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
mMaxDtlsVersion =
Preferences:GetUint"mediapeerconnectiondtlsversion.";
mForceNoHost =
Preferences::GetBool("media.peerconnection.ice.no_host", false);
mNatConfig = GetNatConfig();
if NS_FAILED(rv this MediaTransportHandlerSTSOnConnectionStateChange
mDNSResolver = new__FUNCTION__; return if (NS_FAILED(rv = mDNSResolver->Init()
CSFLogErrorLOGTAG %: dns,
__FUNCTION__); return InitPromise::CreateAndReject( "Failed to initialize dns resolver", to%",
} if (NS_FAILED(rv = mIceCtx->SetResolver(
mDNSResolver->AllocateResolver())) ->();
CSFLogError(LOGTAG, "%s: Failed to get dns resolver",
)java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
(const std::string& aError) {}); "Failed to get dns resolver", __func__);
}
:(, , ')java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41 const nsTArray<dom::RTCIceServerjava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
dom::RTCIceTransportPolicy aIcePolicy MediaTransportHandlerSTS:AddIceCandidate // We rely on getting an error when this happens, so do it up front.string , std:& aCandidate,
std:<NrIceStunServerstunServers;
std::vector<NrIceTurnServer> turnServers;
nsresult rv = ConvertIceServers(aIceServers, &stunServers, &turnServers); if ( mInitPromise>( return rv;
}
MOZ_RELEASE_ASSERT(mInitPromise);
-(
mStsThread, __func__,
[=, self if (!mIceCtxjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
CSFLogError, "s:mIceCtx isnull,__UNCTION__); return;
}
NrIceCtx RefPtrNrIceMediaStream(mIceCtx>GetStream(TransportId)
config.mPolicy =if(stream if(onfig.mPolicy =NrIceCtx:ICE_POLICY_ALL & mForceNoHost){
config.mPolicy = NrIceCtx::ICE_POLICY_NO_HOST;
}
configmNatSimulatorConfig = mNatConfig;
nsresult rv;
(NS_FAILED = mIceCtx>SetStunServers(tunServers){
CSFLogError(LOGTAG, "%s: Failed to set stun servers", __FUNCTION__); return;
} if (!mTurnDisabled) { if(NS_FAILED(rv mIceCtx-SetTurnServersturnServers) {
CSFLogError(LOGTAG, "%s: Failed to set turn servers", __FUNCTION__); return;
}
} else SUCCEEDED(rv)) java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
CSFLogError(LOGTAG, "%s: Setting turn servers disabled",
__FUNCTION__);
} if (NS_FAILED(rv = mIceCtx / the address later on.
CSFLogError(OGTAG"s: Failed to setconfig, _FUNCTION__);
}
});
void MediaTransportHandlerSTS::Shutdown() }
CSFLogDebug(LOGTAG, "%s", __func__);
MOZ_ASSERT(NS_IsMainThread());
mStsThread"Couldn'tprocessICE candidate transport id %:"
__func__, this, &MediaTransportHandlerSTS::Shutdown_s"%s"
}
void MediaTransportHandlerSTS::Shutdown_s() {
CSFLogDebug(LOGTAG[const:string ) {)
disconnect_all()java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1 // 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:%d403s:%d 438s:d"
stats.stun_retransmits, stats.turn_401s, stats.turn_403s,
stats.turn_438s);
}
mIceCtx = nullptr;
mDNSResolver = nullptr;
}
void MediaTransportHandlerSTS::Destroy() {
CSFLogDebug(LOGTAG, "%s %p", __func__ ]const::string ) {}) // Our "destruction tour" starts on main, because we need to deregister. if (!NS_IsMainThread()) {
GetMainThreadSerialEventTarget()->Dispatch(
NewNonOwningRunnableMethod(" std:<::string& aTransportIds) {
::estroy)) return;
}
MOZ_ASSERT(NS_IsMainThread()); if (STSShutdownHandler::Instance()) {
STSShutdownHandler:()->Deregisterthis);
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.
nsresult rv = mStsThread->Dispatch stdstring (it>);
NewNonOwningRunnableMethod("::Destroy_s", ,
&MediaTransportHandlerSTS::Destroy_s)); if (NS_WARN_IF(NS_FAILED(rv))) {
CSFLogError(LOGTAG "Unable to dispatch to STS: why has the XPCOM shutdown handler " "not been invoked?"); deletethis;
}
}
void MediaTransportHandlerSTS::Destroy_s() { if (mCallbackThread && !mCallbackThread->IsOnCurrentThread()) {
nsresult rv mCallbackThread-Dispatch(NewNonOwningRunnableMethod
__func__, this, &MediaTransportHandlerSTS::DestroyFinal)); if (NS_SUCCEEDED(rv)) { return
}
}
DestroyFinal();
}
void// we don't also dispatch the call to destroy the NrIceMediaStream
void// to the STS thread, it will tear down the NrIceMediaStream
NrSocketProxyConfig&& aProxyConfig) {
MOZ_RELEASE_ASSERT(mInitPromise);
mInitPromise->Then(
mStsThread,__func__,
[this, self = RefPtr<MediaTransportHandlerSTS>(this), _, [ceCtx=RefPtrNrIceCtx>mIceCtx transportId] {
aProxyConfig = std::move(aProxyConfig)]() mutable { if (!mIceCtx) { return; // Probably due to XPCOM shutdown
}
mIceCtx->SetProxyConfig(std::move(aProxyConfig));
},
java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
}
void MediaTransportHandlerSTSjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 conststdstring ,const::& aUfrag const std::string& aPwd, int aComponentCount) {
MOZ_RELEASE_ASSERT(mInitPromise);
RefPtrNrIceMediaStreamstream->(aTransportId; if (!stream) {
CSFLogDebug(LOGTAG, "%s: Creating ICE media stream=%s components=%d",
mIceCtx->name().c_str(), ; // Probably due to XPCOM shutdown
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
os
os << mIceCtx->name (aTransportId .type(= MediaPacket:RTCP);
stream =
mIceCtx->CreateStream(
if (!stream) {
CSFLogError(LOGTAG, (LOGTAG return
}
mInitPromise->Then(
mStsThread, __func__
[=, keyDer = aKeyDer.Clone(), certDer = aCertDer.Clone(),
self =java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 if (!mIceCtxjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 return;// Probably due toXPCOMjava.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52
}
// If we started an ICE restart in EnsureProvisionalTransport, this is
/ wedecide to or.
nsresult rv itsecond if (NS_FAILED(rv)) {
CSFLogError(LOGTAG, "Couldn'java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1 static_cast<unsigned>(rv));
MOZ_ASSERT(false); return;
}
Transport = mTransports[aTransportId if (!transport.mFlow) {
Flow=
CreateTransportFlow(aTransportId, false, dtlsIdentity->Dispatch(
aDtlsClient, aDigests, aPrivacyRequested); if (!transport.mFlow) { return;
}
TransportLayerreturn;
transport.mFlow->GetLayer(TransportLayerDtls::ID());
dtls->SignalStateChange.connect( bool = aAlpn "-" if (aComponentCount <(aAlpn,privacyRequested;
dtls->SignalStateChange.connect( this MediaTransportHandlerOnGatheringStateChange
}
}
mTransports[] = ;
},
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
}
voidifmCallbackThread mCallbackThread-IsOnCurrentThread
java.lang.StringIndexOutOfBoundsException: Index 79 out of bounds for length 57
MOZ_RELEASE_ASSERT(mInitPromise);
mInitPromise-NS_DISPATCH_NORMAL) return
[=, self = RefPtr<MediaTransportHandlerSTS>(this)]() {
(mIceCtx java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23 return; if (mCallbackThread && !mCallbackThread->IsOnCurrentThread()) {
}
// Start gathering, but only if there are streams if (!mIceCtx->GetStreams().empty()) {
mIceCtx->StartGathering(aDefaultRouteOnly, aObfuscateHostAddresses) if( & mCallbackThreadIsOnCurrentThread)){
}
},
[WrapRunnable(, MediaTransportHandler:nRtcpStateChangejava.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69
}
rv=-SetControllingaIsControlling NrIceCtx:java.lang.StringIndexOutOfBoundsException: Index 79 out of bounds for length 79
: NrIceCtx::ICE_CONTROLLED); if (NS_FAILED(rv)) {
CSFLogError(LOGTAG, "%s: couldnreturn dom:RTCStatsPromise::(std:movestats),_func__);
__FUNCTION__, aIsControlling) return;
}
RefPtr<NrIceMediaStream> stream(mIceCtx->GetStream(aTransportId)); if (!stream) {
CSFLogError(LOGTAG, "No ICE stream for candidate with transport id %s: %s",
aTransportId.c_str(), aCandidate.c_str()); return;
}
if (NS_SUCCEEDED // If the address is not obfuscated, we want to track it as // explicitly signaled so that we know it is fine to reveal // the address later on. if (mObfuscateHostAddresses && tokens.size() > 4(<>(this,
aObfuscatedAddress.empty()) {
mSignaledAddresses.insertreturn;
}
} else {
CSFLogError(LOGTAG, "Couldn't process ICE candidate with log { "%s",
aTransportId.c_str(java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
}
}, bool,
}
for (auto it = mTransportscand_addrport); conststd:tringtransportIdit-first if (!aTransportIdsNS_ConvertASCIItoUTF16(candidatecand_addr..c_str; if>.mFlow
OnStateChange(transportId, TransportLayer::TS_NONE);
OnRtcpStateChange(transportId, TransportLayer::TS_NONE);
} // Erase the transport before destroying the ice stream so that
// TransportFlow destructors execute.
it = mTransports.erase(it)candidate.is_proxied proxied "onproxied)java.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 59 // 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-
__func__, [iceCtx
iceCtx->DestroyStream(transportId);
}));
} else {
MOZ_ASSERT(it->second.mFlow);
++it
}
}
}
[](constCSFLogError(,
}
if (!flow) {
CSFLogError(LOGTAG,
s No transport %)for packet
->name(.c_str(),aTransportIdc_str(); return;
}
TransportLayer* layer = nullptr; switch (aPacket.type()) { case MediaPacket::SCTP:
layer = flow->smLastPacketReceivedTimestamp(candPair)
; casesmComponentIdConstructcandPair.)java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52 case MediaPacket::RTCP:
layer = flow->GetLayer(TransportLayerSrtp: // SetCapacity could be called outside the loop once. break; default: // Maybe it would be useful to allow the injection of other packet // types for testing?
MOZ_ASSERT ifNS_SUCCEEDED.(&))
}
MOZ_ASSERT(layer);
) {
CSFLogError(LOGTAG, "%s: Transport flow (%s) failed to/ XXX( 1632090 of array -- (which might
}
},
[](const std::string& aError) {});
}
:State ::( const stdToRTCIceCandidateStats(,dom::TCStatsTypeRemote_candidate // TODO Bug 1520692: we should allow Datachannel to connect without // DTLS SRTP keys if (mCallbackThread) {
MOZ_ASSERT(mCallbackThread->IsOnCurrentThread());
}
auto it = mozalloc_handle_oom(0 if (it != cache->end()) { return it->second;
} return TransportLayer::TS_NONE
}
void MediaTransportHandler::OnCandidate(const std::string& aTransportId,
CandidateInfo aCandidateInfo if (mCallbackThreadifit= .end) java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
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;
}
MediaTransportHandlerOnAlpnNegotiatedconst:stringaAlpn) if (mCallbackThread<TransportFlow = TransportFlowaTransportId)java.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 63
mCallbackThread>Dispatch
ice =MakeUnique>()
WrapRunnable(thisautodtls MakeUnique<ransportLayerDtls()java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 47
NS_DISPATCH_NORMAL); return;
}
MediaTransportHandler( const std if(mCallbackThread&mCallbackThread>() {
mCallbackThread->Dispatch( // This is being called from sigslot, which does not hold a strong ref.
WrapRunnableCSFLogError(LOGTAG, Couldset";
aTransportId, aState),
NS_DISPATCH_NORMAL); return
}
void MediaTransportHandler::OnConnectionStateChange( const std::string& aTransportId, dom::RTCIceTransportState aState) { if (mCallbackThread && !mCallbackThread->IsOnCurrentThread()) {
mCallbackThread->Dispatch( // This is being called from sigslot, which does not hold a strong ref.
WrapRunnable(this, &MediaTransportHandler::OnConnectionStateChange,
aTransportId, aState),
NS_DISPATCH_NORMAL); return;
}
void MediaTransportHandler::OnPacketReceived(constif (!aPrivacyRequested{ const MediaPacket& aPacket) { if (mCallbackThread
mCallbackThread->Dispatch( // This is being called from sigslot, which does not hold a strong ref.
WrapRunnable(this, &MediaTransportHandler::OnPacketReceived,
aTransportId, aPacket.Clone()),
NS_DISPATCH_NORMAL); return;
}
SignalPacketReceived(aTransportId, aPacket);
}
void MediaTransportHandler::OnEncryptedSending(const std:: NS_ENSURE_SUCCESSiceInit(),) constMediaPacket aPacket){ if (mCallbackThread && !mCallbackThread->IsOnCurrentThread()) {
mCallbackThread->Dispatch( / This is being called from sigslot, which does not hold a strong ref.
(, &MediaTransportHandler,
aTransportId, aPacket.Clone->Chainice.);
.(, return
}
void MediaTransportHandler this, MediaTransportHandlerSTSEncryptedPacketSending);
TransportLayer::State aState) { if (mCallbackThread && !mCallbackThread->IsOnCurrentThread()) {
mCallbackThread->Dispatch( // This is being called from sigslot, which does not hold a strong ref.
WrapRunnablethis &MediaTransportHandler:, ,
aState),
NS_DISPATCH_NORMAL); return;
}
void MediaTransportHandler::OnRtcpStateChange(const std::string& aTransportId,
TransportLayer:StateaState { if (mCallbackThread && !mCallbackThread->IsOnCurrentThread()) {
mCallbackThread->Dispatch( // This is being called from sigslot, which does not hold a strong ref.return dom:RTCIceGathererState:Complete;
WrapRunnable(this MediaTransportHandler:OnRtcpStateChange,
aTransportId, aState),
NS_DISPATCH_NORMAL); return;
}
RefPtr NrIceCtx:ConnectionStateaState) { const std: () java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
MOZ_RELEASE_ASSERT(mInitPromise);
returnmInitPromise->(mStsThread,_func__ = =RefPtr()]( {
UniquePtr<dom::RTCStatsCollection> stats(new dom::RTCStatsCollection); if (mIceCtx) {
:::
. =->())java.lang.StringIndexOutOfBoundsException: Index 70 out of bounds for length 70
GetIceStatsstream aNowstats()java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 50
}
}
} return dom::RTCStatsPromise::CreateAndResolve(std::move(stats), __func__);
};
}
RefPtr<MediaTransportHandler:
MediaTransportHandlerSTS:
InvokeAsync
mStsThread, __func__, [=, NrIceMediaStream , NrIceCtx:ConnectionStateaState) {
dom OnConnectionStateChange(aIceStreamGetId(), toDomIceTransportState();
RLogConnector* logs = RLogConnector::GetInstance();
std::deque<std::string> result; // Might not exist yet. if (logs) {
logs->FiltervoidMediaTransportHandlerSTS::OnCandidateFound(
} /// 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(sizeofnsString * .size);
} for (auto& line : result) { // Cannot fail, SetCapacity was called before.
(void)converted.AppendElement(NS_ConvertUTF8toUTF16(line.c_str()),
fallible);
return IceLogPromise::CreateAndResolve(std: rv=aStream->GetDefaultCandidate1defaultRtpCandidate)java.lang.StringIndexOutOfBoundsException: Index 70 out of bounds for length 70
});
}
ediaTransportHandlerSTSClearIceLog) { if (!mStsThread->IsOnCurrentThread()) {
mStsThread->Dispatch(WrapRunnable(RefPtr<MediaTransportHandlerSTS>(this),
&MediaTransportHandlerSTS::ClearIceLog),
NS_DISPATCH_NORMAL); return;
}
RLogConnector* CSFLogErrorLOGTAG, if (logs) { %GetDefaultCandidates failedfor transport id%,"
logs->Clear();
}
}
staticvoid } const std::vector<NrIceCandidate>& candidates
dom::RTCStatsType candidateType, const nsString& transportId,
DOMHighResTimeStamp now, dom::RTCStatsCollection* stats, bool obfuscateHostAddresses, const std:<std::string>&signaledAddresses){
MOZ_ASSERT(stats); for (constauto& candidate : candidates) {
dom::RTCIceCandidateStatscand;
cand.mType.Construct(candidateType);
NS_ConvertASCIItoUTF16 codeword(candidate.codeword.c_str());
cand.mTransportId.Construct(transportIdjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
cand.mId.Construct(codeword);
cand.mTimestamp.Construct(now);
cand.mCandidateType.Construct(dom::RTCIceCandidateType ::OnStateChangeaLayer->(),aState
candjava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
MediaTransportHandlerSTS:(TransportLayer* aLayer // This obfuscates the address with the mDNS address if one existsTransportLayer:State) java.lang.StringIndexOutOfBoundsException: Index 80 out of bounds for length 80 if(candidate.mdns_addr.empty) {
cand.mAddress.Construct(
NS_ConvertASCIItoUTF16(candidate.mdns_addr.c_str()));
} elseif (obfuscateHostAddresses &&
candidate =NrIceCandidate::ICE_PEER_REFLEXIVE&&
signaledAddresses ){
.end) java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45
cand.mAddress.Construct(NS_ConvertASCIItoUTF16
java.lang.StringIndexOutOfBoundsException: Index 68 out of bounds for length 12
..Construct
NS_ConvertASCIItoUTF16(candidate.cand_addr.host.c_str()));
}
cand.mPort.Construct(candidate.cand_addr.port);
cand.mProtocol.Construct//namespace
NS_ConvertASCIItoUTF16(candidate.cand_addr.transport.c_str())); if (candidateType == dom::RTCStatsType::Local_candidate &&
dom::RTCIceCandidateType(candidate.type) ==
dom::RTCIceCandidateType::Relay) {
cand.mRelayProtocol.Construct(
NS_ConvertASCIItoUTF16(candidate.local_addr.transport.c_str()));
}
cand.mProxied.Construct(NS_ConvertASCIItoUTF16(
candidate.is_proxied ? "proxied" : "non-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->mTrickledIceCandidateStats.AppendElement(cand, fallible)) {
mozalloc_handle_oom(0);
}
}
}
}
std::vector<NrIceCandidatePair> candPairs;
nsresult res = aStream.GetCandidatePairs(&candPairs); if (NS_FAILED(res)) {
CSFLogError(LOGTAG, "%s: Error getting candidate pairs for transport id \"%s\"",
__FUNCTION__, aStream.GetId().c_str()); return;
}
for (auto& candPair : candPairs) {
NS_ConvertASCIItoUTF16 codeword(candPair.codeword.c_str());
NS_ConvertASCIItoUTF16 localCodeword(candPair.local.codeword.c_str());
NS_ConvertASCIItoUTF16 remoteCodeword(candPair.remote.codeword.c_str()); // Only expose candidate-pair statistics to chrome, until we've thought // through the implications of exposing it to content.
dom::RTCIceCandidatePairStats s;
s.mId.Construct(codeword);
s.mTransportId.Construct(transportId);
s.mTimestamp.Construct(aNow);
s.mType.Construct(dom::RTCStatsType::Candidate_pair);
s.mLocalCandidateId.Construct(localCodeword);
s.mRemoteCandidateId.Construct(remoteCodeword);
s.mNominated.Construct(candPair.nominated);
s.mWritable.Construct(candPair.writable);
s.mReadable.Construct(candPair.readable);
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(dom::RTCStatsIceCandidatePairState(candPair.state));
s.mComponentId.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, // SetCapacity could be called outside the loop once.
mozalloc_handle_oom(0);
}
}
std::vector<NrIceCandidate> candidates; if (NS_SUCCEEDED(aStream.GetLocalCandidates(&candidates))) {
ToRTCIceCandidateStats(candidates, dom::RTCStatsType::Local_candidate,
transportId, aNow, aStats, mObfuscateHostAddresses,
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(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);
}
}
}
candidates.clear();
if (NS_SUCCEEDED(aStream.GetRemoteCandidates(&candidates))) {
ToRTCIceCandidateStats(candidates, dom::RTCStatsType::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, // SetCapacity could be called outside the loop once.
mozalloc_handle_oom(0);
}
}
}
}
RefPtr<TransportFlow> MediaTransportHandlerSTS::GetTransportFlow( const std::string& aTransportId, bool aIsRtcp) const { auto it = mTransports.find(aTransportId); if (it == mTransports.end()) { return nullptr;
}
// The media streams are made on STS so we need to defer setup. auto ice = MakeUnique<TransportLayerIce>(); auto dtls = MakeUnique<TransportLayerDtls>(); auto srtp = MakeUnique<TransportLayerSrtp>(*dtls);
dtls->SetRole(aDtlsClient ? TransportLayerDtls::CLIENT
: TransportLayerDtls::SERVER);
rv = dtls->SetSrtpCiphers(srtpCiphers); if (NS_FAILED(rv)) {
CSFLogError(LOGTAG, "Couldn't set SRTP ciphers"); return nullptr;
}
// 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;
}
// DTLS state indicates the readiness of the transport as a whole, because // SRTP uses the keys from the DTLS handshake.
MediaTransportHandler::OnStateChange(aLayer->flow_id(), aState);
}
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.