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}
This commit is contained in:
Artem Titov 2023-04-13 11:39:05 +02:00 committed by WebRTC LUCI CQ
parent c381c33767
commit 61684fc814
4 changed files with 84 additions and 2 deletions

View File

@ -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",

View File

@ -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_

View File

@ -22,6 +22,7 @@ if (rtc_include_tests) {
"signaling_route.h",
]
deps = [
"..:create_frame_generator_capturer",
"..:fake_video_codecs",
"..:fileutils",
"..:frame_generator_capturer",

View File

@ -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,7 +332,7 @@ PeerScenarioClient::VideoSendTrack PeerScenarioClient::CreateVideo(
VideoSendTrackConfig config) {
RTC_DCHECK_RUN_ON(signaling_thread_);
VideoSendTrack res;
auto capturer = FrameGeneratorCapturer::Create(clock(), *task_queue_factory_,
auto capturer = CreateFrameGeneratorCapturer(clock(), *task_queue_factory_,
config.generator);
res.capturer = capturer.get();
capturer->Init();