mirror of
https://github.com/mollyim/webrtc.git
synced 2025-05-17 07:37:51 +01:00
peerconnection: add was-ever-connected boolean flag
and report some metrics only on the first connection state change to connected BUG=webrtc:12383 Change-Id: I32908e23c51aa40730be8e534793829268d4e25e Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/208583 Reviewed-by: Harald Alvestrand <hta@webrtc.org> Commit-Queue: Philipp Hancke <philipp.hancke@googlemail.com> Cr-Commit-Position: refs/heads/master@{#33333}
This commit is contained in:
parent
2ee9415a8c
commit
cd0373f013
2 changed files with 9 additions and 3 deletions
|
@ -1797,9 +1797,11 @@ void PeerConnection::SetConnectionState(
|
|||
connection_state_ = new_state;
|
||||
Observer()->OnConnectionChange(new_state);
|
||||
|
||||
// The connection state change to connected usually happens once per
|
||||
// connection which makes it a good point to report metrics.
|
||||
if (new_state == PeerConnectionState::kConnected) {
|
||||
if (new_state == PeerConnectionState::kConnected && !was_ever_connected_) {
|
||||
was_ever_connected_ = true;
|
||||
|
||||
// The first connection state change to connected happens once per
|
||||
// connection which makes it a good point to report metrics.
|
||||
// Record bundle-policy from configuration. Done here from
|
||||
// connectionStateChange to limit to actually established connections.
|
||||
BundlePolicyUsage policy = kBundlePolicyUsageMax;
|
||||
|
|
|
@ -707,6 +707,10 @@ class PeerConnection : public PeerConnectionInternal,
|
|||
std::unique_ptr<RtpTransmissionManager> rtp_manager_;
|
||||
|
||||
rtc::WeakPtrFactory<PeerConnection> weak_factory_;
|
||||
|
||||
// Did the connectionState ever change to `connected`?
|
||||
// Used to gather metrics only the first such state change.
|
||||
bool was_ever_connected_ RTC_GUARDED_BY(signaling_thread()) = false;
|
||||
};
|
||||
|
||||
} // namespace webrtc
|
||||
|
|
Loading…
Reference in a new issue