Add logging of internal stats into default video quality analyzer

Bug: webrtc:10138
Change-Id: I2ce0837baee4719bb571a989a850003e6521cfca
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/128874
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Artem Titov <titovartem@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#27286}
This commit is contained in:
Artem Titov 2019-03-26 11:32:57 +01:00 committed by Commit Bot
parent 76ba7dbc4f
commit 89cc7d43e6
3 changed files with 31 additions and 17 deletions

View File

@ -27,6 +27,22 @@ constexpr int kMaxActiveComparisons = 10;
constexpr int kFreezeThresholdMs = 150;
constexpr int kMicrosPerSecond = 1000000;
void LogFrameCounters(const std::string& name, const FrameCounters& counters) {
RTC_LOG(INFO) << "[" << name << "] Captured : " << counters.captured;
RTC_LOG(INFO) << "[" << name << "] Pre encoded : " << counters.pre_encoded;
RTC_LOG(INFO) << "[" << name << "] Encoded : " << counters.encoded;
RTC_LOG(INFO) << "[" << name << "] Received : " << counters.received;
RTC_LOG(INFO) << "[" << name << "] Rendered : " << counters.rendered;
RTC_LOG(INFO) << "[" << name << "] Dropped : " << counters.dropped;
}
void LogStreamInternalStats(const std::string& name, const StreamStats& stats) {
RTC_LOG(INFO) << "[" << name
<< "] Dropped by encoder : " << stats.dropped_by_encoder;
RTC_LOG(INFO) << "[" << name << "] Dropped before encoder : "
<< stats.dropped_before_encoder;
}
} // namespace
void RateCounter::AddEvent(Timestamp event_time) {
@ -464,13 +480,26 @@ void DefaultVideoQualityAnalyzer::ProcessComparison(
}
}
void DefaultVideoQualityAnalyzer::ReportResults() const {
void DefaultVideoQualityAnalyzer::ReportResults() {
rtc::CritScope crit1(&lock_);
rtc::CritScope crit2(&comparison_lock_);
for (auto& item : stream_stats_) {
ReportResults(GetTestCaseName(item.first), item.second,
stream_frame_counters_.at(item.first));
}
LogFrameCounters("Global", frame_counters_);
for (auto& item : stream_stats_) {
LogFrameCounters(item.first, stream_frame_counters_.at(item.first));
LogStreamInternalStats(item.first, item.second);
}
RTC_LOG(INFO) << "comparisons_queue_size min="
<< analyzer_stats_.comparisons_queue_size.GetMin()
<< "; max=" << analyzer_stats_.comparisons_queue_size.GetMax()
<< "; 99%="
<< analyzer_stats_.comparisons_queue_size.GetPercentile(0.99);
RTC_LOG(INFO) << "comparisons_done=" << analyzer_stats_.comparisons_done;
RTC_LOG(INFO) << "overloaded_comparisons_done="
<< analyzer_stats_.overloaded_comparisons_done;
}
void DefaultVideoQualityAnalyzer::ReportResults(std::string test_case_name,

View File

@ -231,7 +231,7 @@ class DefaultVideoQualityAnalyzer : public VideoQualityAnalyzerInterface {
void ProcessComparisons();
void ProcessComparison(const FrameComparison& comparison);
// Report results for all metrics for all streams.
void ReportResults() const;
void ReportResults();
static void ReportResults(std::string test_case_name,
StreamStats stats,
FrameCounters frame_counters);

View File

@ -24,19 +24,6 @@
namespace webrtc {
namespace webrtc_pc_e2e {
namespace {
void PrintFrameCounters(const std::string& name,
const FrameCounters& counters) {
RTC_LOG(INFO) << "[" << name << "] Captured : " << counters.captured;
RTC_LOG(INFO) << "[" << name << "] Pre encoded : " << counters.pre_encoded;
RTC_LOG(INFO) << "[" << name << "] Encoded : " << counters.encoded;
RTC_LOG(INFO) << "[" << name << "] Received : " << counters.received;
RTC_LOG(INFO) << "[" << name << "] Rendered : " << counters.rendered;
RTC_LOG(INFO) << "[" << name << "] Dropped : " << counters.dropped;
}
} // namespace
TEST(PeerConnectionE2EQualityTestSmokeTest, RunWithEmulatedNetwork) {
using PeerConfigurer = PeerConnectionE2EQualityTestFixture::PeerConfigurer;
@ -110,11 +97,9 @@ TEST(PeerConnectionE2EQualityTestSmokeTest, RunWithEmulatedNetwork) {
fixture->Run(RunParams{TimeDelta::seconds(5)});
PrintFrameCounters("Global", video_analyzer_ptr->GetGlobalCounters());
for (auto stream_label : video_analyzer_ptr->GetKnownVideoStreams()) {
FrameCounters stream_conters =
video_analyzer_ptr->GetPerStreamCounters().at(stream_label);
PrintFrameCounters(stream_label, stream_conters);
// 150 = 30fps * 5s. On some devices pipeline can be too slow, so it can
// happen, that frames will stuck in the middle, so we actually can't force
// real constraints here, so lets just check, that at least 1 frame passed