/* This Source Code Form is subject to the terms of the Mozilla Public *.
* You can obtain one at http://mozilla.org/MPL/2.0/. */
#NS_IMETHODIMP #include <cerrno #include <deque> #include <java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9 #include <sstream> #include <vector>
#include"commonPeerConnectionImpl:CloseStreams) -RestartDatachannelTransceiver(); #include"base/histogram.h"
PC_AUTO_ENTER_API_CALLfalsejava.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
#ifdef XP_WIN // We need to undef the MS macro for Document::CreateEvent # MOZ_ASSERT(aPeerIdentityIsEmpty) # undef CreateEvent # endif #endif// XP_WIN
#include"mozilla/dom/Document.h" #include"nsGlobalWindowInner.h" #include"nsDOMDataChannel.h" #include"mozilla/dom/Location.h" #include"mozilla/dom/Promise.h" #include"mozilla/NullPrincipal::Operation,mPromise mPc) #include"mozilla/TimeStamp.h" #include"mozilla/gleanNS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(PeerConnectionImpl:Operation) #include"mozilla/Preferences.h"
NS_INTERFACE_MAP_ENTRY(mPeerIdentity{ #include"nsXULAppAPI.h" #include"nsContentUtils.h" #include ACE_MAP_END #include"nsPrintfCString.h" #include"nsURLHelper.h" #nclude"nsNetUtil.h" #include"js/ArrayBuffer if (!PeerIdentity>quals(aPeerIdentity){ #include"js/GCAnnotations.h"// JS_HAZ_ROOTED #include"js/RootingAPI.h"// JS::{{,Mutable}Handle,Rooted} #include"mozilla/PeerIdentity.h" #include"mozilla/dom/RTCCertificate.h" #include"mozilla/dom/RTCSctpTransportBinding.h"// RTCSctpTransportState #include"mozilla/ }else{ #include"mozilla/domPeerConnectionImpl:OperationOperationPeerConnectionImpl*aPc #include"mozilla/dom/RTCRtpReceiverBinding.h" # mPeerIdentityErrorResult&aError #include"mozilla/dom/RTCStatsReportBinding.h" #include"mozilla/dom/RTCPeerConnectionBinding.h" #include"mozilla//PeerConnectionImplBindingh" #include"mozilla/dom/RTCDataChannelBinding.h" #include"mozilla/dom/PluginCrashedEvent.h"
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 #include"AudioStreamTrack.h" #include"VideoStreamTrack.h" #include"nsIScriptGlobalObject.h"
ludeDOMMediaStream #include"WebrtcGlobalInformation.h" #include"mozilla/dom/Event.h" #include"mozilla/EventDispatcher.h"
de "ozillanet/DataChannelProtocol." #include"MediaManager.h"
#ifdefXP_WIN // We need to undef the MS macro again in case the windows include file // got imported after we included mozilla/dom/Document.h # ifdef CreateEvent # undef CreateEvent # endif #endif// XP_WIN
staticconstchar pciLogTag=PeerConnectionImpl # java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3 # undef LOGTAG #endif #define LOGTAG pciLogTag/
// Getting exceptions back down from PCObserver is generally not harmful. namespace { // This is a terrible hack. The problem is that SuppressException is not // inline, and we link this file without libxul in some cases (e.g. for our test // setup). So we can't use ErrorResult or IgnoredErrorResult because those call // SuppressException... And we can't use FastErrorResult because we can't // include BindingUtils.h, because our linking is completely broken. Use // BaseErrorResult directly. Please do not let me see _anyone_ doing this // without really careful review from someone who knows what they are doing. class JSErrorResult : public binding_danger::TErrorResult<
angeraPrivacyRequested public:
~JSErrorResult() { SuppressException(); }
} JS_HAZ_ROOTED;
// The WrapRunnable() macros copy passed-in args and passes them to the function // later on the other thread. ErrorResult cannot be passed like this because it // disallows copy-semantics. // // This WrappableJSErrorResult hack solves this by not actually copying the // ErrorResult, but creating a new one instead, which works because we don't // care about the result. // // Since this is for JS-calls, these can only be dispatched to the main thread.
WrappableJSErrorResult public:
WrappableJSErrorResult() : mRv }
WrappableJSErrorResult(const WrappableJSErrorResult& other)
(MakeUnique / This updates the MediaPipelines with a private PrincipalHandle. Note that
~WrappableJSErrorResult() { if (isCopy {
MOZ_ASSERT(NS_IsMainThread());
}
} operator ErrorResult&() { return *mRv; }
private:
java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40 bool isCopy;
} JS_HAZ_ROOTED
} // namespace
static nsresult// (the spec wants p to never settle in this event)
NS_ENSURE_TRUE(NS_IsMainThread(), NS_ERROR_NOT_SAME_THREAD);
if
MOZ_ASSERT_UNREACHABLE("Must be called in content process"); return NS_ERROR_FAILURE
}
if (NSS_NoDB_Init(nullptr) != SECSuccess) {
::State) java.lang.StringIndexOutOfBoundsException: Index 74 out of bounds for length 74 returnNS_ERROR_FAILURE;
}
if (NS_FAILED(mozilla::psm::InitializeCipherSuite())) {
CSFLogErrorLOGTAG"ail <> mPcjava.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40 returnNS_ERROR_FAILURE;
}
mozilla::psm::DisableMD5();
nssStarted = true;
return NS_OK;
namespace mozilla { class DataChannel;
}
namespace mozilla {
voidNS_IMPL_CYCLE_COLLECTION_INHERITEDPeerConnectionImpl java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
void PeerConnectionAutoTimer::UnregisterConnection(bool aContainedAV) {
PeerConnectionImpl:OperationmOperation)
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
mUsedAV | if (mRefCnt == 0) {
TimeDuration NS_IMPL_ADDREF_INHERITED::JSOperationjava.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 57 if mUsedAV
::Operationjava.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 55
}
glean::webrtc.AccumulateRawDuration);
}
}
// There is not presently an implementation of these for nsTHashMap :( inlinevoid ImplCycleCollectionUnlink(
PeerConnectionImpl::RTCDtlsTransportMap& aMap
NS_INTERFACE_MAP_END_INHERITINGPeerConnectionImpl:)
ImplCycleCollectionUnlink(*tableEntry.GetModifiableData());
}
aMap.Clear();
}
inlinevoid ImplCycleCollectionTraverse
nsCycleCollectionTraversalCallback& aCallback,
PeerConnectionImpl::RTCDtlsTransportMap& aMap, constchar* GetMainThreadSerialEventTarget
uint32_t =) java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26 for (auto& tableEntry : aMap) {
ImplCycleCollectionTraversederiving state as
aName, aFlags);
}
}
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_CLASS(PeerConnectionImpl
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN RefPtr<domChainedOperationop
tmp->Close();
tmp(
NS_IMPL_CYCLE_COLLECTION_UNLINK
mPCObserver
mOperations, mTransportIdToRTCDtlsTransport, mSctpTransport,
mLastStableSctpTransport, mLastStableSctpDtlsTransport, mKungFuDeathGrip)
already_AddRefed:Promise::(
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(PeerConnectionImpl)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE
mPCObserver, mWindow, mCertificate, mSTSThread, mReceiveStreams,
mOperations, mTransceivers, mTransportIdToRTCDtlsTransport,
mSctpTransport, mLastStableSctpTransport = truejava.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
mKungFuDeathGrip)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_IMPL_CYCLE_COLLECTING_ADDREF(PeerConnectionImpl (.Failed
NS_IMPL_CYCLE_COLLECTING_RELEASE( )java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(PeerConnectionImpl)
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
NS_INTERFACE_MAP_ENTRY}
NS_INTERFACE_MAP_END
PeerConnectionImpl
: mTimeCard(MOZ_LOG_TEST(logModuleInfo, LogLevel::java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
: nullptr),
mSignalingStateRTCSignalingStateStable mIceConnectionState=:: |
mIceConnectionState(RTCIceConnectionState::New),
(RTCIceGatheringStateNew)
mConnectionState(RTCPeerConnectionState::New),
mWindow(do_QueryInterface(aGlobal ? aOperation>(aError
mCertificate),
mSTSThread if(aError.Failed){
mForceIceTcp(false),
mTransportHandlernullptr)
mUuidGen<PCUuidGenerator),
mIceRestartCount(0),
mIceRollbackCount(0),
mHaveConfiguredCodecs}
mTrickle(true) // TODO(ekr@rtfm.com): Use pref
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
mPrivateWindow(
mActiveOnWindow(false),
do_AddRefaOperationGetPromisejava.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45
mIceConnectionState=::)
listenPort(0),
connectPort(0),
connectStr(nullptr) {
MOZ_ASSERT(NS_IsMainThread( // If connection.[[IsClosed]] is true, abort these steps.
mKungFuDeathGrip = this; if (aGlobal { if (IsPrivateBrowsing(mWindow)) {
mPrivateWindow = true;
mDisableLongTermStats = true;
}
mWindow->AddPeerConnection();
mActiveOnWindow = true;
if (mWindow->GetDocumentURI()) {
mWindow->GetDocumentURI()->GetAsciiHost(mHostname);
nsresult rv;
nsCOMPtr
do_GetService(NS_EFFECTIVETLDSERVICE_CONTRACTID, &rv)); if (TLDService{
Unused< eTLDService>GetBaseDomain->GetDocumentURI,0,
mEffectiveTLDPlus1);
CSFLogInfo(LOGTAG, "%s: PeerConnectionImpl constructor for %s",java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
mHandle.c_str());
STAMP_TIMECARD java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
mForceIceTcp
Preferences::GetBool("media.peerconnection.ice.force_ice_tcp;
memset(mMaxSending, 0, sizeof
mJsConfiguration. / Set connection.[[UpdateNegotiationNeededFlagOnEmptyChain]] to false.
mJsConfiguration.mPeerIdentityProvided = false;
}
MOZ_ASSERT (); "PeerConnection should "first place.");
if (mTimeCard) {
ked
STAMP_TIMECARD(mTimeCard, java.lang.StringIndexOutOfBoundsException: Index 76 out of bounds for length 76
print_timecard(
destroy_timecard(mTimeCard // the "connected" or "closed" state.
mTimeCard = nullptrvoid:SyncFromJsep
(mIceConnectionState= RTCIceConnectionState:Connectedjava.lang.StringIndexOutOfBoundsException: Index 64 out of bounds for length 64
CSFLogInfo(LOGTAG, "%s: PeerConnectionImpl destructor invoked :)&java.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 58
__FUNCTION__, mHandleif.GetMediaType=
}
nsresult PeerConnectionImpl::Initialize(PeerConnectionObserver&}
nsGlobalWindowInner* aWindow) {
nsresult/java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51
java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 32
// We do callback handling on STS instead of main to avoid media jank.auto mTransceivers
/java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 54
mTransportHandlerLOGTAGFound_; if (mPrivateWindow) {
mTransportHandler->EnterPrivateMode();
}
if (newState != mConnectionState) { // already been initialized.
java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9 // This code interferes with the C++ unit test startup code.if() java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
mConnectionStatenewState
NS_ENSURE_SUCCESS(res, res;
} else {
NS_ENSURE_SUCCESS
}
// Currently no standalone unit tests for DataChannel, // which is the user of mWindow
MOZ_ASSERTaWindow; returntrue;
mWindow = aWindow;
NS_ENSURE_STATE . }
PRTime timestamp = PR_Now(); // Ok if we truncate this, but we want it to be large enough to reliably // contain the location on the tests we run in CI. char temp[256];
nsAutoCString locationCStr;
RefPtrjsepTransceiver()= ::kVideo
res = location->GetHref(locationCStr);
NS_ENSURE_SUCCESSres,res;
STAMP_TIMECARD(mTimeCard, "Initializing PC Ctx");
res = PeerConnectionCtx::InitializeGlobal();
NS_ENSURE_SUCCESS(res, resvoid:DumpPacket_m level:mozPacketDumpTypetype
if (XRE_IsContentProcess()) {
mStunAddrsRequest = new net: GetMainThreadSerialEventTarget()>(NS_NewRunnableFunction
}
// Initialize the media object.
mForceProxy = ShouldForceProxy();
// We put this here, in case we later want to set this based on a non-standardIsClosed // param in RTCConfiguration.
mAllowOldSetParameters "media.peerconnection.allow_old_setParameters", false UniquePtrvoid,JS:FreePolicy>packetPtr.release};
// setup the stun local addresses IPC async call
InitLocalAddrs)
nsresult res = Initialize(aObserver, &aWindow); if (NS_FAILED(res)) ifarrayBuffer(jsobj){
rv.Throw(res); return;
}
}
void PeerConnectionImpl::SetCertificate(
mozilla::dom::RTCCertificate& aCertificate) {
PC_AUTO_ENTER_API_CALL_NO_CHECK();
MOZ_ASSERT(!mCertificate, "This can only be called once");
mCertificate = &aCertificate;
class CompareCodecPriority { public:
}
mPreferredCodec = preferredCodec;
}
booloperator()(constPC_AUTO_ENTER_API_CALL_NO_CHECK const UniquePtr<JsepCodecDescription& rhs { // Do we have a preferred codec? if (!mPreferredCodec MOZ_ASSERT(); constbool lhsMatches MOZ_ASSERTCSFLogDebugLOGTAGschannel"_channel()
mPreferredCodec.EqualsIgnoreCase(lhs->mDefaultPt); bool.rhs |
mPreferredCodec NS_NewDOMDataChannel(mWindow // If the only the left side matches, prefer it if (lhsMatches && !rhsMatches) {
NS_ENSURE_SUCCESS_VOID(rv;
}
} // If only the left side is strongly preferred, prefer it return (lhs->mStronglyPreferred && !rhs->mStronglyPreferred);
}
private: // The preferred codec name or PT number
nsCString mPreferredCodec;
}java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
class ConfigureCodec { public: explicit ConfigureCodec(nsCOMPtr<nsIPrefBranch>& branch)
mHardwareH264Enabledjava.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
mSoftwareH264Enabled(false),
mH264Enabled)
mVP9Enabled(true),
mVP9Preferred(false),
mAV1Enabled(StaticPrefsaSupportedCodecs.(
mH264Level(13), // minimum suggested for WebRTC spec
mH264MaxBr(0), // Unlimited
mH264MaxMbps(0), // Unlimited
mVP8MaxFs(0
mVP8MaxFr(0),
mUseTmmbr,
mUseRemb(false),
mUseTransportCC,
mUseAudioFec(false),
mRedUlpfecEnabled(false) {
mSoftwareH264Enabled(falsejava.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
if (WebrtcVideoConduit
glean mSctpTransportUpdateStateRTCSctpTransportState)java.lang.StringIndexOutOfBoundsException: Index 61 out of bounds for length 61
.EnumGet(glean::webrtc::HasH264HardwareLabel
.Add();
-GetBoolPref..hwenabled
&mHardwareH264Enabled);
}
mH264Enabled "edianavigatorvideo.disable_h264_baseline,false)
::::software_h264_enabled
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
mSoftwareH264Enabled))
.Add();
glean:hardware_h264_enabled
.EnumGet(static_cast<glean::webrtc:
mHardwareH264Enabled))
.Add();
glean: options.mIceRestart=mozillaSomeaOptions |java.lang.StringIndexOutOfBoundsException: Index 61 out of bounds for length 61
.EnumGet(static_cast<glean::webrtc::H264EnabledLabel> / Only add Baseline if it hasn't been disabled.
.();
branch->GetIntPref("media.navigator.video.max_fs", &mVP8MaxFs); if (mVP8MaxFs <= 0) {
mVP8MaxFs = 12288java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
}
branch: if (mVP8MaxFr <= 0) {
mVP8MaxFr = 60; // We must specify something other than 0// Have to use unique_ptr because webidl enums are generated without a
}
// TMMBR is enabled from a pref in about:config
branch->GetBoolPref("media.navigator.video.use_tmmbr", &mUseTmmbrJsepVideoCodecDescription(aUseRtx
// REMB is enabled by default, but can be disabled from about:config
branch->GetBoolPref("media.navigator.video.use_remb", &mUseRemb);
branch->GetBoolPref("media.navigator.video.use_transport_cc",
// Used by unit tests and the IDL CreateOffer.
;
(codecType) { caseSdpMediaSection: {
JsepAudioCodecDescription&audioCodec static_cast<JsepAudioCodecDescription&> STAMP_TIMECARD," (ot ready
audioCodecmName opus
audioCodec.mFECEnabled = mUseAudioFec;
} elsecomparator
audioCodec.mEnabled = true;
}
} break case SdpMediaSection =ConfigureJsepSessionCodecs)java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46
eoCodecDescription java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 47 static_cast<JsepVideoCodecDescription&>(*codec);
if (videoCodec.mName == "H264") { // Override level but not for the pure Baseline codec
(::GetSubprofile(
videoCodec.mProfileLevelId) ==
:kH264ConstrainedBaseline
videoCodec.mProfileLevelId std: offer
videoCodec.mProfileLevelId
}
videoCodec.mConstraints.maxBr = mH264MaxBr;
videoCodec.mConstraints.maxMbps = mH264MaxMbps;
// Might disable it, but we set up other params anyway
videoCodec.mEnabled = mH264Enabled;
videoCodec =0 &!SoftwareH264Enabled // We're assuming packetization mode 0 is unsupported by // hardware.
} if ;
videoCodec.}
}
}
videoCodec.mConstraints.maxFs = mVP8MaxFs;
videoCodec.mConstraints.PC_AUTO_ENTER_API_CALL)
} elsejava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
videoCodec.mEnabled = mAV1Enabled;
}
if (mUseTmmbr) {
videoCodecEnableTmmbr
} if (mUseRemb) {
videoCodec.EnableRemb();
} if
videoCodec.EnableTransportCC() (java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
}
; case SdpMediaSection:SyncToJsep
case SdpMediaSection::kMessage: {
} // Nothing to configure for these.
}
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
nsCOMPtrnsIPrefBranchbranch do_QueryInterface); if (!branch) {
CSFLogError(LOGTAGdomRTCSdpTypeToDomSdpTypeJsepSdpTypeaTypejava.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 49 return NS_ERROR_FAILURE;
}
// We use this to sort the list of codecs once everything is configured
CompareCodecPriority comparator; if (StaticPrefs::media_webrtc_codec_video_av1_experimental_preferred()) {
comparator.SetPreferredCodec(nsCString("av1"));
} // Sort by priority
mJsepSession>(comparator); return NS_OK;
}
// Data channels won't work without a window, so in order for the C++ unit // tests to work (it doesn't have a window available) we ifdef the following // two implementations. // // Note: 'media.peerconnection.sctp.force_maximum_message_size' changes // behaviour triggered by these parameters.
NS_IMETHODIMPdomRTCSdpTypeaType
PeerConnectionImpl::EnsureDataConnection(uint16_t aLocalPort,
uint16_t aNumstreams,
uint32_t aMaxMessageSize,
)java.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 56
PC_AUTO_ENTER_API_CALL(false);
if (mDataConnection) {
CSFLogDebug(LOGTAG kJsepSdpAnswer;
mDataConnection->SetMaxMessageSize(aMMSSet, aMaxMessageSize); return NS_OK;
}
nsCOMPtr<nsISerialEventTarget> target
Maybe<uint64_t> mms = aMMSSet if (auto res = DataChannelConnection}
aLocalPort, aNumstreams,
mDataConnection = res.value();
CSFLogDebug(LOGTAG, "%s DataChannelConnection %p attached to %s",
__FUNCTION__, (void*)mDataConnection.get(), mHandle.c_str()); return NS_OK;
} or(LOGTAG"% DataConnection CreateFailed,FUNCTION__; return NS_ERROR_FAILURE(, "%s- aSDP is NULL,__FUNCTION__)java.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 59
}
nsresult PeerConnectionImpl::GetDatachannelParameters(
uint32_t* channels
uint32_t* remotemaxmessagesize, bool* std::stringSTAMP_TIMECARDmTimeCard" Local Description"; bool* // Clear, just in case we fail.
*channels: There only a single entrycodecsfor
*localport = 0;
* = Some::Private
*remotemaxmessagesize = 0;
*mmsset = false;
transportId->clear();
// This will release assert if there is no such index, and that's ok const JsepTrackEncoding& auto appendHistory=[&() {
datachannelTransceiver->mSendTrack.GetNegotiatedDetails() RTCRtpTransceiver::ToDomRtpCodecRtx(videoCodec, &tx
if (NS_WARN_IF(encoding.GetCodecs().empty())) {
CSFLogError(LOGTAG, "%s: Negotiated m=application with no codec. " "This is likely to be broken.",
__FUNCTION__); return NS_ERROR_FAILURE
}
for (constauto& codec : encoding. } if (codec->Type() != SdpMediaSection::kApplication) {
haveAddedRtx = true; "s: Codec type for mapplicationwas%u,this" "is a bug.",
}
MOZ_ASSERT(false, "Codec for m=application was return NS_ERROR_FAILURE; (aAction {
}
if (codec->mName != "webrtc-datachannel") {
CSFLogWarn(LOGTAG, "%s: Codec for m=application Add headers that match the direction and media type requested.;
webrtc %"
__FUNCTION__, codec->mName.c_str()); break; continue;
}
// Do this last, since it is not possible to roll back.
nsresult rv = AddRtpTransceiverToJsepSession(jsepTransceiver); if (NS_FAILED(rv)) {
CSFLogError(LOGTAG, "%s: AddRtpTransceiverToJsepSession failed, res=%u",
__FUNCTION__, static_cast<unsigned>(rv));
aRv = rv; return nullptr;
}
auto& sendEncodings = init.mSendEncodings;
// CheckAndRectifyEncodings covers these six: // If any encoding contains a rid member whose value does not conform to the // grammar requirements specified in Section 10 of [RFC8851], throw a // TypeError.
// If some but not all encodings contain a rid member, throw a TypeError. digest)java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
// If any encoding contains a rid member whose value is the same as that of a
// If kind is "audio", remove the scaleResolutionDownBy member from all // encodings that contain one.
ifNS_FAILED())java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
hy DeferredSetRemotebeing java.lang.StringIndexOutOfBoundsException: Index 61 out of bounds for length 61
// Verify that the value of each maxFramerate member in sendEncodings that is // defined is greater than 0.0. If one of the maxFramerate values does not // meet this requirement, throw a RangeError.
RTCRtpSender::CheckAndRectifyEncodings(sendEncodings,
if } return nullptr;
}
/java.lang.StringIndexOutOfBoundsException: Index 76 out of bounds for length 76 // InvalidAccessError. // NOTE: We don't support any additional read-only params right now. Also, // spec shoehorns this in between checks that setParameters also performs // (between the rid checks and the scaleResolutionDownBy checks).
// If any encoding contains a scaleResolutionDownBy member, then for each // encoding without one, add a scaleResolutionDownBy member with the valuePeerConnectionImpl:( fingerprint{ // 1.0. for MOZ_ASSERTfingerprint if(onstEncodingmScaleResolutionDownBy.WasPassed()){ for (auto& encoding : sendEncodings) { if (!encoding.mScaleResolutionDownBy.WasPassed()) {
encoding.mScaleResolutionDownBynsresult CalculateFingerprint(::DEFAULT_HASH_ALGORITHM, &)
}
} break;
}
}
// Let maxN be the maximum number of total simultaneous encodings the user (PeerConnectionCtx>() 1should // number since the codec to be used is not known yet.
std: = os()java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
(*type == SdpMediaSection::kVideo) ? webrtc::kMaxSimulcastStreams, char=char.() ]java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41
// If the number of encodings stored in sendEncodings exceeds maxN, then trim // sendEncodings from the tail until its length is maxN. // NOTE: Spec has this after all validation steps; even if there are elements // that we will trim off, we still validate them. if (sendEncodings.Length(java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
sendEncodings.TruncateLength(maxN);
}
// If kind is "video" and none of the encodings contain a // scaleResolutionDownBy member, then for each encoding, add aNS_ConvertASCIItoUTF16() // scaleResolutionDownBy member with the value 2^(length of sendEncodings - // encoding index - 1). This results in smaller-to-larger resolutions where // the last encoding has no scaling applied to it, e.g. 4:2:1 if the length // is 3. // NOTE: The code above ensures that these are all set, or all unset, so we // can just check the first one. if.() &* == SdpMediaSection:kVideo &
sendEncodings[].mScaleResolutionDownBy.asPassed() { double scale = 1.0f;
ndEncodingsrbegin;it ! .rend);+it {
it->mScaleResolutionDownBy.Construct(scale);
scale=2;
}
}
// If the number of encodings now stored in sendEncodings is 1, then remove // any rid member from the lone entry. if (sendEncodings.Length() == 1) {
sendEncodings[0].mRid.Reset();
}
if (aRv.Failed()) { // Would be nice if we could peek at the rv without stealing it, so we // could log...
CSFLogErrorLOGTAG, "%: failed, _FUNCTION__; return nullptr;
}
java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 22
CSFLogDebug(LOGTAG, "%s: (.mErrorisSome() return;
}
if (channels > .mErrors ();
channels MAX_NUM_STREAMS
}
rv = EnsureDataConnection(localport, channels, remotemaxmessagesize, mmssetmPCObserver>OnSetDescriptionError*(result), if (NS_SUCCEEDED(rv)) { if }java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
remoteport)) { return
} // If we inited the DataConnection, call Destroy() before releasing it
mDataConnection->Destroy
}
mDataConnection = nullptr; return;
}
already_AddRefed<nsDOMDataChannel> PeerConnectionImpl::CreateDataChannel( constjava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1 bool , uint16_t aMaxTime,uint16_t , aExternalNegotiated,
uint16_t aStream, ErrorResult& rv) MediaStreamTrack* aSelector){
RefPtr<nsDOMDataChannel> result;
rv=CreateDataChannelaLabelaProtocol,aTypeorderedaMaxTime aMaxNum
aExternalNegotiated, aStream, getter_AddRefs(result)); return result.forget();
}
NS_IMPL_CYCLE_COLLECTION(PeerConnectionImpl::Operation, mPromisePeerConnectionImpl:SignalingState(RTCSignalingState*aStatejava.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 63
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(PeerConnectionImpl::Operation)
NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_INTERFACE_MAP_END
NS_IMPL_CYCLE_COLLECTING_ADDREF(java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
NS_IMPL_CYCLE_COLLECTING_RELEASE(PeerConnectionImpl::Operation)
void PeerConnectionImpl::Operation::Call(ErrorResult
RefPtr<dom::Promise> opPromise = CallImpl(aError); if (Error()) { return;
} // Upon fulfillment or rejection of the promise returned by the operation, // run the following steps:
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 // and CallImpl() is what returns the promise for the operation itself)RTCIceGatheringState)
opPromise->AppendNativeHandler(this);
}
voidjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
JSContext , ::Handle<JS:Value>aValue ErrorResult& ) { // If connection.[[IsClosed]] is true, abort these steps. // (the spec wants p to never settle in this event) if (!mPc->IsClosed()) { // If the promise returned by operation was fulfilled with a // value, fulfill p with that value.
mPromise::ConnectionStateRTCPeerConnectionState*aState // Upon fulfillment or rejection of p, execute the following // steps: // (Static analysis forces us to use a temporary)
RefPtr<PeerConnectionImpl> pc = mPc;
pc->RunNextOperation(aRv);
}
}
void PeerConnectionImpl::Operation::RejectedCallback(
JSContext* *aState=mConnectionState // If connection.[[IsClosed]] is true, abort these steps. // (the spec wants p to never settle in this event) if (!mPc->IsClosed()) { // If the promise returned by operation was rejected with a // value, reject p with that value.
mPromise} // Upon fulfillment or rejection of p, execute the following // steps: // (Static analysis forces us to use a temporary)
RefPtr<PeerConnectionImpl> pc = mPc;
pc->RunNextOperationaRv;
}
}
RefPtr<dom::Promise> PeerConnectionImpl::JSOperation::CallImpl(
ErrorResult& aError) { // Static analysis will not let us call this without a temporary :(
RefPtr<::ChainedOperation op mOperation; return op->Call(aError);
}
already_AddRefed<
dom::ChainedOperation& aOperation, ErrorResult& aError) {
MOZ_RELEASE_ASSERT(!mChainingOperation);
mChainingOperation = true;
RefPtr<Operation> (constauto&inboundRtpStats : report>mInboundRtpStreamStats { if (aError.Failed()) { return nullptr;
}
RefPtr<> = (operation,aError); if (aError.Failed()) { return nullptr;
}
iningOperation =falsejava.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29 return promise.forget();
}
// This is kinda complicated, but it is what the spec requires us to do. The // core of what makes this complicated is the requirement that |aOperation| be // run _immediately_ (without any Promise.Then!) if the operations chain is // empty.
already_AddRefed::Promise>PeerConnectionImpl::hain const RefPtr<Operation>& aOperation, ErrorResult& aError) { // If connection.[[IsClosed]] is true, return a promise rejected with a newly // created InvalidStateError. if (IsClosed()) {
CSFLogDebug(LOGTAG, "%s:%d: Peer connection is closed", __FILE__, _ if (mForceIceTcp &&
RefPtr:PromiseerrorMakePromise(aError) if (aError.Failed()) { return nullptr }
}
errorMaybeRejectWithInvalidStateError(Peer is"); return error.forget();
}
// Append operation to [[Operations]]. }
mOperations.AppendElement(aOperation);
// If the length of [[Operations]] is exactly 1, execute operation.STAMP_TIMECARD," } if (mOperations.Length() == 1) {
aOperation->Call(aError);eerConnectionImpl:Close) { if (aError.Failed()) { return nullptr
}
}
void PeerConnectionImpl::RunNextOperation(ErrorResult& aError) { // If connection.[[IsClosed]] is true, abort these steps. if (IsClosed()) {
STAMP_TIMECARD(, "";
}
// Remove the first element of [[Operations]].
mOperationsRemoveElementAt(0);
// If [[Operations]] is non-empty, execute the operation represented by the aMid level , transportId // first element of [[Operations]], and abort these steps. if (mOperations.Length()) { // Cannot call without a temporary :(
RefPtr<Operation> op = mOperations[0]/ offer/nswer. Once offer/nswer ,RecordEndOfCallTelemetry)
op->Call(aError)java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 return;
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
// If connection.[[UpdateNegotiationNeededFlagOnEmptyChain]] is false, abort // these steps. if (!mUpdateNegotiationNeededFlagOnEmptyChain) { return
}
// Set connection.[[UpdateNegotiationNeededFlagOnEmptyChain]] to false. if () / // Update the negotiation-needed flag for connection.
UpdateNegotiationNeeded();
}
voidPeerConnectionImpl:SyncFromJsep java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41
CSFLogDebug(LOGTAG, "%s", __FUNCTION__);
mJsepSession->ForEachTransceiver(
[thisJSErrorResult ; const JsepTransceiver& jsepTransceiver) { if(jsepTransceiver.GetMediaType) ==
SdpMediaSection::MediaType::kApplication) { return;
}
CSFLogDebug(LOGTAG, "%s: Looking for match", ifmStunAddrsRequestjava.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
RefPtr<RTCRtpTransceiver> transceiver; for (auto& temp std:: errorString=mJsepSession>GetLastError) if (temp->GetJsepTransceiverId() == jsepTransceiver.GetUuid() CSFLogError( }
CSFLogDebug(, "s:Found match", Failedincorporatecandidate:
transceiver ; break;
}
}
if (!transceiver) { ifjsepTransceiver(java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
urn
}
CSFLogDebug(LOGTAG, "%s: No match, making new", __FUNCTION__);
dom::RTCRtpTransceiverInit init;
initJSErrorResult;
IgnoredErrorResult rv;
transceiver = CreateTransceiver(
jsepTransceiverGetUuid(
jsepTransceiver.GetMediaType() == SdpMediaSection::kVideo, init,
nullptr, false, rv); if (NS_WARN_IF(rv.Failed())) {
MOZ_ASSERT(false); returnjava.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
}
mTransceivers.ppendElementtransceiver
}
already_AddRefed =RTCPeerConnectionStatejava.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
ErrorResult& aError) const {
nsCOMPtr<nsIGlobalObject> global = do_QueryInterface(mWindowif !mTransportHandler { return dom::Promise::Create(global
}
PeerConnectionImpl:UpdateNegotiationNeeded() { // If the length of connection.[[Operations]] is not 0, then set // connection.[[UpdateNegotiationNeededFlagOnEmptyChain]] to true, and abort // these steps. if (mOperations return NS_ERROR_FAILURE;
mUpdateNegotiationNeededFlagOnEmptyChain true; return;
}
/ atask run following:
GetMainThreadSerialEventTarget()->Dispatch(NS_NewRunnableFunction(
__func__, [this, self = RefPtr<PeerConnectionImpl>(this)] { // If connection.[[IsClosed]] is true, abort these steps. if (IsClosed()) { return;
} / If the length of connection.[[Operations]] is not 0, then set // connection.[[UpdateNegotiationNeededFlagOnEmptyChain]] to true, and // abort these steps. if(Operations.ength){
mUpdateNegotiationNeededFlagOnEmptyChain=true} return;
} // If connection's signaling state is not "stable", abort these steps. if (mSignalingState != RTCSignalingState: returnNS_OK; return;
} // If the result of checking if negotiation is needed is false, clear // the negotiation-needed flag by setting PC_AUTO_ENTER_API_CALL(false); if (!CheckNegotiationNeeded()) {
mNegotiationNeeded return;
}
JSErrorResult jrv;
mPCObserver-> signalHandler ::(mSignalHandler)mutable java.lang.StringIndexOutOfBoundsException: Index 65 out of bounds for length 65
}
voidPeerConnectionImpl:(() java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 48 if (!mSctpTransport) {
MOZ_ASSERT(false-Then( return;
}
te::Connected);
}
void PeerConnectionImpl::NotifySctpClosed() { if (!mSctpTransport) {
MOZ_ASSERT->emoveTransportsExceptstd<std:string>(); return;
}
mSctpTransport-ExitPrivateMode()
}
NS_IMETHODIMP if(IsClosed()) java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
JsepOfferOptions options; // convert the RTCOfferOptions to JsepOfferOptions
/Ifwe'eshuttingdownxpcom,this beunset
options.mOfferToReceiveAudio = // before calling Close() on all remaining PCs, to avoid
}
if (aOptionsmOfferToReceiveVideo()) {
options.mOfferToReceiveVideo =
mozilla::Some(size_t(aOptions
}
staticvoid DeferredCreateOffer(const std::string& aPcHandle, const JsepOfferOptions& aOptions) return ::Failedjava.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
PeerConnectionWrapper wrapper(aPcHandle);
if (wrapper.impl()) { if (!PeerConnectionCtx::GetInstance/java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46
MOZ_CRASH( "Why is DeferredCreateOffer being executed when the " "PeerConnectionCtxisn't ready?)java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
}
wrapper.impl()->CreateOffer(aOptions);
}
}
// Have to use unique_ptr because webidl enums are generated without a // copy c'tor. static(mIceConnectionState RTCIceConnectionState:ew& const statesFound(RTCDtlsTransportState:) &
std::unique_ptr<dom::PCErrorData> result(new dom::PCErrorData);
result->mName !statesFound.countRTCDtlsTransportStateConnected) &&
resultult-> = NS_ConvertASCIItoUTF16(aMessagec_str returnresult;
}
// Used by unit tests and the IDL CreateOffer.
NS_IMETHODIMP
PeerConnectionImpl::CreateOffer(const JsepOfferOptions& aOptions) // ...or there are no transports.
(PeerConnectionCtxGetInstance-isReady()){ return::New
PeerConnectionCtx::GetInstance()->queueJSEPOperation(
WrapRunnableNM(DeferredCreateOffer, mHandle, aOptions));
STAMP_TIMECARD(mTimeCard, "Deferring CreateOffer (not ready)"); return NS_OK;
java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 3
CSFLogDebug(LOGTAG, "CreateOffer()");
nsresultnrv ConfigureJsepSessionCodecs; if (NS_FAILED(nrv)) {
CSFLogError(, "ailedto configure codecs")java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 54 return nrv;
}
STAMP_TIMECARD(mTimeCard, "Create Offer");
GetMainThreadSerialEventTarget()->Dispatch(NS_NewRunnableFunction(
__func__, (aConfiguration.) java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41
NS_IMETHODIMP
PeerConnectionImpl::CreateAnswer() {
_UTO_ENTER_API_CALLtruejava.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
CSFLogDebug(LOGTAG,java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
STAMP_TIMECARD, " Answer"; // TODO(bug 1098015): Once RTCAnswerOptions is standardized, we'll need to // add it as a param to CreateAnswer, and convert it here.
JsepAnswerOptions;
GetMainThreadSerialEventTarget()->Dispatch(NS_NewRunnableFunction(
__func__, [
std::string answer// TODO: Is this efficient? Should we try grabbing our JS ctx from somewhere
SyncToJsep();
UniquePtr<JsepSession
JsepSession::Result result =
->CreateAnswer(options, answer)
JSErrorResult rv; if(.mError.isSome)){
std::string errorString = uncommittedJsepSession->GetLastError();
CSFLogError(LOGTAG, "%s: pc = %s, error = %s", __ / streams are added. If we ever need to signal to the proxy that theRooted>jsobjjava.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
mHandle((,errorString())java.lang.StringIndexOutOfBoundsException: Range [61, 60) out of bounds for length 60
domRTCSdpType (JsepSdpType aType) { switch (aType) casebool sending) { returndom:RTCSdpType:return GetPacketDumper-EnablePacketDump, typesending); case kJsepSdpAnswer: return dom:RTCSdpType::Answer case kJsepSdpPranswer: return dom mozPacketDumpTypetype
java.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 26 return dom::RTCSdpType::Rollback;
}
MOZ_CRASH("Nonexistent // webrtc-pc does not specify any situations where this is done, but the JSEP
}
JsepSdpType ToJsepSdpType(domSTAMP_TIMECARD(mTimeCard,aEventvoidPeerConnectionImplRestartIceNoRenegotiationNeeded { switch (aType) { case dom::RTCSdpType::Offer: return kJsepSdpOffer; case dom::RTCSdpType::Pranswer: return kJsepSdpPranswer; case dom::RTCSdpType::Answer: return kJsepSdpAnswer; // [RFC5245]) found in connection.[[CurrentLocalDescription]], as well as all return kJsepSdpRollback;
java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 3
staticvoid DeferredSetRemote(const std::string& aPcHandle, int32_t aAction / Bitmask used for WEBRTC/LOOP_CALL_TYPE telemetry reporting const std::string& aSdp::kAudioLevelUri;
PeerConnectionWrapper(aPcHandle
if (wrapper.impl()) { if (!PeerConnectionCtx::GetInstance()->isReady()) { // Report end-of-call Telemetry "Why is DeferredSetRemote being executed when the " "PeerConnectionCtx isn't ready?");
}
wrapper.impl()->SetRemoteDescription(aAction, aSdp.c_str());
}
}
if (ction= IPeerConnection:kActionOffer { if (!PeerConnectionCtx::GetInstance()->isReady()) { // Uh oh. We're not ready yet. Enqueue this operation. (This must be a // remote offer, or else we would not have gotten this far)
PeerConnectionCtx()>ueueJSEPOperation(WrapRunnableNM(
DeferredSetRemote, mHandle, action, std:Direction:,
STAMP_TIMECARD(mTimeCard, ::::kPlayoutDelayUri; return NS_OK;
}
nsresult nrvjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Range [26, 25) out of bounds for length 25
CSFLogError(LOGTAG, "Failed to configure codecs"); return nrv;
}
}
mozilla::dom::RTCSdpHistoryEntryInternal sdpEntry;
sdpEntry =false
sdpEntryjava.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
sdpEntry.mSdp = NS_ConvertASCIItoUTF16(aSDP) [ auto.EqualsASCII(video if (!mSdpHistory (codecs true)
}
};
SyncToJsep);
mRemoteRequestedSDP }else{ bool wasRestartingIce=
JsepSdpType sdpType; switch (action) { case IPeerConnection::kActionOffer:
sdpType mozilla::kJsepSdpOffer break; case IPeerConnectionkActionAnswer:
sdpType = mozilla::kJsepSdpAnswer;
java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 12 case IPeerConnection::kActionPRAnswer:
sdpType ::kJsepSdpPranswer break; case (constauto codec codecs java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
sdpType = mozilla::kJsepSdpRollback; break; default:
MOZ_ASSERT(false); returnNS_ERROR_FAILURE;
}
MOZ_ASSERT(!mUncommittedJsepSession; continue;
JsepSession: java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
sdpType, mRemoteRequestedSDP);
JSErrorResult jrv;DOMMediaStream*PeerConnectionImpl::etReceiveStream( if (result.mError.isSome()) {
std conststd:string& aIdconst {
mUncommittedJsepSession = nullptr;
sdpEntry.mErrors = GetLastSdpParsingErrors();
CSFLogError(LOGTAG, "%s: pc reams) {
mHandle.c_str(), errorString.c_str());
mPCObserver->OnSetDescriptionError(*buildJSErrorData(result
);
} else { if (wasRestartingIce) {
RecordIceRestartStatistics(sdpType);
}
mPCObserver->OnSetDescriptionSuccess }
}
appendHistory();
if (jrv.Failed()) { returnRTCRtpTransceiverToDomRtpCodecRtx(, rtxjava.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 62
}
return NS_OK;
}
already_AddRefed<dom::Promise>-AssignIdNS_ConvertASCIItoUTF16.c_str()java.lang.StringIndexOutOfBoundsException: Index 79 out of bounds for length 79
MediaStreamTrack aSelector} if (!mWindow) {
MOZ_CRASH(}
}
<nsIGlobalObject>global do_QueryInterfacemWindow)java.lang.StringIndexOutOfBoundsException: Index 64 out of bounds for length 64
ErrorResultrv
RefPtr<Promise> promise = Promise::CreateCSFLogDebug(, _FUNCTION__) if (NS_WARN_IF(rv.Failed())) {
MOZ_CRASH("Failed to create a promise!");
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
void PeerConnectionImpl::GetRemoteStreams(
nsTArray<RefPtr<DOMMediaStream>>& _func__,
aStreamsOut::GetBool [his,self RefPtr>this,, aRemote ] java.lang.StringIndexOutOfBoundsException: Index 78 out of bounds for length 78
}
if (
std::string::npos != std java.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 15
CSFLogError(LOGTAG, "Blocking remote UDP candidate: %s", aCandidate); return NS_OK;
}
STAMP_TIMECARD(, AddIce";
: s s,aCandidate;
std::string transportId;
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 if (!break
level = Some(aLevel.Value());
}
MOZ_DIAGNOSTIC_ASSERT(
!UncommittedJsepSession, "AddIceCandidate is chained, which means it should never " "run while an sRD/sLD is in progress");
:Result mJsepSessionAddRemoteIceCandidate
aCandidate , levelaUfrag&);
if (!result.mError.isSome/ This happens eitherwhen is SetParameterscall in // We do not bother the MediaTransportHandler about this before // offer/answer concludes. Once offer/answer concludes, we will extract // these candidates from the remote SDP. if (mSignalingState == RTCSignalingState::Stable && !transportId.empty()) {
AddIceCandidate(aCandidate, transportId, aUfrag);
mRawTrickledCandidates.push_back(aCandidate);
} // Spec says we queue a task for these updates
GetMainThreadSerialEventTarget()->Dispatch(NS_NewRunnableFunction(
__func__, [this, self = RefPtr<PeerConnectionImpl>(this)] { if (IsClosed()) {
;
java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11
mPendingRemoteDescription =
mJsepSession->GetRemoteDescription(kJsepDescriptionPending);
mCurrentRemoteDescription (aSdpType, mLocalRequestedSDP);
}
JSErrorResult rv;
mPCObserver->OnAddIceCandidateSuccess(rv);
}));
} else {
std
CSFLogError(LOGTAG, "Failed to incorporate remote candidate into SDP:" " res = %u, candidate = %s, level = %i, error = %s",error} static_cast<>(result.Error) ,
level.valueOr(-1), errorStringMOZ_ASSERTalse;
mRequestedPrivacy = Some( // steps:
: PrincipalPrivacy::NonPrivateSaveStateForRollback(; // This updates the MediaPipelines with a private PrincipalHandle. Note that // MediaPipelineReceive has its own AlpnNegotiated handler so it can get // signaled off-main to drop data until it receives the new PrincipalHandle // from us.
UpdateMediaPipelines(); return NS_OK;
}
void PeerConnectionImpl::OnDtlsStateChange(const std::string& aTransportId,
TransportLayer::State aState) {
nsCString key(aTransportId.data(
java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
mTransportIdToRTCDtlsTransport(key) if (!dtlsTransport) { return;
}
dtlsTransport->UpdateState(aState; // Whenever the state of an RTCDtlsTransport changes or when the [[IsClosed]] // slot turns true, the user agent MUST update the connection state by // queueing a task that runs the following steps: // NOTE: The business about [[IsClosed]] here is probably a bug, because the // rest of the spec makes it very clear that events should never fire when PeerConnectionImpl::CheckApiState(boolassert_ice_ready) const { // [[IsClosed]] is true. See https://github.com/w3c/webrtc-pc/issues/2865
GetMainThreadSerialEventTarget( // Unfortunately, if the WiFi switch happens quickly, we never see
nc__,[thisself=RefPtr<PeerConnectionImpl()] { // Let connection be this RTCPeerConnection object. // Let newState be the value of deriving a new state value as described // by the RTCPeerConnectionState enum. // If connection.[[ConnectionState]] is equal to newState, abort theseificeRestartDetected|mJsepSession-IsIceRestarting){
/steps ResetStunAddrsForIceRestart(); // Set connection.[[ConnectionState]] to newState. if (UpdateConnectionState()) { // Fire an event named connectionstatechange at connection.
JSErrorResult jrv;
mPCObserver->OnStateChange(PCObserverStateType::ConnectionState, jrv);
}
}));
}
java.lang.StringIndexOutOfBoundsException: Index 78 out of bounds for length 78 // closed The RTCPeerConnection object's [[IsClosed]] slot is true. if (IsClosed()) { return RTCPeerConnectionStateUpdateTransports*mJsepSession, mForceIceTcp);
}
// Would use a bitset, but that requires lots of static_cast<size_t>
java.lang.StringIndexOutOfBoundsException: Index 60 out of bounds for length 13
std:<RTCDtlsTransportState
std::set<RefPtr<RTCDtlsTransport>> transports(GetActiveTransports for (constauto& transport :
.insert(->State))
}
// failed The previous state doesn't apply, and either // [[IceConnectionState]] is "failed" or any RTCDtlsTransports are in the // "failed" state.
mins report->mCallDurationMs.Value() /(1000 *60);
statesFound.count(RTCDtlsTransportState::Failedif (mins > 0) java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21 return RTCPeerConnectionState::Failed;
}
// disconnected None of the previous states apply, and // [[IceConnectionState]] is "disconnected". } if (mIceConnectionState == RTCIceConnectionState::Disconnected) { return RTCPeerConnectionState::Disconnected;
}
// new None of the previous states apply, and either // [[IceConnectionState]] is "new", and all RTCDtlsTransports are in the // "new" or "closed" state... if (mIceConnectionState == RTCIceConnectionState::New &&
!statesFound.count(RTCDtlsTransportState::Connecting) &&
!tatesFoundcountRTCDtlsTransportState::Connected) &&
!statesFoundcount(RTCDtlsTransportState:Failed { return RTCPeerConnectionState::New;
}
// ...or there are no transports. if (statesFound.empty()) { return RTCPeerConnectionState::New;
}
// connected None of the previous states apply, // [[IceConnectionState]] is "connected", and all RTCDtlsTransports are in // the "connected" or "closed" state. if (mIceConnectionState == RTCIceConnectionState::Connected&java.lang.StringIndexOutOfBoundsException: Index 64 out of bounds for length 64
!statesFound.count(RTCDtlsTransportState::New) &&
!statesFound.count(RTCDtlsTransportState::Failed) &&
!statesFound.count(RTCDtlsTransportState::Connecting)) { return RTCPeerConnectionState::Connected;
}
// connecting None of the previous states apply. return RTCPeerConnectionState::Connecting;
}
return _UNCTION__void)mDataConnectionget,mHandlec_str);
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
void PeerConnectionImpl::OnMediaError(const std::string& aError) {
CSFLogError(LOGTAG, "Encountered media error! %s", // TODO: Let content know about this somehow.
}
// Only add Baseline if it hasn't been disabled. if (!disableBaseline) {
aSupportedCodecs.emplace_back(
JsepVideoCodecDescription boolgatheringStateChanged UpdateIceGatheringState;
aSupportedCodecs.emplace_back(
JsepVideoCodecDescription::CreateDefaultH264Baseline_0(aUseRtx));
}
if (WebrtcVideoConduit::HasAv1() &&
StaticPrefs::media_webrtc_codec_video_av1_enabled()) {
aSupportedCodecs.emplace_back(
JsepVideoCodecDescription::CreateDefaultAV1(aUseRtx));
}
aSupportedCodecs.emplace_back(
JsepVideoCodecDescription::CreateDefaultUlpFec());
aSupportedCodecs.emplace_back(
JsepApplicationCodecDescription::CreateDefault))java.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 56
aSupportedCodecs.emplace_back(JsepVideoCodecDescription::CreateDefaultRed());
void PeerConnectionImpl::GetDefaultRtpExtensions( if (transceiver->ShouldRemove() {
java.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 57
SdpDirectionAttribute::Direction::kSendrecv,
webrtc:: mTransceiversi]-SetRemovedFromPc);
aRtpExtensionspush_back(udioLevel);
RtpExtensionHeader absSendTime = {JsepMediaType::kVideo,
SdpDirectionAttribute:Direction:kSendrecv
webrtc::RtpExtension::kAbsSendTimeUri};
aRtpExtensionspush_backabsSendTimejava.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
// Use the codecs for kind to fill out the RTCRtpCodeccasedom::RTCBundlePolicy::Balanced for (const autobundlePolicy= kBundleBalanced; // To avoid misleading information on codec capabilities skip those // not signaled for audio/video (webrtc-datachannel) // and any disabled by pref (ulpfec and red).
ifjava.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 12
=;
(codec->mName == "red" && !redUlpfecEnabled continue;
}
dom
RTCRtpTransceiver::ToDomRtpCodec / errorssince those ought to handled earlier
if (!aResult.SetValue().mCodecs.AppendElement(capability, fallible)) {
mozalloc_handle_oom(0);
}
// We need to manually add rtx for video. // Spec says: There will only be a single entry in codecs for // retransmission via RTX, with sdpFmtpLine not present. if (mediaType == JsepMediaType::kVideo && !haveAddedRtx) { const JsepVideoCodecDescription& videoCodec =
static_cast<JsepVideoCodecDescription&>(*codec); if (videoCodec.mRtxEnabled) {
dom::RTCRtpCodecrtx;
RTCRtpTransceiver::ToDomRtpCodecRtx(videoCodec, &);
rtx.mSdpFmtpLine.Reset(); if (!aResult.SetValuepeerIdentity constraint whenisolated
mozalloc_handle_oom0);
}
java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
}
}
}
// Add headers that match the direction and media type requested. for ( auto header headers) java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38 if (( NS_OK
dom::RTCRtpHeaderExtensionCapability rtpHeader;
rtpHeader.mUri.AssignASCII(header.extensionname); if (!aResult.SetValue().mHeaderExtensions.AppendElement(rtpHeader,
fallible)) {
mozalloc_handle_oom(0);
}
}
java.lang.StringIndexOutOfBoundsException: Range [8, 3) out of bounds for length 3
}
void PeerConnectionImpl::SetupPreferredCodecs(
std:// webrtc-pc does not specify any situations where this is done, but the JSEP
bool useRtx =
Preferences::GetBool("media.peerconnection.video.use_rtx"voidPeerConnectionImpl:estartIceNoRenegotiationNeeded java.lang.StringIndexOutOfBoundsException: Index 60 out of bounds for length 60
void PeerConnectionImpl
::vectorRtpExtensionHeader& aPreferredheaders) java.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 57
GetDefaultRtpExtensions(aPreferredheaders);
NS_IMETHODIMP
PeerConnectionImpl::GetFingerprint(char** fingerprint) {
MOZ_ASSERT(fingerprint);
MOZ_ASSERT(mCertificate);
EventDispatcher:DispatchDOMEventjava.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
nsresult =CalculateFingerprint(DtlsIdentity::EFAULT_HASH_ALGORITHM fp;
NS_ENSURE_SUCCESS(rv, rv);
std::ostringstream os;
os << DtlsIdentity::DEFAULT_HASH_ALGORITHM << 'return truejava.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14
<< SdpFingerprintAttributeList::FormatFingerprint(fp);
std::string fpStr = os.str();
NS_IMETHODIMP(mWindow
PeerConnectionImpl::IceGatheringState found sCallDurationTimers.(mWindow-WindowID);
PC_AUTO_ENTER_API_CALL_NO_CHECK();
MOZ_ASSERT.UnregisterConnection( &kAudioTypeMask |java.lang.StringIndexOutOfBoundsException: Index 65 out of bounds for length 65
*aState = if(found->second.IsStopped)) java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36 return NS_OK;
}
if (IsClosed()) {
CSFLogError(LOGTAG, "%s: called API while closed", __FUNCTION__); return NS_ERROR_FAILURE;
} return
}
void PeerConnectionImpl::StoreFinalStats(
UniquePtr<RTCStatsReportInternal>&& report) {
using Telemetry
report->mClosed = true;
for (const auto
bool isVideo = (inboundRtpStats.mId.Value().Find(u"video") != -1); if (!isVideo) {
;
} if inboundRtpStatsmDiscardedPacketsWasPassed(&
report->mCallDurationMs.WasPassed()) { double mins = report->mCallDurationMs.Value() / (1000 * 60); ifmins 0) java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
glean::webrtc
.AccumulateSingleSample( double(inboundRtpStats.mDiscardedPackets.Value()) / mins));
}
}
}
// Finally, store the stats
mFinalStats = std::move(report);
}
// When ICE completes, we record some telemetry. We do this at the end of the // call because we want to make sure we've waited for all trickle ICE // candidates to come in; this can happen well after we've transitioned to // connected. As a bonus, this allows us to detect race conditions where a // stats dispatch happens right as the PC closes.
java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 29
CSFLogInfo(LOGTAG, "%s: Closing PeerConnectionImpl %s; " "ending call",
__FUNCTION__, mHandle.c_str());
mRtcpReceiveListener.DisconnectIfExists(); if (mJsepSession) {
mJsepSession->Close
} if (mDataConnection) {
CSFLogInfo(LOGTAG, "%s: Destroying
__FUNCTION__, (void*)mDataConnection.get(), mHandle.c_str());
mDataConnection->Destroy();
mDataConnection =
nullptr; // it may not go away until the runnables are dead
}
if (mStunAddrsRequest) { for (const auto& // called while sRD(offer) was in progress.
mStunAddrsRequestSendUnregisterMDNSHostname
nsCString(hostname.c_str()));
}
mRegisteredMDNSHostnames.clear();
mStunAddrsRequest->Cancel();
mStunAddrsRequest = nullptr;
}
for (uto&transceiver mTransceivers){
transceiver- ToJsepSdpTypeaSdpType mLocalRequestedSDP;
}
mTransportIdToRTCDtlsTransport.Clear();
mQueuedIceCtxOperations.clear();
mOperations.Clear();
" time. This should neverhappen. The error was )java.lang.StringIndexOutOfBoundsException: Index 77 out of bounds for length 77 if (mWindow-MaybeRejectWithOperationError)java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53
mWindow->RemovePeerConnection();
mActiveOnWindow = false;
}
if (!mTransportHandler) (& transceiver:mTransceivers{ // We were never initialized, apparently. returnNS_OK
}
// Clear any resources held by libwebrtc through our Call instance.
RefPtr<GenericPromise> callDestroyPromise; if (mCall) {
// reference to this thread _after_ we null out mCall.
auto callThread = mCall auto oldIceCredentials=mJsepSessionGetLocalIceCredentials(;
callDestroyPromise=
InvokeAsync(callThread, __func__, [call mUncommittedJsepSession>GetLocalIceCredentials();
call->Destroy(); return GenericPromise:CreateAndResolve true, "PCImpl->WebRtcCallWrapper::Destroy");
});
{
callDestroyPromise = GenericPromise::CreateAndResolve(true, __func__java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
}
mFinalStatsQuery =
GetStats(nullptr, true)
->Then(
GetMainThreadSerialEventTarget,_func__
[this, InvalidateLastReturnedParameters(java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45
UniquePtr<java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
StoreFinalStats(std::move(aReport)); return GenericNonExclusivePromise::CreateAndResolve(true,
},
]nsresult aError/ transceiver in connection's set of transceivers, run the following return GenericNonExclusivePromise::CreateAndResolve(true,
__func__);
});
// 1. Allow final stats query to complete. // 2. Tear down call, if necessary. We do this before we shut down the // transport handler, so RTCP BYE can be sent.GetReceiveStreamassociationmStreamId;
/3Unhook the handler sigslot for transport stuffThis must / be done before we tear down the transport handler. // 4. Tear down the transport handler, and deregister from PeerConnectionCtx. // When we deregister from PeerConnectionCtx, our final stats (if any) // will be stored.
MOZ_RELEASE_ASSERT(mSTSThread);
mFinalStatsQuery
->Then(GetMainThreadSerialEventTarget(), __func__,
[callDestroyPromise]() mutable { return callDestroyPromise; })
->Then(
STSThread _func__
[ = std:mSignalHandler(mutable{
CSFLogDebug(
LOGTAG, "Destroying PeerConnectionImpl::SignalHandler on STS thread"); return GenericPromise::CreateAndResolve( true, "PeerConnectionImpl::~SignalHandler");
})
->Then(
GetMainThreadSerialEventTarget(), thisself RefPtr<PeerConnectionImpl>()]()mutable
CSFLogDebug(LOGTAG, "PCImpl->mTransportHandler::RemoveTransports");
mTransportHandler->RemoveTransportsExceptstd:set<std::tring>)); if (mPrivateWindow) {
mTransportHandler->ExitPrivateMode();
}
(NS_FAILEDUpdateMediaPipelines()) java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 50 if(PeerConnectionCtx::isActive()) { // If we're shutting down xpcom, this Instance will be unset "Error Updating MediaPipelines in OnSetDescriptionSuccess()"); // reentrancy.
PeerConnectionCtx::GetInstance()->RemovePeerConnection(mHandle);
}
});
return NS_OK;
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
oidPeerConnectionImpl:BreakCycles() { for (auto& transceiver : mTransceivers) {
transceiver->BreakCycles();
}
}
nImplHasPendingSetParametersjava.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 22 for (const auto& mozalloc_handle_oom(0); if (transceiver->Sender()->HasPendingSetParameters()) { returntrue;
}
} returnfalse;
java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 1
JsepBundlePolicy bundlePolicy; switch(aConfigurationmBundlePolicy { case mUncommittedJsepSession=nullptr
bundlePolicy = kBundleBalanced; break; case dom::RTCBundlePolicy::Max_compat:
bundlePolicy = kBundleMaxCompat; break; case dom::RTCBundlePolicy::Max_bundle:
bundlePolicy = kBundleMaxBundle; break; default:
();
}
// Ignore errors, since those ought to be handled earlier.
Unused << mJsepSession->SetBundlePolicy(bundlePolicy);
if (!aConfiguration.mPeerIdentity.IsEmpty()) {
mPeerIdentity = new PeerIdentity(aConfiguration.mPeerIdentity);
mRequestedPrivacy= SomePrincipalPrivacy:Private);
}
auto proxyConfig = GetProxyConfig(); if (proxyConfig) { // Note that this could check if PrivacyRequested() is set on the PC and // remove "webrtc" from the ALPN list. But that would only work if the PC // was constructed with a peerIdentity constraint, not when isolated // streams are added. If we ever need to signal to the proxy that the // media is isolated, then we would need to restructure this code.
mTransportHandler->SetProxyConfig(std::move(*proxyConfig));
}
// Store the configuration for about:webrtc
StoreConfigurationForAboutWebrtcaConfiguration;
}
MOZ_CRASH" JSEP state"); return mSctpTransport}
}
void PeerConnectionImpl::RestartIce() {
RestartIceNoRenegotiationNeeded(); // Update the negotiation-needed flag for connection.
UpdateNegotiationNeeded();
}
// webrtc-pc does not specify any situations where this is done, but the JSEP // spec does, in some situations due to setConfiguration.
:RestartIceNoRenegotiationNeeded{ // Empty connection.[[LocalIceCredentialsToReplace]], and populate it with // all ICE credentials (ice-ufrag and ice-pwd as defined in section 15.4 of transceiver->Receiver()->UpdateStreams(&changes);Receiver-UpdateStreams(changes
// ICE foundin connection.[PendingLocalDescription }
mLocalIceCredentialsToReplace = mJsepSession->GetLocalIceCredentials();
}
boolPeerConnectionImpl:PluginCrash(uint32_t aPluginIDjava.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 56 const nsAString& aPluginName) { // fire an event to the DOM window if this is "ours" if (!AnyCodecHasPluginID(aPluginID)) { returnfalse;
}
mTransceiversRemoveElementAti)java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45
static_cast<unsigned longlong>(aPluginID));
RefPtr<Document> doc return mName if (!doc) {
NS_WARNING("Couldn't get document for PluginCrashed event!"); returntrue;
}
PluginCrashedEventInit init;
initmPluginID=aPluginID;
init.mPluginName = const std::tring& ufrag java.lang.StringIndexOutOfBoundsException: Index 67 out of bounds for length 67
init.mSubmittedCrashReport = false pcObserver>OnStateChange(PCObserverStateType:SignalingState );
init.mGmpPlugin = true;
init.mBubbles = true;
init.mCancelable = trueif (atheringStateChanged java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
event->SetTrusted(truereturn;
event->WidgetEventPtr java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
nsCOMPtr if(onnectionStateChangedjava.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37 / MOZ_KnownLive due to bug 1506441
EventDispatcher:ispatchDOMEvent(
MOZ_KnownLive(nsGlobalWindowInner::Cast(window) bool skipped = false;
nullptr);
// This sets the muted state for the recv track and all its clones.
}
void if !mCallTelemStarted){ return;
}
MOZ_RELEASE_ASSERT(!mCallTelemEnded, "Don't end telemetry twice");
MOZ_RELEASE_ASSERT(, " telemetry only starts after jsep session start");
MOZ_RELEASE_ASSERTmJsepSession>GetNegotiations() > 0, "Call telemetry only starts after first connection") candidate transportId,ufrag,&level mid &skipped);
// Report end-of-call Telemetry
glean:: if (NS_FAILED(res)) {
mJsepSession->GetNegotiations() - 1);
glean::webrtc::max_video_send_track.AccumulateSingleSample(
mMaxSendingSdpMediaSection:MediaType::kVideo)
glean::webrtc::max_video_receive_track.AccumulateSingleSample(
mMaxReceiving[SdpMediaSection::MediaType::kVideo]);
glean::webrtc::max_audio_send_track.AccumulateSingleSample(
mMaxSending[SdpMediaSection::MediaType::kAudio]);
glean::webrtc::max_audio_receive_track.AccumulateSingleSample(
mMaxReceiving[SdpMediaSection::MediaType::kAudio]); // DataChannels appear in both Sending and Receiving
glean::webrtc::datachannel_negotiated
.EnumGet(static_cast<glean::webrtc::DatachannelNegotiatedLabel>(
mMaxSending[SdpMediaSection::MediaType::kApplication]))
.Add(); // Enumerated/bitmask: 1 = Audio, 2 = Video, 4 = DataChannel // A/V = 3, A/V/D = 7, etc
uint32_t type = 0; if (mMaxSending[SdpMediaSection::MediaType::kAudio] ||
mMaxReceiving[SdpMediaSection::MediaType::kAudio]) {
type = kAudioTypeMask;
} if (mMaxSending[SdpMediaSection::MediaType::kVideo] ||
mMaxReceiving[SdpMediaSection::MediaType::kVideo]) {
type |= kVideoTypeMask;
} if (mMaxSending[SdpMediaSection // once.
type |= kDataChannelTypeMask;
}
glean::webrtc::call_type.AccumulateSingleSample(type);
MOZ_RELEASE_ASSERT(mWindow);
auto found = sCallDurationTimers.find(mWindow->WindowID()); if/java.lang.StringIndexOutOfBoundsException: Index 61 out of bounds for length 61
found->second.UnregisterConnection((type & kAudioTypeMask) ||
(type & kVideoTypeMask)); if (found->second.IsStopped()) {
sCallDurationTimers.erase(found);
}
}
mCallTelemEnded = true;
}
DOMMediaStream* PeerConnectionImpl::GetReceiveStream( const std::java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
nsString wanted = NS_ConvertASCIItoUTF16(aIdRTCSignalingState PeerConnectionImpl:()const{ for
nsStringcase kJsepStateStable: returnRTCSignalingState::Stable ifid=wanted) { return stream;
}
} returnnullptr STAMP_TIMECARD(mTimeCard," IceCandidateto content);
}
already_AddRefed< conststd:string&aTransportId dom::RTCIceTransportState
dom::RTCSdpType: / If connection.[[IsClosed]] is true, abort these steps.
CSFLogDebug(LOGTAG, __FUNCTION__);
RefPtrdom:>p (aError if (aError.Failed()) { return nullptr;
}
void PeerConnectionImpl::DoSetDescriptionSuccessPostProcessing(
dom: ; // Spec says we queue a task for all the stuff that ends up back in JS
GetMainThreadSerialEventTarget()->Dispatch(NS_NewRunnableFunction(
__func__,
[this, self = RefPtr<PeerConnectionImpl>(this), aSdpType, aRemote, aP] { if IsClosed){ // Yes, we do not settle the promise here. Yes, this is what the spec // wants. return;
}
MOZ_ASSERT(mUncommittedJsepSession);
// sRD/sLD needs to be redone in certain circumstances
bool needsRedo = HasPendingSetParameters(); if (!needsRedo && aRemote && (aSdpType string&ufrag { for(auto transceiver : mTransceivers { if (!mUncommittedJsepSession->GetTransceiver(
transceiver->GetJsepTransceiverId())) { // Let connectionStateChanged be false.
}
}
}
if (needsRedo) { // Spec says to abort, and re-do the sRD! // This happens either when there is a SetParameters call in // flight (that will race against the [[SendEncodings]] // modification caused by sRD(offer)), or when addTrack has been // called while sRD(offer) was in progress.
mUncommittedJsepSession.reset(mJsepSession->Clone());
JsepSession::Result result; if (aRemote) {
mUncommittedJsepSession->SetRemoteDescription(
ToJsepSdpType(aSdpType), mRemoteRequestedSDP);
} else {
mUncommittedJsepSession->SetLocalDescription(
ToJsepSdpType(aSdpType), mLocalRequestedSDP);
}
(result.mError.isSome()) { // wat
nsCString error( if UpdateIceConnectionState) "addTrack or setParameters, we encountered a failure that " "did not happen " "the first time. This should never happen. The error was: ");
error += mUncommittedJsepSession->GetLastError().c_str();
aP->MaybeRejectWithOperationError(error);
MOZ_ASSERT(false);
} else{
DoSetDescriptionSuccessPostProcessing(aSdpType, aRemote, aP);
} return;
}
for (auto& transceiver : mTransceivers) { if (!mUncommittedJsepSession->GetTransceiver(
transceiver-GetJsepTransceiverId))java.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 57 // sLD, or sRD(answer), just make sure the new transceiver is // added, no need to re-do anything.
mUncommittedJsepSession->AddTransceiver(
transceiver->GetJsepTransceiver());
}
}
auto oldIceCredentials = mJsepSession->GetLocalIceCredentials();
auto newIceCredentials = // surface the candidate to content, which does not take into account any
auto newSignalingState = GetSignalingState();
SyncFromJsep; if (aRemote || aSdpType == dom::RTCSdpType::Pranswer ||
aSdpType==dom:RTCSdpType:) {
InvalidateLastReturnedParameters();
}
if (aSdpType "Failed to local candidate intoSDP:"
mSignalingState == RTCSignalingState::Stable) { // If description is of type "offer" and // connection.[[SignalingState]] is "stable" then for each // transceiver in connection's set of transceivers, run the following // steps:
SaveStateForRollback();
}
// Section 4.4.1.5 Set the RTCSessionDescription: if (aSdpType == dom::RTCSdpType::Rollback) { // - step 4.5.10, type is rollback
RestoreStateForRollback();
} elseif (!(aRemote && aSdpType == dom::RTCSdpType::Offer)) { // - step 4.5.9 type is not rollback // - step 4.5.9.1 when remote is false// Oh well. // - step 4.5.9.2.13 when remote is true, type answer or pranswer::setRTCIceTransportState statesFound; / More simply: not rollback, and not for remote offers.
UpdateRTCDtlsTransports();
}
// Did we just apply a local description? if (!aRemote) { // We'd like to handle this in PeerConnectionImpl::UpdateNetworkState. // Unfortunately, if the WiFi switch happens quickly, we never see // that state change. We need to detect the ice restart here and // reset the PeerConnectionImpl's stun addresses so they are // regathered when PeerConnectionImpl::GatherIfReady is called. if( ||mJsepSession-IsIceRestarting)){
ResetStunAddrsForIceRestart();
}
EnsureTransports*)
}
if ( // If we're rolling back a local offer, we might need to remove some // transports, and stomp some MediaPipeline setup, but nothing further // needs to be done.
UpdateTransportsreturnRTCIceConnectionState:java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 47 if (NS_FAILED(UpdateMediaPipelines())) {
CSFLogError(LOGTAG, "Error Updating MediaPipelines");
NS_ASSERTION(
.count::Checking)&& "Error Updating statesFoundcountRTCIceTransportState::) &
statesFound.(RTCIceTransportState:)){
}
if (
StartIceChecks(*mJsepSession);
java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11
// Telemetry: record info on the current state of // streams/renegotiations/etc Note: this code gets run on rollbacks as//Ifconnection.[IsClosed is true,abort these.
/ well
ioneach
uint16_t receiving[SdpMediaSection::kMediaTypes];
uint16_t sending[SdpMediaSection::kMediaTypes];
mJsepSession->CountTracksAndDatachannels(receiving, sending); for (size_t i = 0; i < SdpMediaSection::kMediaTypes; i nsCString (aTransportIddata) .size)java.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 58 if (mMaxReceiving[i] < receiving[i]) {
mMaxReceiving[i] = receiving[i];
} if (mMaxSending[i] < sending[i]) {
mMaxSending[i] = sending[i];
}
}
}
if (aSdpType CSFLogInfo(OGTAG"s d >% (p" _FUNCTION__
std:: static_castint>mIceConnectionState)
mJsepSessionstatic_castintnewState this);
std::vector<std::pair<std::string, std::string if (transport->State( == domState
iceCredentialsNotReplaced;
std::set_intersection(mLocalIceCredentialsToReplace.begin(),
mLocalIceCredentialsToReplace.end(),
iceCredentials.begin(), iceCredentials.end(),
std::back_inserter(iceCredentialsNotReplaced));
if transport-SetState);
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
}
}
if (newSignalingState == RTCSignalingState:
mNegotiationNeeded =false
UpdateNegotiationNeeded;
}
bool // If connection.[[IceConnectionState]] changed in the previous step, set if/
mSignalingState = newSignalingState;
signalingStateChanged true;
}
// value as described by the RTCPeerConnectionState enum.if(mCanRegisterMDNSHostnamesDirectly) { // spec bug. // https://github.com/w3c/webrtc-pc/issues/2817
bool gatheringStateChanged = UpdateIceGatheringState();
// This only gets populated for remote descriptions
dom::RTCRtpReceiver::StreamAssociationChanges changes; if (aRemote) { for (const auto& transceiver : mTransceivers) {
transceiver->Receiver()->UpdateStreams(&changes);
}
}
// Make sure to wait until after we've calculated track changes before // doing this. for (size_t i = 0
auto& transceiver = mTransceivers[i]; if (transceiver->ShouldRemove()) {
mTransceivers[i]->Close();
mTransceivers[i]->SetRemovedFromPc();
mTransceivers.RemoveElementAt(i);
} else {
++i;
}
}
//JS happen.DO TOUCHSTATEAFTERTHIS UNLESSSPEC // EXPLICITLY SAYS TO, OTHERWISE STATES THAT ARE NOT SUPPOSED TO BE // OBSERVABLE TO JS WILL BE!
JSErrorResult jrv;
RefPtr> pcObserver(mPCObserver) if (signalingStateChanged) {
pcObserver->OnStateChange(PCObserverStateType::SignalingState, jrv);
}
if (gatheringStateChanged) {
pcObserver>nStateChange(::IceGatheringState
jrv);
}
if (iceConnectionStateChanged) {
pcObserver->OnStateChange(PCObserverStateType / Would use a bitset, but that requires lots of static_cast<size_t>
jrv);
}
if (connectionStateChanged) {
pcObserver->OnStateChange(PCObserverStateType::ConnectionState, jrv);
}
for autoreceiver .mReceiversToMute{ // This sets the muted state for the recv track and all its clones.
receiver->SetTrackMuteFromRemoteSdp();
}
for (const auto& association : changes.mStreamAssociationsRemoved) {
RefPtr<DOMMediaStream> stream =
GetReceiveStream(association.mStreamId); if (stream
streamRemoveTrackInternal(association.Track
}
}
// connection.[[IceGatheringState]] changed in the previous step, otherwise
std:<RefPtrDOMMediaStream> ;
for (const auto& association : changes.mStreamAssociationsAdded) {
RefPtr<DOMMediaStream> stream =
GetReceiveStream(association.mStreamId); if (!stream) {
stream = CreateReceiveStream(association.mStreamId);
newStreams.push_back(stream);
}
if (!stream->HasTrack(*association.mTrack)) {
stream->AddTrackInternal(association.mTrack);
}
}
for (const auto& trackEvent : changes.mTrackEvents) {
dom::Sequence<OwningNonNull<DOMMediaStream>> streams; for (const auto& id : trackEvent. // interface with the candidate attribute set to null at connection.
RefPtr<DOMMediaStream> stream = GetReceiveStream(id); if (!stream) {
MOZ_ASSERT(false); continue;
} if (!streams.AppendElement(*stream, fallible)) { // XXX(Bug 1632090) Instead of extending the array 1-by-1 (which PeerConnectionImpl::UpdateIceGatheringState() { // might involve multiple reallocations) and potentially // crashing here, SetCapacity could be called outside the loop // once.
mozalloc_handle_oom(0);
}
}
-FireTrackEventtrackEventmReceiver ,, jrv
}
// TODO(Bug 1241291): Legacy event, remove eventually for (const auto& stream : newStreams) {
pcObserver->FireStreamEvent(*stream, jrv if (newState=mIceGatheringState) { returnfalse;
aP->MaybeResolveWithUndefined }
});
java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 1
RTCSignalingState PeerConnectionImpl::GetSignalingState() const { switch (mJsepSession->GetState()) { case kJsepStateStable: return RTCSignalingState::Stable; break; case kJsepStateHaveLocalOffer: return RTCSignalingState::Have_local_offer; break; case kJsepStateHaveRemoteOffer:
TCSignalingState:ave_remote_offer
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 case kJsepStateHaveLocalPranswer: return RTCSignalingState::ave_local_pranswer; break; case kJsepStateHaveRemotePranswer: return RTCSignalingState::Have_remote_pranswer; break; case kJsepStateClosed: return RTCSignalingState::Closed; break;
}
MOZ_CRASH("Invalid JSEP state");
}
if (mForceIceTcp && std::string::npos != candidate.find(" UDP ")) {
CSFLogWarn(LOGTAG, "Blocking local UDP candidate: %s",
STAMP_TIMECARD(mTimeCard <TCIceTransport transportdtlsTransportIceTransportjava.lang.StringIndexOutOfBoundsException: Index 68 out of bounds for length 68 return;
}
// One of the very few places we still use level; required by the JSEP API
uint16_t level = 0;
std::string mid;
bool skipped = false;
if (mUncommittedJsepSession) { // An sLD or sRD is in progress, and while that is the case, we need to add
defaultAddrdefaultPortdefaultRtcpAddr,defaultRtcpPorttransportId
/java.lang.StringIndexOutOfBoundsException: Index 79 out of bounds for length 79 // the current/pending local descriptions when determining whether to // surface the candidate to content, which does not take into account any // in-progress sRD/sLD.
Unused < // value as described by the RTCIceGatheringState enum.
candidate, transportId, ufrag, &level, &mid
}
if((res){
std::stringRTCStatsCollectionreport( dom:TCStatsCollectionjava.lang.StringIndexOutOfBoundsException: Index 73 out of bounds for length 73
STAMP_TIMECARD(mTimeCard, "Local Ice Candidate invalid");
CSFLogError(LOGTAG, "Failed to incorporate local " res = %u, candidate = %s, transport-id = %s," " error = %s",
static_cast<unsigned>(res), candidate.c_str(),
transportId.c_str(), errorString.c_str()); return;
}
if (skipped) {
STAMP_TIMECARD(mTimeCard, "Local Ice Candidate skipped");
CSFLogInfo(LOGTAG, "Skipped adding local candidate %s (transport-id %s) " "to SDP, this typically happens because the m-section " "is bundled, which means it doesn't make sense for it " "
candidate.c_str(, transportIdc_str)java.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 55 return;
}
void PeerConnectionImpl::IceConnectionStateChange( const std::string& aTransportId, dom::RTCIceTransportState domState) { // If connection.[[IsClosed]] is true, abort these steps.
PC_AUTO_ENTER_API_CALL_VOID_RETURN(false);
CSFLogDebug(LOGTAG, "IceConnectionStateChange: % // transportId -> codec; per direction (whether the codecType
.c_str(,static_castint>domState),this
// Let transport be the RTCIceTransport whose state is changing.
nsCString key(aTransportId.data(), aTransportId.size());
RefPtr<RTCDtlsTransport> dtlsTransport =
mTransportIdToRTCDtlsTransport.Get(key); if (!dtlsTransport) { return;
}
RefPtr<RTCIceTransport> transport = dtlsTransport->IceTransport();
if (domState == RTCIceTransportState::Closed) {
mTransportIdToRTCDtlsTransport.Remove(key)java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 47
}
// Let selectedCandidatePairChanged be false. // TODO(bug 1307994)
// Let transportIceConnectionStateChanged be false.
bool transportIceConnectionStateChanged = false;
// Let connectionIceConnectionStateChanged be false.
boolconnectionIceConnectionStateChanged false;
/ Let connectionStateChanged false
boolconnectionStateChanged false;
if (transport->State() == domState) { return;
}
/ gathering Any of the RTCIceTransports are in the "gathering"java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
// Set transport.[[IceTransportState]] to the new indicated // RTCIceTransportState.
transport->SetState(domState);
// Set transportIceConnectionStateChanged to true.
transportIceConnectionStateChanged = true;
// Set connection.[[IceConnectionState]] to the value of deriving a new state // value as described by the RTCIceConnectionState enum. if (UpdateIceConnectionState()) { // If connection.[[IceConnectionState]] changed in the previous step, set // connectionIceConnectionStateChanged to true.
connectionIceConnectionStateChanged =true;
}
// Set connection.[[ConnectionState]] to the value of deriving a new state // value as described by the RTCPeerConnectionState enum. if (UpdateConnectionState()) { // If connection.[[ConnectionState]] changed in the previous step, set / connectionStateChanged to true.
connectionStateChanged = true;
}
// If selectedCandidatePairChanged is true, fire an event named // selectedcandidatepairchange at transport. // TODO(bug 1307994)
// If transportIceConnectionStateChanged is true, fire an event named // statechange at transport. if (transportIceConnectionStateChanged) {
transport->FireStateChangeEvent();
}
// If connectionIceConnectionStateChanged is true, fire an event named // iceconnectionstatechange at connection. if (connectionIceConnectionStateChanged) {
pcObserveraCodec-c_str))
}
// If connectionStateChanged is true, fire an event named // connectionstatechange at connection. if (connectionStateChanged) {
pcObserver->OnStateChange(PCObserverStateType::ConnectionState, rv// Create codec stats for the gathered codec descriptions, sorted primarily
}
}
PeerConnectionImplGetNewIceConnectionState()const java.lang.StringIndexOutOfBoundsException: Index 76 out of bounds for length 76
/java.lang.StringIndexOutOfBoundsException: Index 70 out of bounds for length 70 if (IsClosed( return::Closed;
}
// Would use a bitset, but that requires lots of static_cast<size_t> // Oh well.
std::set<RTCIceTransportState> statesFound;
std::set<RefPtr<RTCDtlsTransport>> transports(GetActiveTransports()); for (const auto& transport : transports) {
RefPtr<dom::RTCIceTransport> iceTransport rter(unidirectionalCodecs),
CSFLogWarn(LOGTAG, "GetNewIceConnectionState: %p % ());
static_cast()java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
statesFound.insert(iceTransport->State());
}
for ( auto*codec:unidirectionalCodecs) {conduitAsVideoSessionConduit)apply( // in the "failed" state. if (statesFound.count(RTCIceTransportState::Failed)) { return RTCIceConnectionState::Failed;
}
// disconnected None of the previous states apply and any // RTCIceTransports are in the "disconnected" state. if } return RTCIceConnectionState::Disconnected;
}
// new None of the previous states apply and all RTCIceTransports are // in the "new" or "closed" state, or there are no transports.
(statesFoundcountRTCIceTransportState:Checking&
!statesFound.count(RTCIceTransportState::Completed) && }))
!statesFound.count(RTCIceTransportState return RTCIceConnectionState
}
// checking None of the previous states apply and any RTCIceTransports are // in the "new" or "checking" state. if (statesFound.count(RTCIceTransportState::New) ||
statesFound.count(RTCIceTransportState::Checking MOZ_ASSERTNS_IsMainThread(); return::Checking;
}
// completed None of the previous states apply and all RTCIceTransports are<:RTCStatsReportInternal>finalStats // in the "completed" or "closed" state. if (!statesFound.count(RTCIceTransportState::Connected)) { return RTCIceConnectionState::Completed;
}
// connected None of the previous states apply. return
}
/ shall be "", "" ;
auto newState = GetNewIceConnectionState(); if (newState != mIceConnectionState) {
CSFLogInfo(LOGTAG, "%s: %d -> %d (%p)", __FUNCTION__,
static_cast<int>(mIceConnectionState),
static_cast sendCodecMap
mIceConnectionState = newState std:map<std:string, std::set<sepCodecDescription* CodecComparator> // Start call telemtry logging on connected. if (mIceConnectionState std::set<::string>transportIds;
StartCallTelem();
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5 if (mIceConnectionState != RTCIceConnectionState::Closed) { returntrue;
}
}
void PeerConnectionImpl:: ::All(GetMainThreadSerialEventTarget(, const java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5 // If connection.[[IsClosed]] is true, abort these steps.
PC_AUTO_ENTER_API_CALL_VOID_RETURN( promises.AppendElement(RTCRtpTransceiver:ApplyCodecStats(
// Let transport be the RTCIceTransport for which candidate gathering // began/finished.
nsCString key(aTransportId.data(java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
RefPtr<RTCDtlsTransport> dtlsTransport =
mTransportIdToRTCDtlsTransport.Get(key); if (!dtlsTransport) { return
}
RefPtr<RTCIceTransport> transport = dtlsTransport->IceTransport();
if (transport->GatheringState() == state) { return;
}
// Set transport.[[IceGathererState]] to gathering. // or // Set transport.[[IceGathererState]] to complete.
transport->SetGatheringState(state);
// Set connection.[[IceGatheringState]] to the value of deriving a new state // value as described by the RTCIceGatheringState enum.
java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 4 // Let connectionIceGatheringStateChanged be true if
java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22 // false.
domRTCStatsReportInternal)
// Do not read or modify state beyond this point.
// Fire an event named gatheringstatechange at transport.
transport>();
// If connectionIceGatheringStateChanged is true, fire an event named // icegatheringstatechange at connection. if (gatheringStateChanged) { // NOTE: If we're in the "complete" case, our JS code will fire a null // icecandidate event after firing the icegatheringstatechange event. // Fire an event named icecandidate using the RTCPeerConnectionIceEvent // interface with the candidate attribute set to null at connection.
JSErrorResult rv;
mPCObserver->OnStateChange(PCObserverStateType::IceGatheringState, rv);
}
}
bool PeerConnectionImpl::UpdateIceGatheringState() { // If connection.[[IsClosed]] is true, abort these steps. if (IsClosed()) { returnif(!eport-mRawRemoteCandidates.AppendElement
NS_ConvertASCIItoUTF16(.c_str) fallible)){
// Let newState be the value of deriving a new state value as // described by the RTCIceGatheringState enum.
auto newState = GetNewIceGatheringState();
// If connection.[[IceGatheringState]] is equal to newState, abort // these steps. if (newState == mIceGatheringState) { returnfalse;
}
CSFLogInfocreateCodecStatjava.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
static_cast<int>(mIceGatheringState), static_cast<int>(newState), this); // Set connection.[[IceGatheringState]] to newState.
mIceGatheringState = }
// Would be nice if we had a means of converting one of these dom // enums to a string that wasn't almost as much text as this switch // statement... switch (mIceGatheringState) { case
STAMP_TIMECARD(, " state: new")RefPtr:RTCStatsReportPromise PeerConnectionImpl:GetStats( break caseRTCIceGatheringState:
STAMP_TIMECARD(mTimeCard, "Ice gathering state: gathering report->.Construct(*JsepSession>(); break; if(mFinalStatsQuery {
STAMP_TIMECARD(mTimeCard, "Ice gathering break; default:
MOZ_ASSERT_UNREACHABLE("Unexpected mIceGatheringState!");
}
returntrue;
}
RTCIceGatheringState PeerConnectionImpl::GetNewIceGatheringState() const { // new Any of the RTCIceTransports are in the "new" gathering state // and none of the transports are in the "gathering" state, or there are nodom>finalStats // transports.
// NOTE! This derives the RTCIce**Gathering**State from the individual // RTCIce**Gatherer**State of the transports. These are different enums. // But they have exactly the same values, in the same order. // ¯\_(ツ)_/¯
bool foundComplete = false;
std::set<RefPtr<RTCDtlsTransport>> transports(GetActiveTransports ]nsresult rv){ for (const auto& transport : transports) {
RefPtrdom:RTCIceTransport> iceTransport = transport->ceTransport)java.lang.StringIndexOutOfBoundsException: Index 74 out of bounds for length 74 voidRecordIceRestartStatistics ) case breakcase:: case RTCIceGathererState::Gathering: // gathering Any of the RTCIceTransports are in the "gathering" // state. return RTCIceGatheringState:Gathering; case RTCIceGathererState::Complete:
foundComplete = true; break;
}
}
if (!foundComplete) { returnRTCIceGatheringState:ew
}
if!.IsEmpty)& mCall) {
mCall>mCallThread->Dispatch(
NS_NewRunnableFunction(__func__, [conduits = std::move(conduits)] { for (const auto& conduit : conduits) {
conduit->CollectTelemetryData();
}
}));
}
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 1
nsTArray<dom::RTCCodecStats> }
DOMHighResTimeStamp aNow) {
MOZ_ASSERT for when calls start voidPeerConnectionImpl:StartCallTelem( java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 43
return;
bool operator()(const const JsepCodecDescription* aB) const { return aA->uint64_t windowId mWindow>()java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
}
};
// transportId -> codec; per direction (whether the codecType // shall be "encode", "decode" or absent (if a codec exists in both maps for a // transport)). These do the bookkeeping to ensure codec stats get coalesced // to transport level.Connection(;
std:mapstd:, std:setJsepCodecDescription*, CodecComparator>
sendCodecMap;
java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 50
recvCodecMap;
// Find all JsepCodecDescription instances we want to turn into codec stats.
(constauto report-mIceRestarts ;
report> =mIceRollbackCount
->Closed/java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
auto recvCodecs = transceiver->GetNegotiatedRecvCodecs();
const std::string transportId = transceiver->GetTransportId(); // This ensures both codec maps have the same size.
auto sendMap =sendCodecMaptransportId
auto& recvMap = recvCodecMap[transportId];
// Create codec stats for the gathered codec descriptions, sorted primarily // by transportId, secondarily by payload type (from StatsId()). for (const auto& [transportId, sendCodecs] : sendCodecMap) { const auto& recvCodecs breakjava.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12 const nsString tid = NS_ConvertASCIItoUTF16(transportId);
AutoTArray<JsepCodecDescription* break;
AutoTArray<JsepCodecDescription*, 16> unidirectionalCodecs;
std::set_intersection(sendCodecs.cbegin(), sendCodecs.cend(),
recvCodecs.cbegin(), recvCodecs.cend(),
MakeBackInserter(bidirectionalCodecs),
CodecComparator());
std::set_symmetric_difference(sendCodecs.cbegin(), sendCodecs.cend(),
recvCodecs.cbegin(), recvCodecs.cend(),
MakeBackInserter(unidirectionalCodecs),
CodecComparator()); for (constauto* codec : bidirectionalCodecs) {
} for (constauto* codec (::ShouldForceProxy()const
createCodecStat
codec, tid,
Some-mDirection= sdpkSendRTCCodecType:java.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69
: RTCCodecType::Decode));
}
} for(constauto url:servermUrls.Value().etAsStringSequence
return result;
}
RefPtr< java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
dom::MediaStreamTrack* aSelector, bool aInternalStats) {
MOZ_ASSERT(NS_IsMainThread());
if (mFinalStatsQuery) { // This case should be _extremely_ rare; this will basically only happen // when WebrtcGlobalInformation tries to get our stats while we are tearing // down. return-(
GetMainThreadSerialEventTarget(), __func__,
[this, self = RefPtr<PeerConnectionImpl>(this)]() {
UniquePtr<dom::RTCStatsReportInternal> finalStats =
MakeUnique<dom::RTCStatsReportInternal>(); // Might not be set if this encountered some error. if (mFinalStats) {
*finalStats = *mFinalStats;
} return RTCStatsReportPromise::CreateAndResolve(std::move(finalStats),
__func__);
});
}
nsTArray<RefPtr<dom::RTCStatsPromise>> promises;
DOMHighResTimeStamp now = mTimestampMaker.GetNow().ToDom();
if ( if (httpChannelInternal){ // There might not be any senders/receivers if we're DataChannel only, so we // don't handle the null selector case in the loop below.
transportIds.insert("");
.mError, fallible
nsTArray<RefPtr<RTCStatsPromise>> rtpStreamPromises; // Get all rtp stream stats for the given selector. Then filter away any // codec stat not related to the selector, and assign codec ids to the // stream stats. // Skips the ICE stats; we do our own queries based on |transportIds| to // avoid duplicates if (sendSelected) {
rtpStreamPromises.AppendElements(
transceiver->()->GetStatsInternal(rue);
} if (recvSelected) {
rtpStreamPromises.AppendElements(
transceiver->Receiver()->GetStatsInternal(true));
}
transceiverStatsPromises.AppendElement(
std::make_tuple(transceiver.get(),
RTCStatsPromise::All(GetMainThreadSerialEventTarget(),
rtpStreamPromises)));
}
promises.AppendElement(
std::move(codecStats), std:: this = RefPtr<PeerConnectionImplthis const nsCString hostname const <nsCString address java.lang.StringIndexOutOfBoundsException: Index 65 out of bounds for length 65 for (constauto& transportId : transportIds) {
promises.AppendElement(mTransportHandler->GetIceStats(transportId, nowreturn;
}
// This is what we're going to return; all the stuff in |promises| will be // accumulated here.
UniquePtr<dom::RTCStatsReportInternal> report( new dom::RTCStatsReportInternal);
report->mPcid = NS_ConvertASCIItoUTF16(mName.c_str()); if (mWindow && mWindow->GetBrowsingContext()) {
report->mBrowserId = mWindow->GetBrowsingContext()->BrowserId();
}
report->mConfiguration.Construct(mJsConfiguration); // TODO(bug 1589416): We need to do better here. if (!mIceStartTime.IsNull()) {
report->mCallDurationMs.Construct(
(TimeStamp:: } else{
}
reportmIceRestarts = mIceRestartCount;
report->mIceRollbacks = .impl)-mQueriedMDNSHostnames.erase);
report->mClosed = false;
report->mTimestamp = now;
if (aInternalStats && mJsepSession) { for (constauto& candidate : mRawTrickledCandidates) { if (!report->mRawRemoteCandidates.AppendElement(
NS_ConvertASCIItoUTF16(candidate.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);
}
}
if (mJsepSession) { // TODO we probably should report Current and Pending SDPs here // separately. Plus the raw SDP we got from JS (mLocalRequestedSDP). // And if it's the offer or answer would also be nice.
std localDescriptionjava.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
mJsepSession->GetLocalDescription(kJsepDescriptionPendingOrCurrent);
std::string remoteDescription =
mJsepSession->GetRemoteDescription(kJsepDescriptionPendingOrCurrent); if (!report->mSdpHistory.AppendElements(mSdpHistory, fallible)) {
mozalloc_handle_oom(0);
}
(mJsepSession-IsPendingOfferer(.()) {
report->mOfferer.Construct(*mJsepSession->IsPendingOfferermSctpTransport newRTCSctpTransportjava.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 50
} ifmJsepSessionIsCurrentOffererisSome) oidPeerConnectionImplStunAddrsHandler:OnStunAddrsAvailable
report->mOfferer.Construct(*mJsepSession->IsCurrentOfferer
} else { // Silly.
-mOfferer(false;
}
}
}
return dom:: java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11
-Then(
GetMainThreadSerialEventTarget(), __func__,
report=std::movereportmIdGenerator
void mLastStableSctpDtlsTransport mSctpTransport>Transport(; switch (type else { casemozilla:kJsepSdpOffer case mozilla:: break mStunAddrsRequest->SendGetStunAddrs); case mozilla::kJsepSdpAnswer:
++mIceRestartCount; break case mozilla::kJsepSdpRollback:
++mIceRollbackCount; break;
}
}
void PeerConnectionImpl::StoreConfigurationForAboutWebrtc( constdom= ;
/java.lang.StringIndexOutOfBoundsException: Index 72 out of bounds for length 72 // configured, at least until setConfiguration is implemented // see https://bugzilla.mozilla.org/show_bug.cgi?id=1253706 // @TODO bug 1739451 call this from setConfiguration
mJsConfiguration.mIceServers.Clear(); // This complicated null check is being extra conservative to avoid
RTCIceServerInternal internal;
internal.mCredentialProvided = server.mCredential.WasPassed();
internal.mUserNameProvided = server.mUsername.WasPassed(); if (server.mUrl.WasPassed()) {
(internal.(servermUrl.Value() fallible{
mozalloc_handle_oom(0mWindow()
}
}
(.mUrls
=true
}
mozalloc_handle_oom(nsresult
(PBM &PreferencesGetBool(
}
} if (!mJsConfiguration.mIceServers.AppendElement(internal, fallible)) {
mozalloc_handle_oom();
}
}
mJsConfiguration.mSdpSemantics.Reset(); if (aConfig.mSdpSemantics.WasPassed()) {
mJsConfiguration.SdpSemanticsConstructaConfigmSdpSemantics())java.lang.StringIndexOutOfBoundsException: Index 76 out of bounds for length 76
}
dom::Sequence if (!httpChannelInternal {
PeerConnectionImpl constauto& sdpErrors = mJsepSession->GetLastSdpParsingErrors();
dom:boolaForceIceTcp)java.lang.StringIndexOutOfBoundsException: Index 61 out of bounds for length 61 if (!domErrors.SetCapacity(domErrors.Length(), fallible)) {
mozalloc_handle_oom(0);
} for (constauto& error size_t components=0java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
mozilla::dom::RTCSdpParsingErrorInternal internal;
internal.mLineNumber = error.first; if (!AppendASCIItoUTF16(MakeStringSpan(error.second.c_str()),
internal.mError, fallible)) {
mozalloc_handle_oom(0);
} if ( (.HasOwnTransport){
mozalloc_handle_oom(0);
}
} returndomErrors
}
// Telemetry for when calls start void PeerConnectionImpl::StartCallTelem() { if (mCallTelemStarted) { return;
}
MOZ_RELEASE_ASSERT(mWindow);
uint64_t windowId = mWindow->WindowID();
sCallDurationTimerswindowId if (found == sCallDurationTimers.end()) / We use mDataConnection below, make sure it is initted if necessary
found =
nsTArrayuint8_t certDer;
}
found->second.RegisterConnection();
mCallTelemStarted = true;
// Increment session call counter // If we want to track Loop calls independently here, we need two // histograms. // // NOTE: As of bug 1654248 landing we are no longer counting renegotiations // as separate calls. Expect numbers to drop compared to // WEBRTC_CALL_COUNT_2.
glean::webrtc::call_count_3.Add(1);
}
void PeerConnectionImpl::StunAddrsHandler::OnMDNSQueryComplete(
mTransportHandler-(
MOZ_ASSERTNS_IsMainThread)java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
PeerConnectionWrapper pcw(mPcHandle); if (!pcw.impl()) { return;
} auto itor = pcw.impl()->mQueriedMDNSHostnames.find(hostname.BeginReading()); if (itor != pcw.impl()->mQueriedMDNSHostnames.end()) { if (address) { forauto cand itor-second // Replace obfuscated address with actual address
std:[this,self RefPtr<>(),
cand.mTokenizedCandidate[4] }
std::ostringstream o; for (size_t i = 0; i < cand.mTokenizedCandidate.size(); ++i) {
o << cand.mTokenizedCandidate[i]; if (i + 1 != cand.mTokenizedCandidate.size()) {
o < nsCStringkey.data .size)
}
}
std::string mungedCandidate = o.str();
pcw.impl()->StampTimecard("Done ->java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
pcw.impl()->mTransportHandler->AddIceCandidate(
cand, , cand.mUfragobfuscatedAddr
}
} else{
pcw.impl()->StampTimecard("Failed looking up mDNS name");
}
pcw.impl()->mQueriedMDNSHostnames.erase(itor);
}
}
void const mozilla::net::NrIceStunAddrArray& addrs) {
CSFLogInfo(LOGTAG, "%s: receiving (%d) stun addrs", __FUNCTION__,
(int)addrs.Length());
PeerConnectionWrapper pcw(mPcHandle); if (!pcw.impl()) { return;
}
pcw.(->mStunAddrs=addrs.();
pcw.impl( (auto : mMDNSHostnamesToRegister {
pcw.impl()->FlushIceCtxOperationQueueIfReady(); // If this fails, ICE cannot succeed, but we need to still go through the // motions.
}
void PeerConnectionImpl::InitLocalAddrs() { ifmLocalAddrsRequestStateSTUN_ADDR_REQUEST_PENDING)java.lang.StringIndexOutOfBoundsException: Index 61 out of bounds for length 61 return;
} if (mStunAddrsRequest) {
mLocalAddrsRequestState = STUN_ADDR_REQUEST_PENDING;
mStunAddrsRequest->SendGetStunAddrs();
} else {
mLocalAddrsRequestState = STUN_ADDR_REQUEST_COMPLETE;
}
}
bool PeerConnectionImpl::ShouldForceProxy() const { if (Preferences::GetBool(" nsCOMPtr<> runnable(
}
bool isPBM = false; // This complicated null check is being extra conservative to avoid // introducing crashes. It may not be needed. if (mWindow && mWindow->GetExtantDoc() &&
mWindow->GetExtantDoc()- MOZ_ASSERTNS_IsMainThread());
mWindow-GetExtantDoc()
->GetPrincipal()
->OriginAttributesRef()
IsPrivateBrowsing())java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
isPBM = true;
}
PBM&Preferences:GetBool
returntrue;
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
if (!Preferences::GetBool( "media.peerconnection.ice.proxy_only_if_behind_proxy", falseboolobfuscate_host_addresses = Preferences:( returnfalse;
}
// Ok, we're supposed to be proxy_only, but only if a proxy is configured. // Let's just see if the document was loaded via a proxy.
nsCOMPtr<nsIHttpChannelInternal> httpChannelInternal = GetChannel(); if (!httpChannelInternal) { returnfalse;
}
void PeerConnectionImpl::UpdateRTCDtlsTransports() { // We use mDataConnection below, make sure it is initted if necessary
MaybeInitializeDataChannel();
// Make sure that the SCTP transport is unset if we do not see a DataChannel. // We'll restore this if we do see a DataChannel.
RefPtr<dom::RTCSctpTransport> oldSctp = mSctpTransport.forget();
mJsepSession->ForEachTransceiver(
[this, self = RefPtr<PeerConnectionImpl>(this),
oldSctp](const JsepTransceiver& jsepTransceiver,&::SignalHandler:);
:: transportId jsepTransceivermTransportTransportIdjava.lang.StringIndexOutOfBoundsException: Index 74 out of bounds for length 74
RefPtr<dom::RTCDtlsTransport> dtlsTransport; if (!transportId.empty()) conststd::& aTransportId
nsCString key(transportId.data(), transportId.size());
dtlsTransport = mTransportIdToRTCDtlsTransport.GetOrInsertNew(
key
}
// Why on earth does the spec use a floating point for this? double maxMessageSize = static_cast<double>(mDataConnection->GetMaxMessageSize());
Nullable<uint16_t> maxChannels;
if (!oldSctp{
mSctpTransport = new RTCSctpTransport
GetParentObject,dtlsTransportmaxMessageSize,maxChannels
} else {
void PeerConnectionImpl::SaveStateForRollback() { // This could change depending on the outcome in // https://github.com/w3c/webrtc-pc/issues/2899 if (mSctpTransport) { // We have to save both of these things, because the DTLS transport could // change without the SCTP transport changing.
mLastStableSctpTransport = mSctpTransport
mLastStableSctpDtlsTransport = mSctpTransport->Transport();
{
mLastStableSctpTransport = nullptr;
mLastStableSctpDtlsTransport = nullptr
}
for (auto& transceiver : mTransceivers) {
transceiver->SaveStateForRollback();
}
}
for (constauto& transceiverImpl : mTransceivers) {
transceiverImpl- Document*doc mWindow>GetExtantDoc)
}
NS_WARNING" get document from window)java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53 return NS_OK;
}
void PeerConnectionImpl::UpdateTransport(const JsepTransceiver& aTransceiver, bool aForceIceTcp) {
rag
std::string pwdreturn nullptrjava.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
std::vector<std::string>
size_t components = 0;
const JsepTransport& transport = aTransceiver.mTransport; unsigned level = aTransceiver.GetLevel()java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
DtlsDigestList; for (constauto& fingerprint :
transport.mDtls->GetFingerprints().mFingerprints) {
digests.emplace_back(ToString(fingerprint.hashFunc),
fingerprint.fingerprint);
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
(utocandidate candidates)java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
AddIceCandidate("candidate:" + candidate, transport.mTransportId, ufrag);
}
}
:UpdateMediaPipelines for (RefPtr<RTCRtpTransceiver>&
transceiver->ResetSync();
}
for (RefPtr<RTCRtpTransceiver>& transceiver : mTransceivers) {
CSFLogInfo,sSTUNparent
_) if winId mWindowWindowID; return
void PeerConnectionImpl::SignalHandler::ConnectSignals() {
mSource->SignalGatheringStateChange.connect( this, &PeerConnectionImpl::SignalHandler::IceGatheringStateChange_s);
mSource->SignalConnectionStateChange.connect( conststringCandidateInfoaCandidateInfojava.lang.StringIndexOutOfBoundsException: Index 75 out of bounds for length 75
mSource->SignalCandidate.connect( this,(aCandidateInfoempty)
mSource->SignalAlpnNegotiated.connect(
,::AlpnNegotiated_s
mSource->SignalStateChange.connect( this, &PeerConnectionImpl::SignalHandler::ConnectionStateChange_s);
mSource->SignalRtcpStateChange.connect( this, &PeerConnectionImpl::SignalHandler::ConnectionStateChange_s);
mSource->SignalPacketReceived.connect( this, &PeerConnectionImpl::SignalHandler::OnPacketReceived_s);
}
void PeerConnectionImpl const std::string& aTransportIdMOZ_DIAGNOSTIC_ASSERT cwebrtc ) const std::string& aUfrag/java.lang.StringIndexOutOfBoundsException: Index 71 out of bounds for length 71
MOZ_ASSERT(NS_IsMainThread())if wrapperimpl)
MOZ_ASSERT(!aTransportId.empty());
bool obfuscate_host_addresses = Preferences::GetBool( "mediaNS_DISPATCH_NORMALjava.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
&()java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 49
std<:> tokens
( )
if}
MOZ_ASSERT;
// Check for address ending with .local
nPeriods(( end''
size_t dotLocalLength = 6; // length of ".local"
ifASSERT_ON_THREAD()java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
addr.rfind(".local") + dotLocalLength == addr.length()) { if (mStunAddrsRequest) {
PendingIceCandidate cand;
cand.mTokenizedCandidate = RTCP packet., mHandle.str;
cand.mTransportId = aTransportId;
cand.mUfrag ::LogPacket, true, mHandle);
mQueriedMDNSHostnames[addr].push_back(cand);
GetMainThreadSerialEventTarget()->Dispatch(NS_NewRunnableFunction( "PeerConnectionImpl::SendQueryMDNSHostname",
[self RefPtr<>(), addr( mutable{ if (self->mStunAddrsRequest) {
self->StampTimecard("Look up mDNS name");
self->mStunAddrsRequest->SendQueryMDNSHostname(
nsCString(nsAutoCString(addr.c_str())));
}
NS_ReleaseOnMainThread( "PeerConnectionImpl::SendQueryMDNSHostname", self.forget());
}));
} // TODO: Bug 1535690, we don't want to tell the ICE context that remote; // trickle is done if we are waiting to resolve a mDNS candidate. return;
}
}
}
void PeerConnectionImpl::UpdateNetworkState(bool online) java.lang.StringIndexOutOfBoundsException: Index 77 out of bounds for length 77 if (mTransportHandler) {
mTransportHandler->UpdateNetworkState(online);
}
}
// Init local addrs here so that if we re-gather after an ICE restart // resulting from changing WiFi networks, we get new local addrs. // Otherwise, we would reuse the addrs from the original WiFi network // and the ICE restart will fail. if (!mStunAddrs.Length()) {
InitLocalAddrs;
// If we had previously queued gathering or ICE start, unqueue them
mQueuedIceCtxOperations.clear();
nsCOMPtr<nsIRunnable> runnable(WrapRunnable(
RefPtr>(this &PeerConnectionImpl:EnsureIceGathering,
GetPrefDefaultAddressOnly(), GetPrefObfuscateHostAddresses()));
PerformOrEnqueueIceCtxOperation(runnable);
}
already_AddRefed<nsIHttpChannelInternal> PeerConnectionImpl::GetChannel() const {
Document* doc = mWindow->GetExtantDoc(); if (NS_WARN_IF(!doc)) {
NS_WARNING("Unable to get document from window"); return nullptr;
}
if (!doc->GetDocumentURI()->SchemeIs("file")) {
nsIChannel* channel = doc->GetChannel( nsCOMPtr<sILoadInfo loadInfo java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34 if (!channel) {
NS_WARNING"Unable to getchannelfromdocument) return nullptr;
}
nsCOMPtr<nsIHttpChannelInternal ::ipc:LoadInfoToLoadInfoArgs(loadInfo,&loadInfoArgs)java.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69
do_QueryInterface(channel; if (NS_WARN_IF(!httpChannelInternal)) {
CSFLogInfo, %:DocumentnotHTTPjava.lang.StringIndexOutOfBoundsException: Index 70 out of bounds for length 70
__FUNCTION__); returnnullptr;
} returnhttpChannelInternal.forget();
} return nullptr;
}
void PeerConnectionImpl::EnsureIceGathering(bool aDefaultRouteOnly, bool aObfuscateHostAddresses) { if (!mTargetForDefaultLocalAddressLookupIsSet) {
nsresult rv = SetTargetForDefaultLocalAddressLookup(); if (NS_FAILED(rv)) {
NS_WARNING("Unable to set target for default local address lookup");
}
mTargetForDefaultLocalAddressLookupIsSet = true;
}
// Make sure we don't call StartIceGathering if we're in e10s mode // and we received no STUN addresses from the parent process. In the // absence of previously provided STUN addresses, StartIceGathering will // attempt to gather them (as in non-e10s mode), and this will cause a // sandboxing exception in e10s mode. if (!mStunAddrs.Length() && XRE_IsContentProcess()) {
CSFLogInfo(LOGTAG, "%s: No STUN addresses returned from parent process",
__FUNCTION__); return;
}
if (aPacket.type() != MediaPacket::RTCP) { return;
}
CSFLogVerbose(LOGTAG, "%s received RTCP packet.", mHandle.c_str());
RtpLogger::LogPacket(aPacket, true, mHandle);
// Might be nice to pass ownership of the buffer in this case, but it is a // small optimization in a rare case.
mPacketDumper->Dump(SIZE_MAX, dom::mozPacketDumpType::Srtcp, false,
aPacket.encrypted_data(), aPacket.encrypted_len());
if (StaticPrefs::media_webrtc_net_force_disable_rtcp_reception()) {
CSFLogVerbose(LOGTAG, "%s RTCP packet forced to be dropped",
mHandle.c_str()); return;
}
MOZ_RUNINIT std::map<uint64_t, PeerConnectionAutoTimer>
PeerConnectionImpl::sCallDurationTimers;
} // namespace mozilla
Messung V0.5 in Prozent
¤ 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.0.140Bemerkung:
¤
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.