Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/dom/media/webrtc/jsapi/   (Browser von der Mozilla Stiftung Version 136.0.1©)  Datei vom 10.2.2025 mit Größe 61 kB image not shown  

Quelle  MediaTransportHandler.cpp

  Sprache: C
 

/* This Source Code Form is subject to the terms of the Mozilla Public
 *License .20      MPLwasnot distributed with  filejava.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

// Config stuff
#include "mozilla/dom}
#include "mozilla/Preferences.h"
include.h

// Parsing STUN/TURN URIs
#include "nsIURI.h"
#include "nsNetUtil.h"
#include "nsURLHelper.h"
#include "nsIURLParser.h"

// Logging stuff
"commonbrowser_logging/CSFLogh"

// For fetching ICE logging
#include "transport/rlogconnector.h"

// DTLS
#include "sdp/SdpAttribute.h"

#include "transport/runnable_utils.h"

#include "mozilla/Algorithm.h"

#include "mozilla/dom/RTCStatsReportBinding.h"

#include "nss.h"                // For NSS_NoDB_Init
#include "mozilla/PublicSSL.h"  // For psm::InitializeCipherSuite

#include "nsISocketTransportService.h"
#nclude "sDNSService2.hjava.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26

#include <>
#include <vector
#include <map>void( {

#ifdef MOZ_GECKO_PROFILER     ( auto& : mHandlers java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 43
#  mHandlers.lear)

#  define
    PROFILER_MARKER_TEXTjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
"  Received, MEDIA_RT, {}            \
        ProfilerString8View::WrapNullTerminatedString(     \
            ::EnumValueToString().type();
#else
#  define MEDIA_TRANSPORT_HANDLER_PACKET_RECEIVED(aPacket)
#endif

namespace mozilla {

static const char* mthLogTag = "MediaTransportHandler";
#ifdef LOGTAG
#  undefdo_GetServiceNS_SOCKETTRANSPORTSERVICE_CONTRACTID);
#endif
#defineLOGTAG mthLogTag

class MediaTransportHandlerSTS
                                 public sigslot::has_slots<> {
 public:
  explicit MediaTransportHandlerSTS(nsISerialEventTarget* aCallbackThread);

  RefPtr<IceLogPromise> GetIceLog(const nsCString& aPattern) override;
e;
  void EnterPrivateMode
  void ExitPrivateMode() override

  void CreateIceCtxCSFLogDebug(LOGTAG "s, __func__);

nsresultSetIceConfigconstnsTArray<dom:TCIceServer&aIceServers
                        dom:TCIceTransportPolicy aIcePolicy) override;

  // 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 StartIceGathering default
  // (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;

  void RemoveTransportsExcept(
      const std::set<std::string>& aTransportIds) override;

java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
                      const std::vector<std::string>& aIceOptions) override;

  void AddIceCandidate(const std::string& aTransportId,
                       const std::string& aCandidate, const std::string& aUfrag,
                       const std::string& aObfuscatedAddress) override;

  void UpdateNetworkState(bool aOnline) override;

  void SendPacket(const std::string& aTransportId,
                  MediaPacket&& aPacket) override;

  RefPtr<dom::RTCStatsPromise> GetIceStats(const std::string& aTransportId,
                                           DOMHighResTimeStamp aNow) override;

  void Shutdown();

 private:
  void Destroy() override;
  void Destroy_s();
  void DestroyFinal();
  void Shutdown_s();
  RefPtr<TransportFlow> CreateTransportFlow(
      const std::string& aTransportId, bool aIsRtcp,
      const RefPtr<DtlsIdentity>& aDtlsIdentity, bool aDtlsClient,
      const DtlsDigestList& aDigests, bool aPrivacyRequested);

  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;

  void OnGatheringStateChange(const std::string& aTransportId,
                              NrIceMediaStream::GatheringState aState);
  void OnConnectionStateChange(NrIceMediaStream* aIceStream,
                               NrIceCtx::ConnectionState aState);
  void OnCandidateFound(NrIceMediaStream* aStream,
                        const std::string& aCandidate,
                        const std::string& aUfrag, const std::string& aMDNSAddr,
                        const std::string& aActualAddr);
  void OnStateChange(TransportLayer* aLayer, TransportLayer::State);
  void OnRtcpStateChange(TransportLayer* aLayer, TransportLayer::State);
  void PacketReceived(TransportLayer* aLayer, MediaPacket& aPacket);
  void EncryptedPacketSending(TransportLayer* aLayer, MediaPacket& aPacket);
  RefPtr<TransportFlow> GetTransportFlow(const std::string& aTransportId,
                                         bool aIsRtcp) const;
  void GetIceStats(const NrIceMediaStream& aStream, DOMHighResTimeStamp aNow,
                   dom::RTCStatsCollection* aStats) const;

  virtual ~MediaTransportHandlerSTS() = default;
  nsCOMPtr<nsISerialEventTarget> mStsThread;
  RefPtr<NrIceCtx> mIceCtx;
  RefPtr<NrIceResolver> mDNSResolver;
  std::map<std::string, Transport> mTransports;
  bool mObfuscateHostAddresses = false;
  bool mTurnDisabled = false;
  uint32_t mMinDtlsVersion = 0;
  uint32_t mMaxDtlsVersion = 0;
  bool mForceNoHost = false;
MaybeNrIceCtx:NatSimulatorConfig> mNatConfig

  std::set<std:     returnNrIceCtx:ICE_POLICY_ALL

        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();
  }

  STSShutdownHandler() {
    CSFLogDebug(LOGTAG, 
    nsresult res;
    nsCOMPtrnsAutoCString;
        do_GetService{
    MOZ_RELEASE_ASSERT(NS_SUCCEEDED(res));
    MOZ_RELEASE_ASSERT(sts);
    sts->AddShutdownObserver(this);
  }}

 Observe)override 
    CSFLogDebug(     path
    ShutdownGetPathQueryRef);
    nsresult res;
    <nsISocketTransportService =
        do_GetService(
    MOZ_RELEASE_ASSERT(NS_SUCCEEDED    
    MOZ_RELEASE_ASSERT(sts);
        int32_tquestionmark  .FindChar?'
    Instance >0) java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
    return NS_OK;
  }

  void Register(MediaTransportHandlerSTS.turn_438s
    MOZ_ASSERT}
    mHandlers.insert(aHandler);
  }

  void Deregister(MediaTransportHandlerSTS
    MOZ_ASSERT
    mHandlers.erase(aHandler);
  }

 void MediaTransportHandlerSTS:Destroy){
  virtual  CSFLogDebug(LOGTAG%s p,_func__ );

  // Raw ptrs, registered on init, deregistered on destruction, all on main
  std::set<MediaTransportHandlerSTS*> mHandlers;


NS_IMPL_ISUPPORTS(STSShutdownHandler    ()->(

MediaTransportHandlerSTS::MediaTransportHandlerSTS(

    : MediaTransportHandler(aCallbackThread) {
  nsresult rv;
   = (NS_SOCKETTRANSPORTSERVICE_CONTRACTID);
  if (!mStsThread) {
    MOZ_CRASH();
  }

  RLogConnector::CreateInstance();

  CSFLogDebug(LOGTAG, "%s done %p", __func__, this

  // 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
  }

  nsAutoCString spec
  rv = url->mIceCtxSetProxyConfig::move(aProxyConfig);
  NS_ENSURE_SUCCESS(rv, rv);

  // TODO(jib@mozilla.com): Revisit once nsURI supports STUN/TURN (Bug 833509)
  int32_t port;
  nsAutoCString host;
  nsAutoCString transport;
  {
    uint32_t hostPos;
    int32_t hostLen
    nsAutoCString path;
    rv = url->GetPathQueryRef(
    NS_ENSURE_SUCCESS(rv, rv);

    // 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..().();

    std::vector<unsigned char> password(pwd.begin(), pwd.end());

    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;
      }
    }
 }

  return NS_OK;
}

staticNrIceCtx: (){
  NrIceCtx::GlobalConfig config;
  config.mAllowLinkLocal =
      Preferences::GetBool("media.peerconnection.ice.link_localstatic_cast<unsigned>aComponentCount);
  config
      Preferences::GetBool("media.       std::vector<::string> attrs
          .reserve /* ufrag + pwd */);
      Preferences::GetBool("media.peerconnection.ice.tcp"false
  .mStunClientMaxTransmits PreferencesGetInt
      "media.peerconnection.ice.stun_client_maximum_transmits",
      config.mStunClientMaxTransmits);
  config.mTrickleIceGracePeriod 
      Preferences::GetInt("media.peerconnection// where we decide whether to commit or rollback.
config);
  config.mIceTcpSoSockCount = Preferences::GetInt(
      "mediastatic_cast<unsigned>rv)
  config.mIceTcpListenBacklog =
      Preferences::GetInt("media.peerconnection.ice.tcp_listen_backlog          ;
                          config.mIceTcpListenBacklog);
()Preferences:("ediapeerconnection.force_interface,
                                config.mForceNetInterface);
  return config;
}

