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

Unified Diff: webrtc/video/send_statistics_proxy.cc

Issue 2060403002: Add task queue to Call. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@move_getpadding
Patch Set: Rebased Created 4 years, 5 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
Index: webrtc/video/send_statistics_proxy.cc
diff --git a/webrtc/video/send_statistics_proxy.cc b/webrtc/video/send_statistics_proxy.cc
index 6815eb3d71917a852c19d5b6fc56a469a0d9d768..b074a4e0e6f8082670a9682b180f1fa042aabbb1 100644
--- a/webrtc/video/send_statistics_proxy.cc
+++ b/webrtc/video/send_statistics_proxy.cc
@@ -75,18 +75,18 @@ SendStatisticsProxy::SendStatisticsProxy(
const VideoSendStream::Config& config,
VideoEncoderConfig::ContentType content_type)
: clock_(clock),
- config_(config),
+ rtp_config_(config.rtp),
content_type_(content_type),
last_sent_frame_timestamp_(0),
encode_time_(kEncodeTimeWeigthFactor),
uma_container_(
new UmaSamplesContainer(GetUmaPrefix(content_type_), stats_, clock)) {
- UpdateCodecTypeHistogram(config_.encoder_settings.payload_name);
+ UpdateCodecTypeHistogram(config.encoder_settings.payload_name);
}
SendStatisticsProxy::~SendStatisticsProxy() {
rtc::CritScope lock(&crit_);
- uma_container_->UpdateHistograms(config_, stats_);
+ uma_container_->UpdateHistograms(rtp_config_, stats_);
}
SendStatisticsProxy::UmaSamplesContainer::UmaSamplesContainer(
@@ -106,11 +106,11 @@ SendStatisticsProxy::UmaSamplesContainer::UmaSamplesContainer(
SendStatisticsProxy::UmaSamplesContainer::~UmaSamplesContainer() {}
void AccumulateRtpStats(const VideoSendStream::Stats& stats,
- const VideoSendStream::Config& config,
+ const VideoSendStream::Config::Rtp& rtp_config,
stefan-webrtc 2016/07/08 15:56:41 Should this be changed to "const std::vector<uint3
perkj_webrtc 2016/07/11 11:41:07 Done.
StreamDataCounters* total_rtp_stats,
StreamDataCounters* rtx_stats) {
+ const std::vector<uint32_t>& rtx_ssrcs = rtp_config.rtx.ssrcs;
for (auto it : stats.substreams) {
- const std::vector<uint32_t> rtx_ssrcs = config.rtp.rtx.ssrcs;
if (std::find(rtx_ssrcs.begin(), rtx_ssrcs.end(), it.first) !=
rtx_ssrcs.end()) {
rtx_stats->Add(it.second.rtp_stats);
@@ -121,7 +121,7 @@ void AccumulateRtpStats(const VideoSendStream::Stats& stats,
}
void SendStatisticsProxy::UmaSamplesContainer::UpdateHistograms(
- const VideoSendStream::Config& config,
+ const VideoSendStream::Config::Rtp& rtp_config,
const VideoSendStream::Stats& current_stats) {
RTC_DCHECK(uma_prefix_ == kRealtimePrefix || uma_prefix_ == kScreenPrefix);
const int kIndex = uma_prefix_ == kScreenPrefix ? 1 : 0;
@@ -255,7 +255,7 @@ void SendStatisticsProxy::UmaSamplesContainer::UpdateHistograms(
// UmaSamplesContainer, we save the initial state of the counters, so that
// we can calculate the delta here and aggregate over all ssrcs.
RtcpPacketTypeCounter counters;
- for (uint32_t ssrc : config.rtp.ssrcs) {
+ for (uint32_t ssrc : rtp_config.ssrcs) {
auto kv = current_stats.substreams.find(ssrc);
if (kv == current_stats.substreams.end())
continue;
@@ -291,10 +291,10 @@ void SendStatisticsProxy::UmaSamplesContainer::UpdateHistograms(
if (elapsed_sec >= metrics::kMinRunTimeInSeconds) {
StreamDataCounters rtp;
StreamDataCounters rtx;
- AccumulateRtpStats(current_stats, config, &rtp, &rtx);
+ AccumulateRtpStats(current_stats, rtp_config, &rtp, &rtx);
StreamDataCounters start_rtp;
StreamDataCounters start_rtx;
- AccumulateRtpStats(start_stats_, config, &start_rtp, &start_rtx);
+ AccumulateRtpStats(start_stats_, rtp_config, &start_rtp, &start_rtx);
rtp.Subtract(start_rtp);
rtx.Subtract(start_rtx);
StreamDataCounters rtp_rtx = rtp;
@@ -315,13 +315,13 @@ void SendStatisticsProxy::UmaSamplesContainer::UpdateHistograms(
kIndex, uma_prefix_ + "RetransmittedBitrateSentInKbps",
static_cast<int>(rtp_rtx.retransmitted.TotalBytes() * 8 /
elapsed_sec / 1000));
- if (!config.rtp.rtx.ssrcs.empty()) {
+ if (!rtp_config.rtx.ssrcs.empty()) {
RTC_LOGGED_HISTOGRAMS_COUNTS_10000(
kIndex, uma_prefix_ + "RtxBitrateSentInKbps",
static_cast<int>(rtx.transmitted.TotalBytes() * 8 / elapsed_sec /
1000));
}
- if (config.rtp.fec.red_payload_type != -1) {
+ if (rtp_config.fec.red_payload_type != -1) {
RTC_LOGGED_HISTOGRAMS_COUNTS_10000(
kIndex, uma_prefix_ + "FecBitrateSentInKbps",
static_cast<int>(rtp_rtx.fec.TotalBytes() * 8 / elapsed_sec /
@@ -335,7 +335,7 @@ void SendStatisticsProxy::SetContentType(
VideoEncoderConfig::ContentType content_type) {
rtc::CritScope lock(&crit_);
if (content_type_ != content_type) {
- uma_container_->UpdateHistograms(config_, stats_);
+ uma_container_->UpdateHistograms(rtp_config_, stats_);
uma_container_.reset(
new UmaSamplesContainer(GetUmaPrefix(content_type), stats_, clock_));
content_type_ = content_type;
@@ -395,11 +395,10 @@ VideoSendStream::StreamStats* SendStatisticsProxy::GetStatsEntry(
if (it != stats_.substreams.end())
return &it->second;
- if (std::find(config_.rtp.ssrcs.begin(), config_.rtp.ssrcs.end(), ssrc) ==
- config_.rtp.ssrcs.end() &&
- std::find(config_.rtp.rtx.ssrcs.begin(),
- config_.rtp.rtx.ssrcs.end(),
- ssrc) == config_.rtp.rtx.ssrcs.end()) {
+ if (std::find(rtp_config_.ssrcs.begin(), rtp_config_.ssrcs.end(), ssrc) ==
+ rtp_config_.ssrcs.end() &&
+ std::find(rtp_config_.rtx.ssrcs.begin(), rtp_config_.rtx.ssrcs.end(),
+ ssrc) == rtp_config_.rtx.ssrcs.end()) {
return nullptr;
}
@@ -436,12 +435,12 @@ void SendStatisticsProxy::OnSendEncodedImage(
}
}
- if (simulcast_idx >= config_.rtp.ssrcs.size()) {
+ if (simulcast_idx >= rtp_config_.ssrcs.size()) {
LOG(LS_ERROR) << "Encoded image outside simulcast range (" << simulcast_idx
- << " >= " << config_.rtp.ssrcs.size() << ").";
+ << " >= " << rtp_config_.ssrcs.size() << ").";
return;
}
- uint32_t ssrc = config_.rtp.ssrcs[simulcast_idx];
+ uint32_t ssrc = rtp_config_.ssrcs[simulcast_idx];
rtc::CritScope lock(&crit_);
VideoSendStream::StreamStats* stats = GetStatsEntry(ssrc);
@@ -479,7 +478,7 @@ void SendStatisticsProxy::OnSendEncodedImage(
if (encoded_image.qp_ != -1 && codec_info) {
if (codec_info->codecType == kVideoCodecVP8) {
- int spatial_idx = (config_.rtp.ssrcs.size() == 1)
+ int spatial_idx = (rtp_config_.ssrcs.size() == 1)
? -1
: static_cast<int>(simulcast_idx);
uma_container_->qp_counters_[spatial_idx].vp8.Add(encoded_image.qp_);

Powered by Google App Engine
This is Rietveld 408576698