Add calculation of actual encode bitrate into DefaultVideoQualityAnalyzer

Bug: webrtc:11381
Change-Id: Ic636412fef5e4134f47974fe24a24d8c7636bcdd
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/171107
Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org>
Commit-Queue: Artem Titov <titovartem@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30860}
This commit is contained in:
Artem Titov 2020-03-20 15:22:42 +01:00 committed by Commit Bot
parent 06a4dd6209
commit ea6ae4a323
4 changed files with 11 additions and 10 deletions

View File

@ -192,6 +192,7 @@ void DefaultVideoQualityAnalyzer::OnFrameEncoded(
stream_frame_counters_[it->second.stream_label].encoded++;
}
it->second.encoded_time = Now();
it->second.encoded_image_size = encoded_image.size();
}
void DefaultVideoQualityAnalyzer::OnFrameDropped(
@ -515,6 +516,7 @@ void DefaultVideoQualityAnalyzer::ProcessComparison(
stats->encode_time_ms.AddSample(
(frame_stats.encoded_time - frame_stats.pre_encode_time).ms());
stats->encode_frame_rate.AddEvent(frame_stats.encoded_time);
stats->total_encoded_images_payload += frame_stats.encoded_image_size;
} else {
if (frame_stats.pre_encode_time.IsFinite()) {
stats->dropped_by_encoder++;
@ -590,6 +592,7 @@ void DefaultVideoQualityAnalyzer::ReportResults(
const StreamStats& stats,
const FrameCounters& frame_counters) {
using ::webrtc::test::ImproveDirection;
TimeDelta test_duration = Now() - start_time_;
double sum_squared_interframe_delays_secs = 0;
Timestamp video_start_time = Timestamp::PlusInfinity();
@ -667,6 +670,11 @@ void DefaultVideoQualityAnalyzer::ReportResults(
/*important=*/false, ImproveDirection::kSmallerIsBetter);
ReportResult("max_skipped", test_case_name, stats.skipped_between_rendered,
"count", ImproveDirection::kSmallerIsBetter);
test::PrintResult(
"actual_encode_bitrate", "", test_case_name,
static_cast<double>(stats.total_encoded_images_payload) /
static_cast<double>(test_duration.us()) * kMicrosPerSecond,
"bytesPerSecond", /*important=*/false, ImproveDirection::kNone);
}
void DefaultVideoQualityAnalyzer::ReportResult(

View File

@ -102,6 +102,7 @@ struct StreamStats {
SamplesStatsCounter time_between_freezes_ms;
SamplesStatsCounter resolution_of_rendered_frame;
int64_t total_encoded_images_payload = 0;
int64_t dropped_by_encoder = 0;
int64_t dropped_before_encoder = 0;
};
@ -182,6 +183,8 @@ class DefaultVideoQualityAnalyzer : public VideoQualityAnalyzerInterface {
absl::optional<int> rendered_frame_width = absl::nullopt;
absl::optional<int> rendered_frame_height = absl::nullopt;
int64_t encoded_image_size = 0;
};
// Describes why comparison was done in overloaded mode (without calculating

View File

@ -42,16 +42,12 @@ void VideoQualityMetricsReporter::OnStatsReports(
const webrtc::StatsReport::Value* transmission_bitrate =
stats_report->FindValue(
StatsReport::StatsValueName::kStatsValueNameTransmitBitrate);
const webrtc::StatsReport::Value* actual_encode_bitrate =
stats_report->FindValue(
StatsReport::StatsValueName::kStatsValueNameActualEncBitrate);
const webrtc::StatsReport::Value* target_encode_bitrate =
stats_report->FindValue(
StatsReport::StatsValueName::kStatsValueNameTargetEncBitrate);
RTC_CHECK(available_send_bandwidth);
RTC_CHECK(retransmission_bitrate);
RTC_CHECK(transmission_bitrate);
RTC_CHECK(actual_encode_bitrate);
RTC_CHECK(target_encode_bitrate);
rtc::CritScope crit(&video_bwe_stats_lock_);
@ -62,8 +58,6 @@ void VideoQualityMetricsReporter::OnStatsReports(
transmission_bitrate->int_val());
video_bwe_stats.retransmission_bitrate.AddSample(
retransmission_bitrate->int_val());
video_bwe_stats.actual_encode_bitrate.AddSample(
actual_encode_bitrate->int_val());
video_bwe_stats.target_encode_bitrate.AddSample(
target_encode_bitrate->int_val());
}
@ -93,9 +87,6 @@ void VideoQualityMetricsReporter::ReportVideoBweResults(
ReportResult("retransmission_bitrate", test_case_name,
video_bwe_stats.retransmission_bitrate / kBitsInByte,
"bytesPerSecond");
ReportResult("actual_encode_bitrate", test_case_name,
video_bwe_stats.actual_encode_bitrate / kBitsInByte,
"bytesPerSecond");
ReportResult("target_encode_bitrate", test_case_name,
video_bwe_stats.target_encode_bitrate / kBitsInByte,
"bytesPerSecond");

View File

@ -26,7 +26,6 @@ struct VideoBweStats {
SamplesStatsCounter available_send_bandwidth;
SamplesStatsCounter transmission_bitrate;
SamplesStatsCounter retransmission_bitrate;
SamplesStatsCounter actual_encode_bitrate;
SamplesStatsCounter target_encode_bitrate;
};