Add sent framerates to histogram stats:

"WebRTC.Video.InputFramesPerSecond",
"WebRTC.Video.SentFramesPerSecond".

BUG=488243
R=pbos@webrtc.org, stefan@webrtc.org

Review URL: https://codereview.webrtc.org/1169543005.

Cr-Commit-Position: refs/heads/master@{#9446}
This commit is contained in:
Åsa Persson 2015-06-16 10:17:01 +02:00
parent 1d34fe979c
commit 24b4eda6f4
3 changed files with 28 additions and 3 deletions

View File

@ -1634,6 +1634,8 @@ void EndToEndTest::VerifyHistogramStats(bool use_rtx, bool use_red) {
EXPECT_EQ(1, test::NumHistogramSamples(
"WebRTC.Video.ReceivedPacketsLostInPercent"));
EXPECT_EQ(1, test::NumHistogramSamples("WebRTC.Video.InputFramesPerSecond"));
EXPECT_EQ(1, test::NumHistogramSamples("WebRTC.Video.SentFramesPerSecond"));
EXPECT_EQ(1, test::NumHistogramSamples(
"WebRTC.Video.DecodedFramesPerSecond"));

View File

@ -16,6 +16,7 @@
#include "webrtc/system_wrappers/interface/critical_section_wrapper.h"
#include "webrtc/system_wrappers/interface/logging.h"
#include "webrtc/system_wrappers/interface/metrics.h"
namespace webrtc {
@ -23,11 +24,24 @@ const int SendStatisticsProxy::kStatsTimeoutMs = 5000;
SendStatisticsProxy::SendStatisticsProxy(Clock* clock,
const VideoSendStream::Config& config)
: clock_(clock),
config_(config) {
: clock_(clock), config_(config), last_sent_frame_timestamp_(0) {
}
SendStatisticsProxy::~SendStatisticsProxy() {}
SendStatisticsProxy::~SendStatisticsProxy() {
UpdateHistograms();
}
void SendStatisticsProxy::UpdateHistograms() {
int input_fps =
static_cast<int>(input_frame_rate_tracker_total_.units_second());
int sent_fps =
static_cast<int>(sent_frame_rate_tracker_total_.units_second());
if (input_fps > 0)
RTC_HISTOGRAM_COUNTS_100("WebRTC.Video.InputFramesPerSecond", input_fps);
if (sent_fps > 0)
RTC_HISTOGRAM_COUNTS_100("WebRTC.Video.SentFramesPerSecond", sent_fps);
}
void SendStatisticsProxy::OutgoingRate(const int video_channel,
const unsigned int framerate,
@ -125,11 +139,16 @@ void SendStatisticsProxy::OnSendEncodedImage(
stats->width = encoded_image._encodedWidth;
stats->height = encoded_image._encodedHeight;
update_times_[ssrc].resolution_update_ms = clock_->TimeInMilliseconds();
if (encoded_image._timeStamp != last_sent_frame_timestamp_) {
last_sent_frame_timestamp_ = encoded_image._timeStamp;
sent_frame_rate_tracker_total_.Update(1);
}
}
void SendStatisticsProxy::OnIncomingFrame() {
rtc::CritScope lock(&crit_);
input_frame_rate_tracker_.Update(1);
input_frame_rate_tracker_total_.Update(1);
}
void SendStatisticsProxy::RtcpPacketTypesCounterUpdated(

View File

@ -98,12 +98,16 @@ class SendStatisticsProxy : public CpuOveruseMetricsObserver,
void PurgeOldStats() EXCLUSIVE_LOCKS_REQUIRED(crit_);
VideoSendStream::StreamStats* GetStatsEntry(uint32_t ssrc)
EXCLUSIVE_LOCKS_REQUIRED(crit_);
void UpdateHistograms() EXCLUSIVE_LOCKS_REQUIRED(crit_);
Clock* const clock_;
const VideoSendStream::Config config_;
mutable rtc::CriticalSection crit_;
VideoSendStream::Stats stats_ GUARDED_BY(crit_);
rtc::RateTracker input_frame_rate_tracker_ GUARDED_BY(crit_);
rtc::RateTracker input_frame_rate_tracker_total_ GUARDED_BY(crit_);
rtc::RateTracker sent_frame_rate_tracker_total_ GUARDED_BY(crit_);
uint32_t last_sent_frame_timestamp_ GUARDED_BY(crit_);
std::map<uint32_t, StatsUpdateTimes> update_times_ GUARDED_BY(crit_);
};