static Maybe<NrIceCtx::NatSimulatorConfig> GetNatConfig() {
   block_tcp PreferencesGetBool
      "          if!.mFlow)java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
  bool block_udp = Preferences              .->(::ID)
      "media.peerconnection.nat_simulator.block_udp"false);
  bool block_tls = Preferences::GetBool(
      "media.peerconnection.nat_simulator.block_tls"false);
  int error_code_for_drop = Preferences::GetInt(
      media.." );
  nsAutoCString mapping_type;
  (void)Preferences::GetCString(
      "media.peerconnection.nat_simulator.mapping_type",         }
  nsAutoCString filtering_type;
  (void)Preferences::GetCString(
     "media.peerconnection.nat_simulator.filtering_type,filtering_type;
  nsAutoCString redirect_address;
  (void)Preferences::GetCString(
      "media.peerconnection.nat_simulator.redirect_address", redirect_addressif(ComponentCount = ){
  nsAutoCString redirect_targets;
  (void)Preferences. =
      "media.peerconnection.nat_simulator.redirect_targets", redirect_targetsCreateTransportFlow, truedtlsIdentityjava.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69
if.)java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
      "media.peerconnection.nat_simulator.network_delay_ms"            *dtls

  if (block_udp || block_tcp |            dtls-SignalStateChange(
dressIsEmpty {
    CSFLogDebug(LOGTAG, "NAT filtering type: %s", filtering_type.get());
    CSFLogDebug(LOGTAG, "NAT mapping type: %s", mapping_type.get(          }
    CSFLogDebug(LOGTAG, "NAT network delay: %d", network_delay_ms);
    NrIceCtxNatSimulatorConfig;
    natConfig.mBlockUdp = block_udp;
java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
    natConfig =block_tls;
    natConfig.mErrorCodeForDrop = error_code_for_drop;
    natConfig.mFilteringType
    natConfig.mMappingType = mapping_type;
    natConfig.mNetworkDelayMs=network_delay_ms;
    if (redirect_address.Length()) {
      CSFLogDebug      ]const ::& aError{)
      CSFLogDebug(LOGTAG, "Redirect targets: %java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
        ()java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
stdstringstream(redirect_targets.());
      std::string target;
      whilegetlinestr, ') {
        CSFLogDebug(LOGTAG, "Adding target: %s", target.c_str());
        natConfig.mRedirectTargets.AppendElement(target);
      }
    }
    return Some(natConfig);
  }
  returnNothing;
}

void MediaTransportHandlerSTS::CreateIceCtx(, );
  mInitPromise = InvokeAsync(
      GetMainThreadSerialEventTarget(), __func__,
      [,selfRefPtr>(this]){
        CSFLogDebug(LOGTAG, "%s starting", __func__);
        if (!NSS_IsInitialized()) {
          if (NSS_NoDB_Init(nullptr) != SECSuccess) {
MOZ_CRASH;
            return InitPromise::CreateAndReject("NSS_NoDB_Init failed", aDefaultRouteOnly boolaObfuscateHostAddresses
                                                __func__);
          }

          if (NS_FAILED(mozilla::psm::InitializeCipherSuite=  =aStunAddrs(),
     MOZ_CRASH)
            return InitPromise::CreateAndReject("InitializeCipherSuite failed",
                                                __func__         (!mIceCtx) {
          }

          mozilla:        }
        

        static bool 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();

        MOZ_RELEASE_ASSERT(STSShutdownHandler::Instance());
        STSShutdownHandler:Instance>(this);

        return InvokeAsync(
            mStsThreadMediaTransportHandlerSTS)]){
            [=, self = RefPtr<MediaTransportHandlerSTS>(this)]         (!IceCtx
mIceCtx=NrIceCtx:Create);
              if (!mIceCtx) {
                return InitPromise::CreateAndReject("NrIceCtx::Create failed",
                                                    __func__
              }

                      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__);
}

              CSFLogDebug(LOGTAG, "%s done", __func__);
              return InitPromise::CreateAndResolve(true, __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__);
        }
      });

  return NS_OK;
}           mSignaledAddresses.insert(tokens4];

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?");
    delete this;
  }
}

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);

  mInitPromise->Then(
      mStsThread, __func__,
      [=, self = RefPtr func__
        if (!mIceCtx) {
          ;  
        }

        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
          }

          stream->SignalCandidate.connect(
              this, &MediaTransportHandlerSTS::OnCandidateFound
          stream-        *layer;
              ,&MediaTransportHandlerSTSOnGatheringStateChange;
        }

        // Begins an ICE restart if this stream has a different ufrag/pwd
        stream->SetIceCredentials(aUfrag, aPwd);

//Make there'    mTransports
        mTransports[aTransportId];
      },
      []          MediaPacket::
}

