From 89cc7d43e66e2229d3261fe46996674730e9df91 Mon Sep 17 00:00:00 2001 From: Artem Titov Date: Tue, 26 Mar 2019 11:32:57 +0100 Subject: [PATCH] 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 Commit-Queue: Artem Titov Cr-Commit-Position: refs/heads/master@{#27286} --- .../video/default_video_quality_analyzer.cc | 31 ++++++++++++++++++- .../video/default_video_quality_analyzer.h | 2 +- test/pc/e2e/peer_connection_e2e_smoke_test.cc | 15 --------- 3 files changed, 31 insertions(+), 17 deletions(-) diff --git a/test/pc/e2e/analyzer/video/default_video_quality_analyzer.cc b/test/pc/e2e/analyzer/video/default_video_quality_analyzer.cc index 579e1c04f4..7ad7b547e4 100644 --- a/test/pc/e2e/analyzer/video/default_video_quality_analyzer.cc +++ b/test/pc/e2e/analyzer/video/default_video_quality_analyzer.cc @@ -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, diff --git a/test/pc/e2e/analyzer/video/default_video_quality_analyzer.h b/test/pc/e2e/analyzer/video/default_video_quality_analyzer.h index d12c64dcaf..b8d186d79b 100644 --- a/test/pc/e2e/analyzer/video/default_video_quality_analyzer.h +++ b/test/pc/e2e/analyzer/video/default_video_quality_analyzer.h @@ -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); diff --git a/test/pc/e2e/peer_connection_e2e_smoke_test.cc b/test/pc/e2e/peer_connection_e2e_smoke_test.cc index 8f570edb77..75eb47217f 100644 --- a/test/pc/e2e/peer_connection_e2e_smoke_test.cc +++ b/test/pc/e2e/peer_connection_e2e_smoke_test.cc @@ -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