Bug 1406434 - fixing ice restart and rollback counts on about:webrtc. r=ng
This is re-adding changes from
Bug 1321628 that were overwritten by the
webrtc.org v49 import.
MozReview-Commit-ID: GI4OdFANJ8N
--- a/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp
+++ b/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp
@@ -305,16 +305,18 @@ PeerConnectionImpl::PeerConnectionImpl(c
, mCertificate(nullptr)
, mPrivacyRequested(false)
, mSTSThread(nullptr)
, mAllowIceLoopback(false)
, mAllowIceLinkLocal(false)
, mForceIceTcp(false)
, mMedia(nullptr)
, mUuidGen(MakeUnique<PCUuidGenerator>())
+ , mIceRestartCount(0)
+ , mIceRollbackCount(0)
, mHaveConfiguredCodecs(false)
, mHaveDataStream(false)
, mAddCandidateErrorCount(0)
, mTrickle(true) // TODO(ekr@rtfm.com): Use pref
, mNegotiationNeeded(false)
, mPrivateWindow(false)
, mActiveOnWindow(false)
, mPacketDumpEnabled(false)
@@ -1684,27 +1686,29 @@ PeerConnectionImpl::RollbackIceRestart()
if (NS_FAILED(nrv)) {
CSFLogError(logTag, "%s: Couldn't set ICE credentials, res=%u",
__FUNCTION__,
static_cast<unsigned>(nrv));
return nrv;
}
mPreviousIceUfrag = "";
mPreviousIcePwd = "";
+ ++mIceRollbackCount;
return NS_OK;
}
void
PeerConnectionImpl::FinalizeIceRestart()
{
mMedia->FinalizeIceRestart();
// clear the previous ice creds since they are no longer needed
mPreviousIceUfrag = "";
mPreviousIcePwd = "";
+ ++mIceRestartCount;
}
NS_IMETHODIMP
PeerConnectionImpl::SetLocalDescription(int32_t aAction, const char* aSDP)
{
PC_AUTO_ENTER_API_CALL(true);
if (!aSDP) {
@@ -3673,16 +3677,18 @@ PeerConnectionImpl::BuildStatsQuery_m(
// We do not use the pcHandle here, since that's risky to expose to content.
query->report = new RTCStatsReportInternalConstruct(
NS_ConvertASCIItoUTF16(mName.c_str()),
query->now);
query->iceStartTime = mIceStartTime;
query->failed = isFailed(mIceConnectionState);
+ query->report->mIceRestarts.Construct(mIceRestartCount);
+ query->report->mIceRollbacks.Construct(mIceRollbackCount);
// Populate SDP on main
if (query->internalStats) {
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::string localDescription = mJsepSession->GetLocalDescription(
--- a/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.h
+++ b/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.h
@@ -792,16 +792,18 @@ private:
bool mForceIceTcp;
RefPtr<PeerConnectionMedia> mMedia;
// The JSEP negotiation session.
mozilla::UniquePtr<PCUuidGenerator> mUuidGen;
mozilla::UniquePtr<mozilla::JsepSession> mJsepSession;
std::string mPreviousIceUfrag; // used during rollback of ice restart
std::string mPreviousIcePwd; // used during rollback of ice restart
+ unsigned long mIceRestartCount;
+ unsigned long mIceRollbackCount;
// Start time of ICE, used for telemetry
mozilla::TimeStamp mIceStartTime;
// Start time of call used for Telemetry
mozilla::TimeStamp mStartTime;
bool mHaveConfiguredCodecs;