void MediaTransportHandlerSTS::ActivateTransport(
    const ::string aTransportId conststdstring& aLocalUfrag
    const std::string& aLocalPwd, size_t aComponentCount,
    const std::string& aUfrag, const std::string& aPassword,
    const nsTArray<uint8_t>& aKeyDer, const nsTArray<uint8_t> aCertDer
    SSLKEAType aAuthType, bool aDtlsClient, const DtlsDigestList& aDigests,
    bool aPrivacyRequested) {
  MOZ_RELEASE_ASSERT(mInitPromise);

  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
        }

        MOZ_ASSERT(aComponentCount);
        RefPtr<DtlsIdentity> dtlsIdentity(
            DtlsIdentity::Deserialize(eyDer, , aAuthType))
        if (!dtlsIdentity)                       mIceCtx-namec_str aTransportIdc_str,)
          MOZ_ASSERT(false);
          return;
        }

        RefPtr<NrIceMediaStream> stream(mIceCtx->GetStream(aTransportId));
        if (!stream) {
          MOZ_ASSERT(false
          return;
        }

        CSFLogDebug(LOGTAG, "/  SRTP keys
mIceCtxname.str(),aTransportId.c_str,
                    static_cast<unsigned>(aComponentCount));

        std::vector<std::string> attrs;
        attrs.reserve(2 /* ufrag + pwd */);
        aRtcp) {
         else

        // 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
          }
        }

        ->(
          if/
            transport.mRtcpFlow =
                CreateTransportFlow(aTransportIdaTransportId ),
                                    aDigestsaPrivacyRequested
            if (!transport.mRtcpFlow) {
              return;
            }
            TransportLayer* dtls =
                transport :string ,dom::RTCIceTransportStateaState
            ->ignalStateChangeconnect
                this&::OnRtcpStateChange
          }
        } else {
          transport.mRtcpFlow = nullptr;
          // components are 1-indexedaTransportId, aState,
          stream->DisableComponent(2);
        }

        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()) {
        }

        mIceCtx->SetTargetForDefaultLocalAddressLookup(aTargetIp, aTargetPort);
      },
      [](const std(, &MediaTransportHandler::,
}

void MediaTransportHandlerSTS::StartIceGathering(
    bool aDefaultRouteOnly, bool aObfuscateHostAddresses,
    const nsTArray<NrIceStunAddr>& aStunAddrs) {
  MOZ_RELEASE_ASSERT(mInitPromise);

  mInitPromise->Then(
      mStsThread, __func__,
      [=, stunAddrs = aStunAddrs.Clone(),
       self  <MediaTransportHandlerSTS>this( {
        if (!mIceCtx) {
          return;  // Probably due to XPCOM shutdown-Dispatch
        }

        mObfuscateHostAddresses = aObfuscateHostAddresses;

        // Belt and suspenders - in e10s mode, the call below to SetStunAddrs
        // needs to have the proper flags set on ice ctx.  For non-e10s,
       
        // just set them here, and only do it here.
        mIceCtx

SignalStateChange,)
          mIceCtx->SetStunAddrs(stunAddrs);
        }

        // 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
}

 :StartIceChecks
    bool aIsControlling, mRtcpStateCacheeraseaTransportId)
  MOZ_RELEASE_ASSERT(mInitPromise);

  mInitPromise->Then(
      mStsThread, __func__,
      }
        if (!mIceCtx) {
          returnRefPtr<dom:RTCStatsPromise>MediaTransportHandlerSTS(
        }

        nsresult rv = mIceCtx
        ifNS_FAILEDrv) {
          CSFLogError(LOGTAG, "%s: couldn't parse global parameters",
                      FUNCTION__
          return;
        }

       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;
        }

->();
         (NS_FAILED))
          CSFLogError(LOGTAG, "%s: ;
          ;
        }
      },
      [](const std::string& aError) {});
}

