Create default frame generator in the AddVideoConfig method.

Bug: webrtc:11534
Change-Id: I5f8e6009ac48be99180574ab3ac835005f67cf58
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/174540
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Reviewed-by: Artem Titov <titovartem@webrtc.org>
Commit-Queue: Andrey Logvin <landrey@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31176}
diff --git a/api/test/peerconnection_quality_test_fixture.h b/api/test/peerconnection_quality_test_fixture.h
index a5ccc4c..64671bf 100644
--- a/api/test/peerconnection_quality_test_fixture.h
+++ b/api/test/peerconnection_quality_test_fixture.h
@@ -310,6 +310,7 @@
         std::unique_ptr<IceTransportFactory> factory) = 0;
 
     // Add new video stream to the call that will be sent from this peer.
+    // Default implementation of video frames generator will be used.
     virtual PeerConfigurer* AddVideoConfig(VideoConfig config) = 0;
     // Add new video stream to the call that will be sent from this peer with
     // provided own implementation of video frames generator.
diff --git a/test/pc/e2e/peer_configurer.cc b/test/pc/e2e/peer_configurer.cc
index b9c04e3..81f0fdb 100644
--- a/test/pc/e2e/peer_configurer.cc
+++ b/test/pc/e2e/peer_configurer.cc
@@ -12,7 +12,6 @@
 
 #include <set>
 
