Report rendered pixels statistic in full stack tests

Also, attach analyzer to the correct receive stream, instead of attaching
it only if there's one receive stream.

Bug: None
Change-Id: I34888b5bd09b61f0939d77b26cb0d10f9261d3cb
Reviewed-on: https://webrtc-review.googlesource.com/c/118688
Reviewed-by: Erik Språng <sprang@webrtc.org>
Commit-Queue: Ilya Nikolaevskiy <ilnik@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26357}
diff --git a/video/video_analyzer.cc b/video/video_analyzer.cc
index 8987a82..e29d53e 100644
--- a/video/video_analyzer.cc
+++ b/video/video_analyzer.cc
@@ -471,6 +471,9 @@
         decode_time_ms_.AddSample(receive_stats.decode_ms);
       if (receive_stats.max_decode_ms > 0)
         decode_time_max_ms_.AddSample(receive_stats.max_decode_ms);
+      if (receive_stats.width > 0 && receive_stats.height > 0) {
+        pixels_.AddSample(receive_stats.width * receive_stats.height);
+      }
     }
 
     if (audio_receive_stream_ != nullptr) {
@@ -579,6 +582,7 @@
   PrintResult("fec_bitrate", fec_bitrate_bps_, " bps");
   PrintResult("send_bandwidth", send_bandwidth_bps_, " bps");
   PrintResult("time_between_freezes", time_between_freezes_, " ms");
+  PrintResult("pixels_per_frame", pixels_, " px");
 
   if (worst_frame_) {
     test::PrintResult("min_psnr", "", test_label_.c_str(), worst_frame_->psnr,
diff --git a/video/video_analyzer.h b/video/video_analyzer.h
index 8226270..4e2abcd 100644
--- a/video/video_analyzer.h
+++ b/video/video_analyzer.h
@@ -230,6 +230,7 @@
   test::Statistics audio_expand_rate_ RTC_GUARDED_BY(comparison_lock_);
   test::Statistics audio_accelerate_rate_ RTC_GUARDED_BY(comparison_lock_);
   test::Statistics audio_jitter_buffer_ms_ RTC_GUARDED_BY(comparison_lock_);
+  test::Statistics pixels_ RTC_GUARDED_BY(comparison_lock_);
   // Rendered frame with worst PSNR is saved for further analysis.
   absl::optional<FrameWithPsnr> worst_frame_ RTC_GUARDED_BY(comparison_lock_);
 
diff --git a/video/video_quality_test.cc b/video/video_quality_test.cc
index b4dfe4c..c8b2041 100644
--- a/video/video_quality_test.cc
+++ b/video/video_quality_test.cc
@@ -1095,8 +1095,8 @@
     CreateFlexfecStreams();
     CreateVideoStreams();
     analyzer_->SetSendStream(video_send_streams_[0]);
-    if (video_receive_streams_.size() == 1)
-      analyzer_->SetReceiveStream(video_receive_streams_[0]);
+    analyzer_->SetReceiveStream(
+        video_receive_streams_[params_.ss[0].selected_stream]);
 
     GetVideoSendStream()->SetSource(analyzer_->OutputInterface(),
                                     degradation_preference_);