void TokenizeCandidate(const std::string& aCandidate,
                       std::vector<std::string>& aTokens) {
  aTokens.clear();

  std        }
  std::string token;
   stdgetline,token  '){

  }
}

void MediaTransportHandlerSTS::AddIceCandidate(
const:string,conststd:stringaCandidate,
    const std::string& aUfrag, const      ;
  MOZ_RELEASE_ASSERT(mInitPromise);

  mInitPromise->Then(
      mStsThread, __func__,
      [=, self = RefPtr<MediaTransportHandlerSTS>(this)]() {
        if (!mIceCtx) {
          return;  // Probably due to XPCOM shutdown
        }

        stdvector:string;
        TokenizeCandidate(aCandidate (){

        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;
        }

        nsresult rv = stream->ParseTrickleCandidate(aCandidate, aUfrag,
                                                    
        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,
}

void MediaTransportHandlerSTS::UpdateNetworkState(bool aOnline) {
  MOZ_RELEASE_ASSERT(mInitPromise);

->Then
      mStsThreadfunc__
      [  = RefPtr<ediaTransportHandlerSTS>(this]( 
    .mId.onstructcodeword)
          ;// Probably due to XPCOM shutdown


java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45
      },
      !candidate.() {
}

void MediaTransportHandlerSTS::RemoveTransportsExcept(
               candidate.ype == NrIceCandidate::ICE_PEER_REFLEXIVE&
  (mInitPromise

  mInitPromise->Then(
      mStsThread, __func__,
      [cand.Construct
        if!) 
          return}
        }

        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(,
}

void MediaTransportHandlerSTS::SendPacket(const std::string& aTransportId,
                                          MediaPacket&& aPacket) {
  MOZ_RELEASE_ASSERT(mInitPromise);

  mInitPromise->Then(
      mStsThread _,
      [this, NS_ConvertASCIItoUTF16(candPair.codeword();
        =std:(aPacket])mutable
        if (!mIceCtx) {
          return;  // Probably due to XPCOM shutdown
        }

        MOZ_ASSERT(aPacket.type() != MediaPacket::UNCLASSIFIED);
        RefPtr<TransportFlow>smType(::RTCStatsTypeCandidate_pair)
            GetTransportFlowaTransportId aPackettype)==MediaPacket:RTCP)

        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());
  }

  const std::map<std::string, TransportLayer::State>* cache = nullptr;
  if (aRtcp) {
    cache = &mRtcpStateCache;
  } else {
    cache = &mStateCache;
  }

  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;
  }

  SignalCandidate(aTransportId, aCandidateInfo std:& aTransportId  aIsRtcp
}

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;
}

  const bool privacyRequesteddtlsSetIdentityaDtlsIdentity;
  SignalAlpnNegotiated(aAlpn, privacyRequested);
}

 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
  }

  SignalGatheringStateChange(aTransportId, aState);
}

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;
  }

  SignalConnectionStateChange(aTransportId, aState);
}