-#include "api/test/create_peer_connection_quality_test_frame_generator.h"
 #include "test/testsupport/file_utils.h"
 
 namespace webrtc {
diff --git a/test/pc/e2e/peer_configurer.h b/test/pc/e2e/peer_configurer.h
index bd6728a..3dd23c6 100644
--- a/test/pc/e2e/peer_configurer.h
+++ b/test/pc/e2e/peer_configurer.h
@@ -20,6 +20,7 @@
 #include "api/fec_controller.h"
 #include "api/rtc_event_log/rtc_event_log_factory_interface.h"
 #include "api/task_queue/task_queue_factory.h"
+#include "api/test/create_peer_connection_quality_test_frame_generator.h"
 #include "api/test/peerconnection_quality_test_fixture.h"
 #include "api/transport/media/media_transport_interface.h"
 #include "api/transport/network_control.h"
@@ -116,8 +117,9 @@
 
   PeerConfigurer* AddVideoConfig(
       PeerConnectionE2EQualityTestFixture::VideoConfig config) override {
+    video_generators_.push_back(
+        CreateSquareFrameGenerator(config, /*type=*/absl::nullopt));
     params_->video_configs.push_back(std::move(config));
-    video_generators_.push_back(nullptr);
     return this;
   }
   PeerConfigurer* AddVideoConfig(
diff --git a/test/pc/e2e/peer_connection_e2e_smoke_test.cc b/test/pc/e2e/peer_connection_e2e_smoke_test.cc
index 7e88b2b..c88f905 100644
--- a/test/pc/e2e/peer_connection_e2e_smoke_test.cc
+++ b/test/pc/e2e/peer_connection_e2e_smoke_test.cc
@@ -150,8 +150,7 @@
         VideoConfig video(640, 360, 30);
         video.stream_label = "alice-video";
         video.sync_group = "alice-media";
-        auto frame_generator = CreateSquareFrameGenerator(video, absl::nullopt);
-        alice->AddVideoConfig(std::move(video), std::move(frame_generator));
+        alice->AddVideoConfig(std::move(video));
 
         AudioConfig audio;
         audio.stream_label = "alice-audio";
@@ -166,8 +165,7 @@
         VideoConfig video(640, 360, 30);
         video.stream_label = "bob-video";
         video.temporal_layers_count = 2;
-        auto frame_generator = CreateSquareFrameGenerator(video, absl::nullopt);
-        bob->AddVideoConfig(std::move(video), std::move(frame_generator));
+        bob->AddVideoConfig(std::move(video));
 
         VideoConfig screenshare(640, 360, 30);
         screenshare.stream_label = "bob-screenshare";
@@ -234,9 +232,7 @@
         VideoConfig simulcast(1280, 720, 30);
         simulcast.stream_label = "alice-simulcast";
         simulcast.simulcast_config = VideoSimulcastConfig(3, 0);
-        auto frame_generator =
-            CreateSquareFrameGenerator(simulcast, absl::nullopt);
-        alice->AddVideoConfig(std::move(simulcast), std::move(frame_generator));
+        alice->AddVideoConfig(std::move(simulcast));
 
         AudioConfig audio;
         audio.stream_label = "alice-audio";
@@ -248,8 +244,7 @@
       [](PeerConfigurer* bob) {
         VideoConfig video(640, 360, 30);
         video.stream_label = "bob-video";
-        auto frame_generator = CreateSquareFrameGenerator(video, absl::nullopt);
-        bob->AddVideoConfig(std::move(video), std::move(frame_generator));
+        bob->AddVideoConfig(std::move(video));
 
         AudioConfig audio;
         audio.stream_label = "bob-audio";
@@ -277,9 +272,7 @@
         // Because we have network with packets loss we can analyze only the
         // highest spatial layer in SVC mode.
         simulcast.simulcast_config = VideoSimulcastConfig(3, 2);
-        auto frame_generator =
-            CreateSquareFrameGenerator(simulcast, absl::nullopt);
-        alice->AddVideoConfig(std::move(simulcast), std::move(frame_generator));
+        alice->AddVideoConfig(std::move(simulcast));
 
         AudioConfig audio;
         audio.stream_label = "alice-audio";
@@ -291,8 +284,7 @@
       [](PeerConfigurer* bob) {
         VideoConfig video(640, 360, 30);
         video.stream_label = "bob-video";
-        auto frame_generator = CreateSquareFrameGenerator(video, absl::nullopt);
-        bob->AddVideoConfig(std::move(video), std::move(frame_generator));
+        bob->AddVideoConfig(std::move(video));
 
         AudioConfig audio;
         audio.stream_label = "bob-audio";
@@ -325,8 +317,7 @@
         video.stream_label = "alice-video";
         video.min_encode_bitrate_bps = 500'000;
         video.max_encode_bitrate_bps = 3'000'000;
-        auto frame_generator = CreateSquareFrameGenerator(video, absl::nullopt);
-        alice->AddVideoConfig(std::move(video), std::move(frame_generator));
+        alice->AddVideoConfig(std::move(video));
 
         AudioConfig audio;
         audio.stream_label = "alice-audio";
@@ -345,8 +336,7 @@
         video.stream_label = "bob-video";
         video.min_encode_bitrate_bps = 500'000;
         video.max_encode_bitrate_bps = 3'000'000;
-        auto frame_generator = CreateSquareFrameGenerator(video, absl::nullopt);
-        bob->AddVideoConfig(std::move(video), std::move(frame_generator));
+        bob->AddVideoConfig(std::move(video));
 
         AudioConfig audio;
         audio.stream_label = "bob-audio";
diff --git a/video/pc_full_stack_tests.cc b/video/pc_full_stack_tests.cc
index d034b4e..f86ac98 100644
--- a/video/pc_full_stack_tests.cc
+++ b/video/pc_full_stack_tests.cc
@@ -1625,8 +1625,7 @@
         video.simulcast_config = VideoSimulcastConfig(3, 2);
         video.temporal_layers_count = 3;
         video.stream_label = "alice-video";
-        auto frame_generator = CreateSquareFrameGenerator(video, absl::nullopt);
-        alice->AddVideoConfig(std::move(video), std::move(frame_generator));
+        alice->AddVideoConfig(std::move(video));
       },
       [](PeerConfigurer* bob) {});
   RunParams run_params(TimeDelta::Seconds(kTestDurationSec));