diff --git a/webrtc/modules/congestion_controller/delay_based_bwe.cc b/webrtc/modules/congestion_controller/delay_based_bwe.cc index b8e774a0be..bb13aba37a 100644 --- a/webrtc/modules/congestion_controller/delay_based_bwe.cc +++ b/webrtc/modules/congestion_controller/delay_based_bwe.cc @@ -21,6 +21,7 @@ #include "webrtc/modules/pacing/paced_sender.h" #include "webrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimator.h" #include "webrtc/system_wrappers/include/critical_section_wrapper.h" +#include "webrtc/system_wrappers/include/metrics.h" #include "webrtc/typedefs.h" namespace { @@ -78,7 +79,7 @@ DelayBasedBwe::DelayBasedBwe(RemoteBitrateObserver* observer, Clock* clock) total_probes_received_(0), first_packet_time_ms_(-1), last_update_ms_(-1), - ssrcs_() { + uma_recorded_(false) { RTC_DCHECK(observer_); // NOTE! The BitrateEstimatorTest relies on this EXACT log line. LOG(LS_INFO) << "RemoteBitrateEstimatorAbsSendTime: Instantiating."; @@ -196,6 +197,12 @@ bool DelayBasedBwe::IsBitrateImproving(int new_bitrate_bps) const { void DelayBasedBwe::IncomingPacketFeedbackVector( const std::vector& packet_feedback_vector) { RTC_DCHECK(network_thread_.CalledOnValidThread()); + if (!uma_recorded_) { + RTC_LOGGED_HISTOGRAM_ENUMERATION(kBweTypeHistogram, + BweNames::kSendSideTransportSeqNum, + BweNames::kBweNamesMax); + uma_recorded_ = true; + } for (const auto& packet_info : packet_feedback_vector) { IncomingPacketInfo(packet_info.arrival_time_ms, ConvertMsTo24Bits(packet_info.send_time_ms), diff --git a/webrtc/modules/congestion_controller/delay_based_bwe.h b/webrtc/modules/congestion_controller/delay_based_bwe.h index cdcd139cc1..4e34aa13c6 100644 --- a/webrtc/modules/congestion_controller/delay_based_bwe.h +++ b/webrtc/modules/congestion_controller/delay_based_bwe.h @@ -133,6 +133,7 @@ class DelayBasedBwe : public RemoteBitrateEstimator { size_t total_probes_received_; int64_t first_packet_time_ms_; int64_t last_update_ms_; + bool uma_recorded_; rtc::CriticalSection crit_; Ssrcs ssrcs_ GUARDED_BY(&crit_); diff --git a/webrtc/modules/remote_bitrate_estimator/BUILD.gn b/webrtc/modules/remote_bitrate_estimator/BUILD.gn index 7dcf2360c2..bbf74aba7c 100644 --- a/webrtc/modules/remote_bitrate_estimator/BUILD.gn +++ b/webrtc/modules/remote_bitrate_estimator/BUILD.gn @@ -18,6 +18,7 @@ source_set("remote_bitrate_estimator") { sources = [ "aimd_rate_control.cc", "aimd_rate_control.h", + "bwe_defines.cc", "include/bwe_defines.h", "include/remote_bitrate_estimator.h", "include/send_time_history.h", diff --git a/webrtc/modules/remote_bitrate_estimator/bwe_defines.cc b/webrtc/modules/remote_bitrate_estimator/bwe_defines.cc new file mode 100644 index 0000000000..3587ebf744 --- /dev/null +++ b/webrtc/modules/remote_bitrate_estimator/bwe_defines.cc @@ -0,0 +1,13 @@ +/* + * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. + * + * Use of this source code is governed by a BSD-style license + * that can be found in the LICENSE file in the root of the source + * tree. An additional intellectual property rights grant can be found + * in the file PATENTS. All contributing project authors may + * be found in the AUTHORS file in the root of the source tree. + */ +namespace webrtc { + +const char* kBweTypeHistogram = "WebRTC.BWE.Types"; +} // namespace webrtc diff --git a/webrtc/modules/remote_bitrate_estimator/include/bwe_defines.h b/webrtc/modules/remote_bitrate_estimator/include/bwe_defines.h index 9aa82cff97..fc2278e841 100644 --- a/webrtc/modules/remote_bitrate_estimator/include/bwe_defines.h +++ b/webrtc/modules/remote_bitrate_estimator/include/bwe_defines.h @@ -21,6 +21,16 @@ namespace webrtc { static const int64_t kBitrateWindowMs = 1000; +extern const char* kBweTypeHistogram; + +enum BweNames { + kReceiverNoExtension = 0, + kReceiverTOffset = 1, + kReceiverAbsSendTime = 2, + kSendSideTransportSeqNum = 3, + kBweNamesMax = 4 +}; + enum BandwidthUsage { kBwNormal = 0, kBwUnderusing = 1, diff --git a/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator.gypi b/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator.gypi index 9978beb86d..7978576845 100644 --- a/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator.gypi +++ b/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator.gypi @@ -28,6 +28,7 @@ 'include/send_time_history.h', 'aimd_rate_control.cc', 'aimd_rate_control.h', + 'bwe_defines.cc', 'inter_arrival.cc', 'inter_arrival.h', 'overuse_detector.cc', diff --git a/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_abs_send_time.cc b/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_abs_send_time.cc index 33bbe7d9b3..bcd360d88a 100644 --- a/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_abs_send_time.cc +++ b/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_abs_send_time.cc @@ -21,6 +21,7 @@ #include "webrtc/modules/pacing/paced_sender.h" #include "webrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimator.h" #include "webrtc/system_wrappers/include/critical_section_wrapper.h" +#include "webrtc/system_wrappers/include/metrics.h" #include "webrtc/typedefs.h" namespace webrtc { @@ -91,7 +92,7 @@ bool RemoteBitrateEstimatorAbsSendTime::IsWithinClusterBounds( total_probes_received_(0), first_packet_time_ms_(-1), last_update_ms_(-1), - ssrcs_() { + uma_recorded_(false) { RTC_DCHECK(observer_); LOG(LS_INFO) << "RemoteBitrateEstimatorAbsSendTime: Instantiating."; network_thread_.DetachFromThread(); @@ -237,6 +238,12 @@ void RemoteBitrateEstimatorAbsSendTime::IncomingPacketInfo( size_t payload_size, uint32_t ssrc) { RTC_CHECK(send_time_24bits < (1ul << 24)); + if (!uma_recorded_) { + RTC_LOGGED_HISTOGRAM_ENUMERATION(kBweTypeHistogram, + BweNames::kReceiverAbsSendTime, + BweNames::kBweNamesMax); + uma_recorded_ = true; + } // Shift up send time to use the full 32 bits that inter_arrival works with, // so wrapping works properly. uint32_t timestamp = send_time_24bits << kAbsSendTimeInterArrivalUpshift; diff --git a/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_abs_send_time.h b/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_abs_send_time.h index 98305bd0a1..6e37698436 100644 --- a/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_abs_send_time.h +++ b/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_abs_send_time.h @@ -131,6 +131,7 @@ class RemoteBitrateEstimatorAbsSendTime : public RemoteBitrateEstimator { size_t total_probes_received_; int64_t first_packet_time_ms_; int64_t last_update_ms_; + bool uma_recorded_; rtc::CriticalSection crit_; Ssrcs ssrcs_ GUARDED_BY(&crit_); diff --git a/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_single_stream.cc b/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_single_stream.cc index d97bb41784..b1e478f1f3 100644 --- a/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_single_stream.cc +++ b/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_single_stream.cc @@ -21,6 +21,7 @@ #include "webrtc/modules/remote_bitrate_estimator/overuse_estimator.h" #include "webrtc/system_wrappers/include/clock.h" #include "webrtc/system_wrappers/include/critical_section_wrapper.h" +#include "webrtc/system_wrappers/include/metrics.h" #include "webrtc/typedefs.h" namespace webrtc { @@ -54,7 +55,8 @@ RemoteBitrateEstimatorSingleStream::RemoteBitrateEstimatorSingleStream( observer_(observer), crit_sect_(CriticalSectionWrapper::CreateCriticalSection()), last_process_time_(-1), - process_interval_ms_(kProcessIntervalMs) { + process_interval_ms_(kProcessIntervalMs), + uma_recorded_(false) { assert(observer_); LOG(LS_INFO) << "RemoteBitrateEstimatorSingleStream: Instantiating."; } @@ -71,6 +73,14 @@ void RemoteBitrateEstimatorSingleStream::IncomingPacket( int64_t arrival_time_ms, size_t payload_size, const RTPHeader& header) { + if (!uma_recorded_) { + BweNames type = BweNames::kReceiverTOffset; + if (!header.extension.hasTransmissionTimeOffset) + type = BweNames::kReceiverNoExtension; + RTC_LOGGED_HISTOGRAM_ENUMERATION( + kBweTypeHistogram, type, BweNames::kBweNamesMax); + uma_recorded_ = true; + } uint32_t ssrc = header.ssrc; uint32_t rtp_timestamp = header.timestamp + header.extension.transmissionTimeOffset; diff --git a/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_single_stream.h b/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_single_stream.h index ff17c61c16..aa238d1e96 100644 --- a/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_single_stream.h +++ b/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_single_stream.h @@ -61,6 +61,7 @@ class RemoteBitrateEstimatorSingleStream : public RemoteBitrateEstimator { std::unique_ptr crit_sect_; int64_t last_process_time_; int64_t process_interval_ms_ GUARDED_BY(crit_sect_.get()); + bool uma_recorded_; RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(RemoteBitrateEstimatorSingleStream); }; diff --git a/webrtc/modules/remote_bitrate_estimator/transport_feedback_adapter.cc b/webrtc/modules/remote_bitrate_estimator/transport_feedback_adapter.cc index b1be50588e..94ea9dd395 100644 --- a/webrtc/modules/remote_bitrate_estimator/transport_feedback_adapter.cc +++ b/webrtc/modules/remote_bitrate_estimator/transport_feedback_adapter.cc @@ -15,7 +15,7 @@ #include "webrtc/base/checks.h" #include "webrtc/base/logging.h" -#include "webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_abs_send_time.h" +#include "webrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimator.h" #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/transport_feedback.h" #include "webrtc/modules/utility/include/process_thread.h"