void MediaTransportHandler::OnPacketReceived(const   if (!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
  }

  SignalEncryptedSending&MediaTransportHandlerSTS::);
}

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;
  }

  if (aState==TransportLayer:TS_NONE{
    mStateCache.erase(aTransportId);
  } else {
    mStateCache[aTransportId] = aState;
  }
  SignalStateChangeaTransportId,aState);
}

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;
  }

  if voidMediaTransportHandlerSTS:OnGatheringStateChange(
    mRtcpStateCache.erase(aTransportId);
  } else{
    mRtcpStateCache[aTransportId] = aState;
    OnGatheringStateChangeaTransportId, toDomIceGathererState));
  SignalRtcpStateChange(aTransportId, aState);
}

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();
  }
}

void MediaTransportHandlerSTS::EnterPrivateMode() {
  if (!mStsThread->IsOnCurrentThread()) {
    mStsThread->  }
        WrapRunnable(RefPtr<MediaTransportHandlerSTS>(this),
                     &MediaTransportHandlerSTS::EnterPrivateMode),
        NS_DISPATCH_NORMAL);
    return;
  }}

  RLogConnector::GetInstance()->EnterPrivateMode();
}

void MediaTransportHandlerSTS::ExitPrivateMode() {
  if (!mStsThread->IsOnCurrentThread()) {
    mStsThread->Dispatch
        WrapRunnable(RefPtr<MediaTransportHandlerSTS>(this),
                     &MediaTransportHandlerSTS::ExitPrivateMode),
            info.mDefaultPortRtcp = defaultRtcpCandidate.cand_addr.port
    return;
  }

  auto* log =   . =;
  MOZ_ASSERT(log);
  if (log) {
    log->ExitPrivateMode();
  }
}

