Allow injection of TaskQueueFactory in FrameGeneratorCapturer.

Bug: webrtc:10365
Change-Id: I7ea496f479a948c17c40c0da572656eb926811ae
Reviewed-on: https://webrtc-review.googlesource.com/c/124985
Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org>
Commit-Queue: Sebastian Jansson <srte@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26907}
This commit is contained in:
Sebastian Jansson 2019-02-28 13:30:04 +01:00 committed by Commit Bot
parent b8a4d688f9
commit fb14c5d8b9
3 changed files with 21 additions and 1 deletions

View File

@ -63,6 +63,8 @@ rtc_source_set("video_test_common") {
"..:webrtc_common",
"../api:libjingle_peerconnection_api",
"../api:scoped_refptr",
"../api/task_queue",
"../api/task_queue:global_task_queue_factory",
"../api/video:video_frame",
"../api/video:video_frame_i010",
"../api/video:video_frame_i420",

View File

@ -17,6 +17,7 @@
#include <vector>
#include "absl/memory/memory.h"
#include "api/task_queue/global_task_queue_factory.h"
#include "rtc_base/checks.h"
#include "rtc_base/critical_section.h"
#include "rtc_base/logging.h"
@ -94,6 +95,16 @@ FrameGeneratorCapturer::FrameGeneratorCapturer(
Clock* clock,
std::unique_ptr<FrameGenerator> frame_generator,
int target_fps)
: FrameGeneratorCapturer(clock,
std::move(frame_generator),
target_fps,
GlobalTaskQueueFactory()) {}
FrameGeneratorCapturer::FrameGeneratorCapturer(
Clock* clock,
std::unique_ptr<FrameGenerator> frame_generator,
int target_fps,
TaskQueueFactory& task_queue_factory)
: clock_(clock),
sending_(true),
sink_wants_observer_(nullptr),
@ -101,7 +112,9 @@ FrameGeneratorCapturer::FrameGeneratorCapturer(
source_fps_(target_fps),
target_capture_fps_(target_fps),
first_frame_capture_time_(-1),
task_queue_("FrameGenCapQ", rtc::TaskQueue::Priority::HIGH) {
task_queue_(task_queue_factory.CreateTaskQueue(
"FrameGenCapQ",
TaskQueueFactory::Priority::HIGH)) {
RTC_DCHECK(frame_generator_);
RTC_DCHECK_GT(target_fps, 0);
}

View File

@ -13,6 +13,7 @@
#include <memory>
#include <string>
#include "api/task_queue/task_queue_factory.h"
#include "api/video/video_frame.h"
#include "rtc_base/critical_section.h"
#include "rtc_base/task_queue.h"
@ -87,6 +88,10 @@ class FrameGeneratorCapturer : public TestVideoCapturer {
FrameGeneratorCapturer(Clock* clock,
std::unique_ptr<FrameGenerator> frame_generator,
int target_fps);
FrameGeneratorCapturer(Clock* clock,
std::unique_ptr<FrameGenerator> frame_generator,
int target_fps,
TaskQueueFactory& task_queue_factory);
bool Init();
private: