From 61684fc814fdca9fca6ddd9e766a1144751c25a7 Mon Sep 17 00:00:00 2001 From: Artem Titov Date: Thu, 13 Apr 2023 11:39:05 +0200 Subject: [PATCH] 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 Reviewed-by: Mirko Bonadei Cr-Commit-Position: refs/heads/main@{#39846} --- test/BUILD.gn | 15 +++++ test/create_frame_generator_capturer.h | 65 ++++++++++++++++++++++ test/peer_scenario/BUILD.gn | 1 + test/peer_scenario/peer_scenario_client.cc | 5 +- 4 files changed, 84 insertions(+), 2 deletions(-) create mode 100644 test/create_frame_generator_capturer.h diff --git a/test/BUILD.gn b/test/BUILD.gn index b1f1b98b2a..aa418b462e 100644 --- a/test/BUILD.gn +++ b/test/BUILD.gn @@ -126,6 +126,20 @@ rtc_library("test_video_capturer") { ] } +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 @@ rtc_library("video_test_common") { ] 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 0000000000..22039edf8c --- /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 +#include +#include + +#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 CreateFrameGeneratorCapturer( + Clock* clock, + TaskQueueFactory& task_queue_factory, + FrameGeneratorCapturerConfig::SquaresVideo config) { + return FrameGeneratorCapturer::Create(clock, task_queue_factory, config); +} + +std::unique_ptr CreateFrameGeneratorCapturer( + Clock* clock, + TaskQueueFactory& task_queue_factory, + FrameGeneratorCapturerConfig::SquareSlides config) { + return FrameGeneratorCapturer::Create(clock, task_queue_factory, config); +} + +std::unique_ptr CreateFrameGeneratorCapturer( + Clock* clock, + TaskQueueFactory& task_queue_factory, + FrameGeneratorCapturerConfig::VideoFile config) { + return FrameGeneratorCapturer::Create(clock, task_queue_factory, config); +} + +std::unique_ptr CreateFrameGeneratorCapturer( + Clock* clock, + TaskQueueFactory& task_queue_factory, + FrameGeneratorCapturerConfig::ImageSlides config) { + return FrameGeneratorCapturer::Create(clock, task_queue_factory, config); +} + +std::unique_ptr 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 93bed3ec59..bd7c02ad9e 100644 --- a/test/peer_scenario/BUILD.gn +++ b/test/peer_scenario/BUILD.gn @@ -22,6 +22,7 @@ if (rtc_include_tests) { "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 15c2321bcd..3947dbd877 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 @@ PeerScenarioClient::VideoSendTrack PeerScenarioClient::CreateVideo( 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(