Start splitting frame_generator_capturer to extract Create set of functions
Bug: b/272350185
Change-Id: Id95d4f6264417595f292d2edcacc71bca93e2bd6
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/301102
Commit-Queue: Artem Titov <titovartem@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#39846}
diff --git a/test/BUILD.gn b/test/BUILD.gn
index b1f1b98..aa418b4 100644
--- a/test/BUILD.gn
+++ b/test/BUILD.gn
@@ -126,6 +126,20 @@
]
}
+rtc_library("create_frame_generator_capturer") {
+ visibility = [ "*" ]
+ testonly = true
+ sources = [ "create_frame_generator_capturer.h" ]
+ deps = [
+ ":frame_generator_capturer",
+ "../api:frame_generator_api",
+ "../api/task_queue",
+ "../api/units:time_delta",
+ "../system_wrappers",
+ ]
+ absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
+}
+
rtc_library("frame_generator_capturer") {
visibility = [ "*" ]
testonly = true
@@ -169,6 +183,7 @@
]
deps = [
+ ":create_frame_generator_capturer",
":fileutils",
":frame_utils",
":scoped_key_value_config",
diff --git a/test/create_frame_generator_capturer.h b/test/create_frame_generator_capturer.h
new file mode 100644
index 0000000..22039ed
--- /dev/null
+++ b/test/create_frame_generator_capturer.h
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2023 The WebRTC project authors. All Rights Reserved.
+ *
+ * Use of this source code is governed by a BSD-style license
+ * that can be found in the LICENSE file in the root of the source
+ * tree. An additional intellectual property rights grant can be found
+ * in the file PATENTS. All contributing project authors may
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+#ifndef TEST_CREATE_FRAME_GENERATOR_CAPTURER_H_
+#define TEST_CREATE_FRAME_GENERATOR_CAPTURER_H_
+
+#include <memory>
+#include <string>
+#include <vector>
+
+#include "absl/types/optional.h"
+#include "api/task_queue/task_queue_factory.h"
+#include "api/test/frame_generator_interface.h"
+#include "api/units/time_delta.h"
+#include "system_wrappers/include/clock.h"
+#include "test/frame_generator_capturer.h"
+
+namespace webrtc {
+namespace test {
+
+std::unique_ptr<FrameGeneratorCapturer> CreateFrameGeneratorCapturer(
+ Clock* clock,
+ TaskQueueFactory& task_queue_factory,
+ FrameGeneratorCapturerConfig::SquaresVideo config) {
+ return FrameGeneratorCapturer::Create(clock, task_queue_factory, config);
+}
+
+std::unique_ptr<FrameGeneratorCapturer> CreateFrameGeneratorCapturer(
+ Clock* clock,
+ TaskQueueFactory& task_queue_factory,
+ FrameGeneratorCapturerConfig::SquareSlides config) {
+ return FrameGeneratorCapturer::Create(clock, task_queue_factory, config);
+}
+
+std::unique_ptr<FrameGeneratorCapturer> CreateFrameGeneratorCapturer(
+ Clock* clock,
+ TaskQueueFactory& task_queue_factory,
+ FrameGeneratorCapturerConfig::VideoFile config) {
+ return FrameGeneratorCapturer::Create(clock, task_queue_factory, config);
+}
+
+std::unique_ptr<FrameGeneratorCapturer> CreateFrameGeneratorCapturer(
+ Clock* clock,
+ TaskQueueFactory& task_queue_factory,
+ FrameGeneratorCapturerConfig::ImageSlides config) {
+ return FrameGeneratorCapturer::Create(clock, task_queue_factory, config);
+}
+
+std::unique_ptr<FrameGeneratorCapturer> CreateFrameGeneratorCapturer(
+ Clock* clock,
+ TaskQueueFactory& task_queue_factory,
+ const FrameGeneratorCapturerConfig& config) {
+ return FrameGeneratorCapturer::Create(clock, task_queue_factory, config);
+}
+
+} // namespace test
+} // namespace webrtc
+
+#endif // TEST_CREATE_FRAME_GENERATOR_CAPTURER_H_
diff --git a/test/peer_scenario/BUILD.gn b/test/peer_scenario/BUILD.gn
index 93bed3e..bd7c02a 100644
--- a/test/peer_scenario/BUILD.gn
+++ b/test/peer_scenario/BUILD.gn
@@ -22,6 +22,7 @@
"signaling_route.h",
]
deps = [
+ "..:create_frame_generator_capturer",
"..:fake_video_codecs",
"..:fileutils",
"..:frame_generator_capturer",
diff --git a/test/peer_scenario/peer_scenario_client.cc b/test/peer_scenario/peer_scenario_client.cc
index 15c2321..3947dbd 100644
--- a/test/peer_scenario/peer_scenario_client.cc
+++ b/test/peer_scenario/peer_scenario_client.cc
@@ -33,6 +33,7 @@
#include "media/engine/webrtc_media_engine.h"
#include "modules/audio_device/include/test_audio_device.h"
#include "p2p/client/basic_port_allocator.h"
+#include "test/create_frame_generator_capturer.h"
#include "test/fake_decoder.h"
#include "test/fake_vp8_encoder.h"
#include "test/frame_generator_capturer.h"
@@ -331,8 +332,8 @@
VideoSendTrackConfig config) {
RTC_DCHECK_RUN_ON(signaling_thread_);
VideoSendTrack res;
- auto capturer = FrameGeneratorCapturer::Create(clock(), *task_queue_factory_,
- config.generator);
+ auto capturer = CreateFrameGeneratorCapturer(clock(), *task_queue_factory_,
+ config.generator);
res.capturer = capturer.get();
capturer->Init();
res.source = rtc::make_ref_counted<FrameGeneratorCapturerVideoTrackSource>(