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

Unified Diff: webrtc/video/send_statistics_proxy.cc

Issue 2746903004: Add traces for some video events. (Closed)
Patch Set: Use the webrtc_stats category instead. 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..210c8f6b4f8b231b2bde70ea801396d9f82b6506 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",
tommi 2017/03/15 13:49:08 nit: since WebRTC::Video::FrameRateSent does not m
ehmaldonado_webrtc 2017/03/15 15:29:33 Done. I decided to leave the WebRTC in so it has t
+ "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) {
@@ -579,6 +588,14 @@ void SendStatisticsProxy::OnSendEncodedImage(
stats->height = encoded_image._encodedHeight;
update_times_[ssrc].resolution_update_ms = clock_->TimeInMilliseconds();
+ // Would it be better to report these at the end?
+ TRACE_EVENT_INSTANT2("webrtc_stats", "WebRTC::Video::FrameHeightSent",
+ "frame_height", encoded_image._encodedHeight,
+ "ssrc", ssrc);
+ TRACE_EVENT_INSTANT2("webrtc_stats", "WebRTC::Video::FrameWidthSent",
+ "frame_width", encoded_image._encodedWidth,
+ "ssrc", ssrc);
+
uma_container_->key_frame_counter_.Add(encoded_image._frameType ==
kVideoFrameKey);
stats_.bw_limited_resolution =
@@ -657,6 +674,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::FrameRateInput",
+ "frame_rate", round(
+ uma_container_->input_frame_rate_tracker_.ComputeRate()),
+ "ssrc", rtp_config_.ssrcs[0]);
}
void SendStatisticsProxy::SetResolutionRestrictionStats(
@@ -680,6 +701,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 +722,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::FirsReceived",
+ "fir_packets_received", packet_counter.fir_packets, "ssrc", ssrc);
+ TRACE_EVENT_INSTANT2("webrtc_stats", "WebRTC::Video::NacksReceived",
+ "nack_packets_received", packet_counter.nack_packets, "ssrc", ssrc);
+ TRACE_EVENT_INSTANT2("webrtc_stats", "WebRTC::Video::PlisReceived",
+ "pli_packets_received", packet_counter.pli_packets, "ssrc", ssrc);
}
void SendStatisticsProxy::StatisticsUpdated(const RtcpStatistics& statistics,
@@ -711,6 +740,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::PacketsLost",
+ "packets_lost", statistics.cumulative_lost, "ssrc", ssrc);
}
void SendStatisticsProxy::CNameChanged(const char* cname, uint32_t ssrc) {}
@@ -745,6 +777,9 @@ void SendStatisticsProxy::DataCountersUpdated(
} else {
uma_container_->media_byte_counter_.Set(counters.MediaPayloadBytes(), ssrc);
}
+
+ TRACE_EVENT_INSTANT2("webrtc_stats", "WebRTC::Video::PacketsSent",
+ "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