Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(108)

Unified Diff: webrtc/video/send_statistics_proxy.cc

Issue 2746903004: Add traces for some video events. (Closed)
Patch Set: Addressed comments. Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/video/send_statistics_proxy.cc
diff --git a/webrtc/video/send_statistics_proxy.cc b/webrtc/video/send_statistics_proxy.cc
index 0d0d3f348cfc23231c00d0e815dea403da131d2a..1f12b2d640ab63d9887d9f087d04cc2ac6993006 100644
--- a/webrtc/video/send_statistics_proxy.cc
+++ b/webrtc/video/send_statistics_proxy.cc
@@ -17,6 +17,7 @@
#include "webrtc/base/checks.h"
#include "webrtc/base/logging.h"
+#include "webrtc/base/trace_event.h"
#include "webrtc/modules/video_coding/include/video_codec_interface.h"
#include "webrtc/system_wrappers/include/metrics.h"
@@ -426,6 +427,8 @@ void SendStatisticsProxy::OnEncoderStatsUpdate(uint32_t framerate,
rtc::CritScope lock(&crit_);
stats_.encode_frame_rate = framerate;
stats_.media_bitrate_bps = bitrate;
+ TRACE_EVENT_INSTANT2("webrtc_stats", "WebRTC.Video.FrameRateSent",
+ "frame_rate", framerate, "ssrc", rtp_config_.ssrcs[0]);
}
void SendStatisticsProxy::OnEncodedFrameTimeMeasured(
@@ -436,6 +439,12 @@ void SendStatisticsProxy::OnEncodedFrameTimeMeasured(
encode_time_.Apply(1.0f, encode_time_ms);
stats_.avg_encode_time_ms = round(encode_time_.filtered());
stats_.encode_usage_percent = metrics.encode_usage_percent;
+ TRACE_EVENT_INSTANT2("webrtc_stats", "WebRTC.Video.EncodeTimeInMs",
+ "encode_time_ms", stats_.avg_encode_time_ms,
+ "ssrc", rtp_config_.ssrcs[0]);
+ TRACE_EVENT_INSTANT2("webrtc_stats", "WebRTC.Video.EncodeUsagePercent",
+ "encode_usage_percent", stats_.encode_usage_percent,
+ "ssrc", rtp_config_.ssrcs[0]);
}
void SendStatisticsProxy::OnSuspendChange(bool is_suspended) {
@@ -643,6 +652,11 @@ void SendStatisticsProxy::OnSendEncodedImage(
uma_container_->max_sent_height_per_timestamp_ =
std::max(uma_container_->max_sent_height_per_timestamp_,
static_cast<int>(encoded_image._encodedHeight));
+
+ TRACE_EVENT_INSTANT2("webrtc_stats", "WebRTC.Video.SentWidthInPixels",
+ "frame_width", encoded_image._encodedWidth, "ssrc", ssrc);
+ TRACE_EVENT_INSTANT2("webrtc_stats", "WebRTC.Video.SentHeightInPixels",
+ "frame_height", encoded_image._encodedHeight, "ssrc", ssrc);
}
int SendStatisticsProxy::GetSendFrameRate() const {
@@ -657,6 +671,10 @@ void SendStatisticsProxy::OnIncomingFrame(int width, int height) {
uma_container_->input_width_counter_.Add(width);
uma_container_->input_height_counter_.Add(height);
uma_container_->cpu_limited_frame_counter_.Add(stats_.cpu_limited_resolution);
+ TRACE_EVENT_INSTANT2("webrtc_stats", "WebRTC.Video.InputFrameRate",
+ "frame_rate", round(
+ uma_container_->input_frame_rate_tracker_.ComputeRate()),
+ "ssrc", rtp_config_.ssrcs[0]);
}
void SendStatisticsProxy::SetResolutionRestrictionStats(
@@ -680,6 +698,7 @@ void SendStatisticsProxy::OnCpuRestrictedResolutionChanged(
rtc::CritScope lock(&crit_);
stats_.cpu_limited_resolution = cpu_restricted_resolution;
++stats_.number_of_cpu_adapt_changes;
+ TRACE_EVENT_INSTANT0("webrtc_stats", "WebRTC.Video.AdaptationChanges");
}
void SendStatisticsProxy::OnQualityRestrictedResolutionChanged(
@@ -700,6 +719,13 @@ void SendStatisticsProxy::RtcpPacketTypesCounterUpdated(
stats->rtcp_packet_type_counts = packet_counter;
if (uma_container_->first_rtcp_stats_time_ms_ == -1)
uma_container_->first_rtcp_stats_time_ms_ = clock_->TimeInMilliseconds();
+
+ TRACE_EVENT_INSTANT2("webrtc_stats", "WebRTC.Video.FirPacketsReceived",
+ "fir_packets_received", packet_counter.fir_packets, "ssrc", ssrc);
+ TRACE_EVENT_INSTANT2("webrtc_stats", "WebRTC.Video.NackPacketsReceived",
+ "nack_packets_received", packet_counter.nack_packets, "ssrc", ssrc);
+ TRACE_EVENT_INSTANT2("webrtc_stats", "WebRTC.Video.PliPacketsReceived",
+ "pli_packets_received", packet_counter.pli_packets, "ssrc", ssrc);
}
void SendStatisticsProxy::StatisticsUpdated(const RtcpStatistics& statistics,
@@ -711,6 +737,9 @@ void SendStatisticsProxy::StatisticsUpdated(const RtcpStatistics& statistics,
stats->rtcp_stats = statistics;
uma_container_->report_block_stats_.Store(statistics, 0, ssrc);
+
+ TRACE_EVENT_INSTANT2("webrtc_stats", "WebRTC.Video.SentPacketsLost",
+ "packets_lost", statistics.cumulative_lost, "ssrc", ssrc);
}
void SendStatisticsProxy::CNameChanged(const char* cname, uint32_t ssrc) {}
@@ -745,6 +774,9 @@ void SendStatisticsProxy::DataCountersUpdated(
} else {
uma_container_->media_byte_counter_.Set(counters.MediaPayloadBytes(), ssrc);
}
+
+ TRACE_EVENT_INSTANT2("webrtc_stats", "WebRTC.Video.SentPackets",
+ "packets_sent", counters.transmitted.packets, "ssrc", ssrc);
}
void SendStatisticsProxy::Notify(uint32_t total_bitrate_bps,
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698