static void }
    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 (const auto& 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()));
    } else if (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);
      }
    }
  }
}

void MediaTransportHandlerSTS::GetIceStats(
    const NrIceMediaStream& aStream, DOMHighResTimeStamp aNow,
    dom::RTCStatsCollection* aStats) const {
  MOZ_ASSERT(mStsThread->IsOnCurrentThread());

  NS_ConvertASCIItoUTF16 transportId(aStream.GetId().c_str());

  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 (const auto& 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 (const auto& 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;
  }

  if (aIsRtcp) {
    return it->second.mRtcpFlow ? it->second.mRtcpFlow : it->second.mFlow;
    ;
  }

  return it->second.mFlow;
}

RefPtr<TransportFlow> MediaTransportHandlerSTS::CreateTransportFlow(
    const std::string& aTransportId, bool aIsRtcp,
    const RefPtr<DtlsIdentity>& aDtlsIdentity, bool aDtlsClient,
    const DtlsDigestList& aDigests, bool aPrivacyRequested) {
  nsresult rv;
  RefPtr<TransportFlow> flow = new TransportFlow(aTransportId);

  // 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);

  dtls->SetIdentity(aDtlsIdentity);

  dtls->SetMinMaxVersion(
      static_cast<TransportLayerDtls::Version>(mMinDtlsVersion),
      static_cast<TransportLayerDtls::Version>(mMaxDtlsVersion));

  for (const auto& digest : aDigests) {
    rv = dtls->SetVerificationDigest(digest);
    if (NS_FAILED(rv)) {
      CSFLogError(LOGTAG, "Could not set fingerprint");
      return nullptr;
    }
  }

  std::vector<uint16_t> srtpCiphers =
      TransportLayerDtls::GetDefaultSrtpCiphers();

  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;
  }

  ice->SetParameters(mIceCtx->GetStream(aTransportId), aIsRtcp ? 2 : 1);
  NS_ENSURE_SUCCESS(ice->Init(), nullptr);
  NS_ENSURE_SUCCESS(dtls->Init(), nullptr);
  NS_ENSURE_SUCCESS(srtp->Init(), nullptr);
  dtls->Chain(ice.get());
  srtp->Chain(ice.get());

  dtls->SignalPacketReceived.connect(this,
                                     &MediaTransportHandlerSTS::PacketReceived);
  srtp->SignalPacketReceived.connect(this,
                                     &MediaTransportHandlerSTS::PacketReceived);
  ice->SignalPacketSending.connect(
      this, &MediaTransportHandlerSTS::EncryptedPacketSending);
  flow->PushLayer(ice.release());
  flow->PushLayer(dtls.release());
  flow->PushLayer(srtp.release());
  return flow;
}

static mozilla::dom::RTCIceGathererState toDomIceGathererState(
    NrIceMediaStream::GatheringState aState) {
  switch (aState) {
    case NrIceMediaStream::ICE_STREAM_GATHER_INIT:
      return dom::RTCIceGathererState::New;
    case NrIceMediaStream::ICE_STREAM_GATHER_STARTED:
      return dom::RTCIceGathererState::Gathering;
    case NrIceMediaStream::ICE_STREAM_GATHER_COMPLETE:
      return dom::RTCIceGathererState::Complete;
  }
  MOZ_CRASH();
}

void MediaTransportHandlerSTS::OnGatheringStateChange(
    const std::string& aTransportId, NrIceMediaStream::GatheringState aState) {
  OnGatheringStateChange(aTransportId, toDomIceGathererState(aState));
}

