Skip to content

Commit

Permalink
count webrtc pranswer usage
Browse files Browse the repository at this point in the history
count webrtc pranswer usage for connected connections

BUG=chromium:1006079

Change-Id: I83b819f481d02ed2c71807aa10dd6fb12c8b4faf
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/221740
Reviewed-by: Johannes Kron <[email protected]>
Reviewed-by: Harald Alvestrand <[email protected]>
Commit-Queue: Philipp Hancke <[email protected]>
Cr-Commit-Position: refs/heads/master@{#34269}
  • Loading branch information
fippo authored and WebRTC LUCI CQ committed Jun 11, 2021
1 parent b22abbc commit 1b4807f
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
11 changes: 11 additions & 0 deletions api/uma_metrics.h
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,17 @@ enum BundlePolicyUsage {
kBundlePolicyUsageMax
};

// Metrics for provisional answers as described in
// https://datatracker.ietf.org/doc/html/rfc8829#section-4.1.10.1
// These values are persisted to logs. Entries should not be renumbered and
// numeric values should never be reused.
enum ProvisionalAnswerUsage {
kProvisionalAnswerNotUsed = 0,
kProvisionalAnswerLocal = 1,
kProvisionalAnswerRemote = 2,
kProvisionalAnswerMax
};

// When adding new metrics please consider using the style described in
// https://chromium.googlesource.com/chromium/src.git/+/HEAD/tools/metrics/histograms/README.md#usage
// instead of the legacy enums used above.
Expand Down
10 changes: 10 additions & 0 deletions pc/peer_connection.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1883,6 +1883,16 @@ void PeerConnection::SetConnectionState(
configuration_.ice_candidate_pool_size, 0, 255, 256);
break;
}

// Record whether there was a local or remote provisional answer.
ProvisionalAnswerUsage pranswer = kProvisionalAnswerNotUsed;
if (local_description()->GetType() == SdpType::kPrAnswer) {
pranswer = kProvisionalAnswerLocal;
} else if (remote_description()->GetType() == SdpType::kPrAnswer) {
pranswer = kProvisionalAnswerRemote;
}
RTC_HISTOGRAM_ENUMERATION("WebRTC.PeerConnection.ProvisionalAnswer",
pranswer, kProvisionalAnswerMax);
}
}

Expand Down

0 comments on commit 1b4807f

Please sign in to comment.