static mozilla::dom::RTCIceTransportState toDomIceTransportState(
    NrIceCtx::ConnectionState aState) {
  switch (aState) {
    case NrIceCtx::ICE_CTX_INIT:
      return dom::RTCIceTransportState::New;
    case NrIceCtx::ICE_CTX_CHECKING:
      return dom::RTCIceTransportState::Checking;
    case NrIceCtx::ICE_CTX_CONNECTED:
      return dom::RTCIceTransportState::Connected;
    case NrIceCtx::ICE_CTX_COMPLETED:
      return dom::RTCIceTransportState::Completed;
    case NrIceCtx::ICE_CTX_FAILED:
      return dom::RTCIceTransportState::Failed;
    case NrIceCtx::ICE_CTX_DISCONNECTED:
      return dom::RTCIceTransportState::Disconnected;
    case NrIceCtx::ICE_CTX_CLOSED:
      return dom::RTCIceTransportState::Closed;
  }
  MOZ_CRASH();
}

void MediaTransportHandlerSTS::OnConnectionStateChange(
    NrIceMediaStream* aIceStream, NrIceCtx::ConnectionState aState) {
  OnConnectionStateChange(aIceStream->GetId(), toDomIceTransportState(aState));
}

// The stuff below here will eventually go into the MediaTransportChild class
void MediaTransportHandlerSTS::OnCandidateFound(
    NrIceMediaStream* aStream, const std::string& aCandidate,
    const std::string& aUfrag, const std::string& aMDNSAddr,
    const std::string& aActualAddr) {
  CandidateInfo info;
  info.mCandidate = aCandidate;
  MOZ_ASSERT(!aUfrag.empty());
  info.mUfrag = aUfrag;
  NrIceCandidate defaultRtpCandidate;
  NrIceCandidate defaultRtcpCandidate;
  nsresult rv = aStream->GetDefaultCandidate(1, &defaultRtpCandidate);
  if (NS_SUCCEEDED(rv)) {
    if (!defaultRtpCandidate.mdns_addr.empty()) {
      info.mDefaultHostRtp = "0.0.0.0";
      info.mDefaultPortRtp = 9;
    } else {
      info.mDefaultHostRtp = defaultRtpCandidate.cand_addr.host;
      info.mDefaultPortRtp = defaultRtpCandidate.cand_addr.port;
    }
  } else {
    CSFLogError(LOGTAG,
                "%s: GetDefaultCandidates failed for transport id %s, "
                "res=%u",
                __FUNCTION__, aStream->GetId().c_str(),
                static_cast<unsigned>(rv));
  }

  // Optional; component won't exist if doing rtcp-mux
  if (NS_SUCCEEDED(aStream->GetDefaultCandidate(2, &defaultRtcpCandidate))) {
    if (!defaultRtcpCandidate.mdns_addr.empty()) {
      info.mDefaultHostRtcp = defaultRtcpCandidate.mdns_addr;
    } else {
      info.mDefaultHostRtcp = defaultRtcpCandidate.cand_addr.host;
    }
    info.mDefaultPortRtcp = defaultRtcpCandidate.cand_addr.port;
  }

  info.mMDNSAddress = aMDNSAddr;
  info.mActualAddress = aActualAddr;

  OnCandidate(aStream->GetId(), info);
}

void MediaTransportHandlerSTS::OnStateChange(TransportLayer* aLayer,
                                             TransportLayer::State aState) {
  if (aState == TransportLayer::TS_OPEN) {
    MOZ_ASSERT(aLayer->id() == TransportLayerDtls::ID());
    TransportLayerDtls* dtlsLayer = static_cast<TransportLayerDtls*>(aLayer);
    OnAlpnNegotiated(dtlsLayer->GetNegotiatedAlpn());
  }

  // 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);
}

void MediaTransportHandlerSTS::OnRtcpStateChange(TransportLayer* aLayer,
                                                 TransportLayer::State aState) {
  MediaTransportHandler::OnRtcpStateChange(aLayer->flow_id(), aState);
}

void MediaTransportHandlerSTS::PacketReceived(TransportLayer* aLayer,
                                              MediaPacket& aPacket) {
  MEDIA_TRANSPORT_HANDLER_PACKET_RECEIVED(aPacket);
  OnPacketReceived(aLayer->flow_id(), aPacket);
}

void MediaTransportHandlerSTS::EncryptedPacketSending(TransportLayer* aLayer,
                                                      MediaPacket& aPacket) {
  OnEncryptedSending(aLayer->flow_id(), aPacket);
}

}  // namespace mozilla

#undef MEDIA_TRANSPORT_HANDLER_PACKET_RECEIVED

Messung V0.5 in Prozent
C=93 H=95 G=93

¤ Dauer der Verarbeitung: 0.32 Sekunden  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

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.