In video replace non-owning pointer to rtc::TaskQueue with non-owning pointer to TaskQueueBase

rtc::TaskQueue is a simple wrapper over TaskQueueBase and adds no
extra features when task queue is used without passing ownership.

Reducing usage of the internal rtc::TaskQueue wrapper gives users more flexibility how TaskQueueBase* is stored.

Bug: webrtc:14169
Change-Id: If5c8827544c843502c7dfcef775ac558de79ec3a
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/268189
Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#37549}
This commit is contained in:
Danil Chapovalov 2022-07-18 13:11:42 +02:00 committed by WebRTC LUCI CQ
parent ee3ad9f2ce
commit 03f8b8a241
34 changed files with 58 additions and 69 deletions

View file

@ -90,7 +90,6 @@ rtc_library("nack_requester") {
"../../rtc_base:logging", "../../rtc_base:logging",
"../../rtc_base:macromagic", "../../rtc_base:macromagic",
"../../rtc_base:rtc_numerics", "../../rtc_base:rtc_numerics",
"../../rtc_base:rtc_task_queue",
"../../rtc_base/experiments:field_trial_parser", "../../rtc_base/experiments:field_trial_parser",
"../../rtc_base/task_utils:repeating_task", "../../rtc_base/task_utils:repeating_task",
"../../system_wrappers", "../../system_wrappers",
@ -249,7 +248,6 @@ rtc_library("video_coding") {
"../../rtc_base:macromagic", "../../rtc_base:macromagic",
"../../rtc_base:rtc_event", "../../rtc_base:rtc_event",
"../../rtc_base:rtc_numerics", "../../rtc_base:rtc_numerics",
"../../rtc_base:rtc_task_queue",
"../../rtc_base:safe_conversions", "../../rtc_base:safe_conversions",
"../../rtc_base:threading", "../../rtc_base:threading",
"../../rtc_base:timeutils", "../../rtc_base:timeutils",
@ -439,7 +437,6 @@ rtc_library("video_coding_utility") {
"../../rtc_base:rate_statistics", "../../rtc_base:rate_statistics",
"../../rtc_base:refcount", "../../rtc_base:refcount",
"../../rtc_base:rtc_numerics", "../../rtc_base:rtc_numerics",
"../../rtc_base:rtc_task_queue",
"../../rtc_base:stringutils", "../../rtc_base:stringutils",
"../../rtc_base:timeutils", "../../rtc_base:timeutils",
"../../rtc_base:weak_ptr", "../../rtc_base:weak_ptr",
@ -868,7 +865,6 @@ if (rtc_include_tests) {
"../../rtc_base:checks", "../../rtc_base:checks",
"../../rtc_base:macromagic", "../../rtc_base:macromagic",
"../../rtc_base:rtc_event", "../../rtc_base:rtc_event",
"../../rtc_base:rtc_task_queue",
"../../rtc_base:timeutils", "../../rtc_base:timeutils",
"../../rtc_base/synchronization:mutex", "../../rtc_base/synchronization:mutex",
"../../rtc_base/system:no_unique_address", "../../rtc_base/system:no_unique_address",
@ -1153,6 +1149,7 @@ if (rtc_include_tests) {
"../../api:scoped_refptr", "../../api:scoped_refptr",
"../../api:simulcast_test_fixture_api", "../../api:simulcast_test_fixture_api",
"../../api:videocodec_test_fixture_api", "../../api:videocodec_test_fixture_api",
"../../api/task_queue",
"../../api/task_queue:default_task_queue_factory", "../../api/task_queue:default_task_queue_factory",
"../../api/test/video:function_video_factory", "../../api/test/video:function_video_factory",
"../../api/units:data_size", "../../api/units:data_size",
@ -1185,7 +1182,6 @@ if (rtc_include_tests) {
"../../rtc_base:rtc_base_tests_utils", "../../rtc_base:rtc_base_tests_utils",
"../../rtc_base:rtc_event", "../../rtc_base:rtc_event",
"../../rtc_base:rtc_numerics", "../../rtc_base:rtc_numerics",
"../../rtc_base:rtc_task_queue",
"../../rtc_base:stringutils", "../../rtc_base:stringutils",
"../../rtc_base:task_queue_for_test", "../../rtc_base:task_queue_for_test",
"../../rtc_base:timeutils", "../../rtc_base:timeutils",

View file

@ -83,7 +83,7 @@ FrameBuffer::~FrameBuffer() {
void FrameBuffer::NextFrame(int64_t max_wait_time_ms, void FrameBuffer::NextFrame(int64_t max_wait_time_ms,
bool keyframe_required, bool keyframe_required,
rtc::TaskQueue* callback_queue, TaskQueueBase* callback_queue,
NextFrameCallback handler) { NextFrameCallback handler) {
RTC_DCHECK_RUN_ON(&callback_checker_); RTC_DCHECK_RUN_ON(&callback_checker_);
RTC_DCHECK(callback_queue->IsCurrent()); RTC_DCHECK(callback_queue->IsCurrent());
@ -107,7 +107,7 @@ void FrameBuffer::StartWaitForNextFrameOnQueue() {
RTC_DCHECK(!callback_task_.Running()); RTC_DCHECK(!callback_task_.Running());
int64_t wait_ms = FindNextFrame(clock_->CurrentTime()); int64_t wait_ms = FindNextFrame(clock_->CurrentTime());
callback_task_ = RepeatingTaskHandle::DelayedStart( callback_task_ = RepeatingTaskHandle::DelayedStart(
callback_queue_->Get(), TimeDelta::Millis(wait_ms), callback_queue_, TimeDelta::Millis(wait_ms),
[this] { [this] {
RTC_DCHECK_RUN_ON(&callback_checker_); RTC_DCHECK_RUN_ON(&callback_checker_);
// If this task has not been cancelled, we did not get any new frames // If this task has not been cancelled, we did not get any new frames

View file

@ -20,6 +20,7 @@
#include "absl/container/inlined_vector.h" #include "absl/container/inlined_vector.h"
#include "api/field_trials_view.h" #include "api/field_trials_view.h"
#include "api/sequence_checker.h" #include "api/sequence_checker.h"
#include "api/task_queue/task_queue_base.h"
#include "api/video/encoded_frame.h" #include "api/video/encoded_frame.h"
#include "modules/video_coding/include/video_coding_defines.h" #include "modules/video_coding/include/video_coding_defines.h"
#include "modules/video_coding/timing/inter_frame_delay.h" #include "modules/video_coding/timing/inter_frame_delay.h"
@ -31,7 +32,6 @@
#include "rtc_base/numerics/sequence_number_util.h" #include "rtc_base/numerics/sequence_number_util.h"
#include "rtc_base/synchronization/mutex.h" #include "rtc_base/synchronization/mutex.h"
#include "rtc_base/system/no_unique_address.h" #include "rtc_base/system/no_unique_address.h"
#include "rtc_base/task_queue.h"
#include "rtc_base/task_utils/repeating_task.h" #include "rtc_base/task_utils/repeating_task.h"
#include "rtc_base/thread_annotations.h" #include "rtc_base/thread_annotations.h"
@ -66,7 +66,7 @@ class FrameBuffer {
// or with nullptr if no frame is ready for decoding after `max_wait_time_ms`. // or with nullptr if no frame is ready for decoding after `max_wait_time_ms`.
void NextFrame(int64_t max_wait_time_ms, void NextFrame(int64_t max_wait_time_ms,
bool keyframe_required, bool keyframe_required,
rtc::TaskQueue* callback_queue, TaskQueueBase* callback_queue,
NextFrameCallback handler); NextFrameCallback handler);
// Tells the FrameBuffer which protection mode that is in use. Affects // Tells the FrameBuffer which protection mode that is in use. Affects
@ -166,7 +166,7 @@ class FrameBuffer {
Mutex mutex_; Mutex mutex_;
Clock* const clock_; Clock* const clock_;
rtc::TaskQueue* callback_queue_ RTC_GUARDED_BY(mutex_); TaskQueueBase* callback_queue_ RTC_GUARDED_BY(mutex_);
RepeatingTaskHandle callback_task_ RTC_GUARDED_BY(mutex_); RepeatingTaskHandle callback_task_ RTC_GUARDED_BY(mutex_);
NextFrameCallback frame_handler_ RTC_GUARDED_BY(mutex_); NextFrameCallback frame_handler_ RTC_GUARDED_BY(mutex_);
int64_t latest_return_time_ms_ RTC_GUARDED_BY(mutex_); int64_t latest_return_time_ms_ RTC_GUARDED_BY(mutex_);

View file

@ -16,6 +16,7 @@
#include <memory> #include <memory>
#include <vector> #include <vector>
#include "api/task_queue/task_queue_base.h"
#include "api/units/time_delta.h" #include "api/units/time_delta.h"
#include "api/units/timestamp.h" #include "api/units/timestamp.h"
#include "modules/video_coding/frame_object.h" #include "modules/video_coding/frame_object.h"
@ -185,8 +186,9 @@ class TestFrameBuffer2 : public ::testing::Test {
} }
void ExtractFrame(int64_t max_wait_time = 0, bool keyframe_required = false) { void ExtractFrame(int64_t max_wait_time = 0, bool keyframe_required = false) {
time_task_queue_.PostTask([this, max_wait_time, keyframe_required]() { time_task_queue_->PostTask([this, max_wait_time, keyframe_required]() {
buffer_->NextFrame(max_wait_time, keyframe_required, &time_task_queue_, buffer_->NextFrame(max_wait_time, keyframe_required,
time_task_queue_.get(),
[this](std::unique_ptr<EncodedFrame> frame) { [this](std::unique_ptr<EncodedFrame> frame) {
frames_.emplace_back(std::move(frame)); frames_.emplace_back(std::move(frame));
}); });
@ -218,7 +220,7 @@ class TestFrameBuffer2 : public ::testing::Test {
test::ScopedKeyValueConfig field_trials_; test::ScopedKeyValueConfig field_trials_;
webrtc::GlobalSimulatedTimeController time_controller_; webrtc::GlobalSimulatedTimeController time_controller_;
rtc::TaskQueue time_task_queue_; std::unique_ptr<TaskQueueBase, TaskQueueDeleter> time_task_queue_;
VCMTimingFake timing_; VCMTimingFake timing_;
std::unique_ptr<FrameBuffer> buffer_; std::unique_ptr<FrameBuffer> buffer_;
std::vector<std::unique_ptr<EncodedFrame>> frames_; std::vector<std::unique_ptr<EncodedFrame>> frames_;

View file

@ -19,7 +19,6 @@
#include "rtc_base/checks.h" #include "rtc_base/checks.h"
#include "rtc_base/experiments/field_trial_parser.h" #include "rtc_base/experiments/field_trial_parser.h"
#include "rtc_base/logging.h" #include "rtc_base/logging.h"
#include "rtc_base/task_queue.h"
namespace webrtc { namespace webrtc {

View file

@ -20,12 +20,12 @@
#include "api/field_trials_view.h" #include "api/field_trials_view.h"
#include "api/sequence_checker.h" #include "api/sequence_checker.h"
#include "api/task_queue/pending_task_safety_flag.h" #include "api/task_queue/pending_task_safety_flag.h"
#include "api/task_queue/task_queue_base.h"
#include "api/units/time_delta.h" #include "api/units/time_delta.h"
#include "api/units/timestamp.h" #include "api/units/timestamp.h"
#include "modules/include/module_common_types.h" #include "modules/include/module_common_types.h"
#include "modules/video_coding/histogram.h" #include "modules/video_coding/histogram.h"
#include "rtc_base/numerics/sequence_number_util.h" #include "rtc_base/numerics/sequence_number_util.h"
#include "rtc_base/task_queue.h"
#include "rtc_base/task_utils/repeating_task.h" #include "rtc_base/task_utils/repeating_task.h"
#include "rtc_base/thread_annotations.h" #include "rtc_base/thread_annotations.h"
#include "system_wrappers/include/clock.h" #include "system_wrappers/include/clock.h"

View file

@ -21,7 +21,6 @@
#include "rtc_base/experiments/bandwidth_quality_scaler_settings.h" #include "rtc_base/experiments/bandwidth_quality_scaler_settings.h"
#include "rtc_base/logging.h" #include "rtc_base/logging.h"
#include "rtc_base/numerics/exp_filter.h" #include "rtc_base/numerics/exp_filter.h"
#include "rtc_base/task_queue.h"
#include "rtc_base/time_utils.h" #include "rtc_base/time_utils.h"
#include "rtc_base/weak_ptr.h" #include "rtc_base/weak_ptr.h"

View file

@ -27,7 +27,6 @@
#include "rtc_base/rate_statistics.h" #include "rtc_base/rate_statistics.h"
#include "rtc_base/ref_count.h" #include "rtc_base/ref_count.h"
#include "rtc_base/system/no_unique_address.h" #include "rtc_base/system/no_unique_address.h"
#include "rtc_base/task_queue.h"
#include "rtc_base/weak_ptr.h" #include "rtc_base/weak_ptr.h"
namespace webrtc { namespace webrtc {

View file

@ -19,7 +19,6 @@
#include "rtc_base/experiments/quality_scaler_settings.h" #include "rtc_base/experiments/quality_scaler_settings.h"
#include "rtc_base/logging.h" #include "rtc_base/logging.h"
#include "rtc_base/numerics/exp_filter.h" #include "rtc_base/numerics/exp_filter.h"
#include "rtc_base/task_queue.h"
#include "rtc_base/weak_ptr.h" #include "rtc_base/weak_ptr.h"
// TODO(kthelgason): Some versions of Android have issues with log2. // TODO(kthelgason): Some versions of Android have issues with log2.

View file

@ -24,7 +24,6 @@
#include "rtc_base/numerics/moving_average.h" #include "rtc_base/numerics/moving_average.h"
#include "rtc_base/ref_count.h" #include "rtc_base/ref_count.h"
#include "rtc_base/system/no_unique_address.h" #include "rtc_base/system/no_unique_address.h"
#include "rtc_base/task_queue.h"
namespace webrtc { namespace webrtc {

View file

@ -620,6 +620,7 @@ webrtc_fuzzer_test("rtp_frame_reference_finder_fuzzer") {
webrtc_fuzzer_test("frame_buffer2_fuzzer") { webrtc_fuzzer_test("frame_buffer2_fuzzer") {
sources = [ "frame_buffer2_fuzzer.cc" ] sources = [ "frame_buffer2_fuzzer.cc" ]
deps = [ deps = [
"../../api/task_queue",
"../../modules/video_coding/", "../../modules/video_coding/",
"../../modules/video_coding/timing:timing_module", "../../modules/video_coding/timing:timing_module",
"../../test:scoped_key_value_config", "../../test:scoped_key_value_config",

View file

@ -8,6 +8,9 @@
* be found in the AUTHORS file in the root of the source tree. * be found in the AUTHORS file in the root of the source tree.
*/ */
#include <memory>
#include "api/task_queue/task_queue_base.h"
#include "modules/video_coding/frame_buffer2.h" #include "modules/video_coding/frame_buffer2.h"
#include "modules/video_coding/timing/timing.h" #include "modules/video_coding/timing/timing.h"
#include "test/scoped_key_value_config.h" #include "test/scoped_key_value_config.h"
@ -66,9 +69,9 @@ void FuzzOneInput(const uint8_t* data, size_t size) {
} }
DataReader reader(data, size); DataReader reader(data, size);
GlobalSimulatedTimeController time_controller(Timestamp::Seconds(0)); GlobalSimulatedTimeController time_controller(Timestamp::Seconds(0));
rtc::TaskQueue task_queue( std::unique_ptr<TaskQueueBase, TaskQueueDeleter> task_queue =
time_controller.GetTaskQueueFactory()->CreateTaskQueue( time_controller.GetTaskQueueFactory()->CreateTaskQueue(
"time_tq", TaskQueueFactory::Priority::NORMAL)); "time_tq", TaskQueueFactory::Priority::NORMAL);
test::ScopedKeyValueConfig field_trials; test::ScopedKeyValueConfig field_trials;
VCMTiming timing(time_controller.GetClock(), field_trials); VCMTiming timing(time_controller.GetClock(), field_trials);
video_coding::FrameBuffer frame_buffer(time_controller.GetClock(), &timing, video_coding::FrameBuffer frame_buffer(time_controller.GetClock(), &timing,
@ -94,11 +97,11 @@ void FuzzOneInput(const uint8_t* data, size_t size) {
next_frame_task_running = true; next_frame_task_running = true;
bool keyframe_required = reader.GetNum<uint8_t>() % 2; bool keyframe_required = reader.GetNum<uint8_t>() % 2;
int max_wait_time_ms = reader.GetNum<uint8_t>(); int max_wait_time_ms = reader.GetNum<uint8_t>();
task_queue.PostTask([&task_queue, &frame_buffer, task_queue->PostTask([&task_queue, &frame_buffer,
&next_frame_task_running, keyframe_required, &next_frame_task_running, keyframe_required,
max_wait_time_ms] { max_wait_time_ms] {
frame_buffer.NextFrame( frame_buffer.NextFrame(
max_wait_time_ms, keyframe_required, &task_queue, max_wait_time_ms, keyframe_required, task_queue.get(),
[&next_frame_task_running](std::unique_ptr<EncodedFrame> frame) { [&next_frame_task_running](std::unique_ptr<EncodedFrame> frame) {
next_frame_task_running = false; next_frame_task_running = false;
}); });

View file

@ -276,7 +276,6 @@ rtc_library("frame_buffer_proxy") {
"../rtc_base:checks", "../rtc_base:checks",
"../rtc_base:logging", "../rtc_base:logging",
"../rtc_base:macromagic", "../rtc_base:macromagic",
"../rtc_base:rtc_task_queue",
"../system_wrappers", "../system_wrappers",
"../system_wrappers:field_trial", "../system_wrappers:field_trial",
] ]

View file

@ -55,7 +55,6 @@ rtc_library("video_adaptation") {
"../../rtc_base:refcount", "../../rtc_base:refcount",
"../../rtc_base:rtc_event", "../../rtc_base:rtc_event",
"../../rtc_base:rtc_numerics", "../../rtc_base:rtc_numerics",
"../../rtc_base:rtc_task_queue",
"../../rtc_base:safe_conversions", "../../rtc_base:safe_conversions",
"../../rtc_base:stringutils", "../../rtc_base:stringutils",
"../../rtc_base:timeutils", "../../rtc_base:timeutils",
@ -108,7 +107,6 @@ if (rtc_include_tests) {
"../../rtc_base:rtc_base_tests_utils", "../../rtc_base:rtc_base_tests_utils",
"../../rtc_base:rtc_event", "../../rtc_base:rtc_event",
"../../rtc_base:rtc_numerics", "../../rtc_base:rtc_numerics",
"../../rtc_base:rtc_task_queue",
"../../rtc_base:task_queue_for_test", "../../rtc_base:task_queue_for_test",
"../../rtc_base:threading", "../../rtc_base:threading",
"../../test:field_trial", "../../test:field_trial",

View file

@ -23,7 +23,6 @@
#include "call/adaptation/degradation_preference_provider.h" #include "call/adaptation/degradation_preference_provider.h"
#include "call/adaptation/resource_adaptation_processor_interface.h" #include "call/adaptation/resource_adaptation_processor_interface.h"
#include "modules/video_coding/utility/bandwidth_quality_scaler.h" #include "modules/video_coding/utility/bandwidth_quality_scaler.h"
#include "rtc_base/task_queue.h"
#include "video/adaptation/video_stream_encoder_resource.h" #include "video/adaptation/video_stream_encoder_resource.h"
namespace webrtc { namespace webrtc {

View file

@ -17,7 +17,6 @@
#include "absl/types/optional.h" #include "absl/types/optional.h"
#include "api/scoped_refptr.h" #include "api/scoped_refptr.h"
#include "api/video/video_adaptation_reason.h" #include "api/video/video_adaptation_reason.h"
#include "rtc_base/task_queue.h"
#include "video/adaptation/overuse_frame_detector.h" #include "video/adaptation/overuse_frame_detector.h"
#include "video/adaptation/video_stream_encoder_resource.h" #include "video/adaptation/video_stream_encoder_resource.h"

View file

@ -22,7 +22,6 @@
#include "call/adaptation/degradation_preference_provider.h" #include "call/adaptation/degradation_preference_provider.h"
#include "call/adaptation/resource_adaptation_processor_interface.h" #include "call/adaptation/resource_adaptation_processor_interface.h"
#include "modules/video_coding/utility/quality_scaler.h" #include "modules/video_coding/utility/quality_scaler.h"
#include "rtc_base/task_queue.h"
#include "video/adaptation/video_stream_encoder_resource.h" #include "video/adaptation/video_stream_encoder_resource.h"
namespace webrtc { namespace webrtc {

View file

@ -308,14 +308,13 @@ VideoStreamEncoderResourceManager::~VideoStreamEncoderResourceManager() =
default; default;
void VideoStreamEncoderResourceManager::Initialize( void VideoStreamEncoderResourceManager::Initialize(
rtc::TaskQueue* encoder_queue) { TaskQueueBase* encoder_queue) {
RTC_DCHECK(!encoder_queue_); RTC_DCHECK(!encoder_queue_);
RTC_DCHECK(encoder_queue); RTC_DCHECK(encoder_queue);
encoder_queue_ = encoder_queue; encoder_queue_ = encoder_queue;
encode_usage_resource_->RegisterEncoderTaskQueue(encoder_queue_->Get()); encode_usage_resource_->RegisterEncoderTaskQueue(encoder_queue_);
quality_scaler_resource_->RegisterEncoderTaskQueue(encoder_queue_->Get()); quality_scaler_resource_->RegisterEncoderTaskQueue(encoder_queue_);
bandwidth_quality_scaler_resource_->RegisterEncoderTaskQueue( bandwidth_quality_scaler_resource_->RegisterEncoderTaskQueue(encoder_queue_);
encoder_queue_->Get());
} }
void VideoStreamEncoderResourceManager::SetAdaptationProcessor( void VideoStreamEncoderResourceManager::SetAdaptationProcessor(
@ -374,7 +373,7 @@ void VideoStreamEncoderResourceManager::MaybeInitializePixelLimitResource() {
// resource is active for the lifetme of the stream (until // resource is active for the lifetme of the stream (until
// StopManagedResources() is called). // StopManagedResources() is called).
pixel_limit_resource_ = pixel_limit_resource_ =
PixelLimitResource::Create(encoder_queue_->Get(), input_state_provider_); PixelLimitResource::Create(encoder_queue_, input_state_provider_);
pixel_limit_resource_->SetMaxPixels(max_pixels); pixel_limit_resource_->SetMaxPixels(max_pixels);
AddResource(pixel_limit_resource_, VideoAdaptationReason::kCpu); AddResource(pixel_limit_resource_, VideoAdaptationReason::kCpu);
} }

View file

@ -40,7 +40,6 @@
#include "rtc_base/ref_count.h" #include "rtc_base/ref_count.h"
#include "rtc_base/strings/string_builder.h" #include "rtc_base/strings/string_builder.h"
#include "rtc_base/synchronization/mutex.h" #include "rtc_base/synchronization/mutex.h"
#include "rtc_base/task_queue.h"
#include "rtc_base/thread_annotations.h" #include "rtc_base/thread_annotations.h"
#include "system_wrappers/include/clock.h" #include "system_wrappers/include/clock.h"
#include "video/adaptation/balanced_constraint.h" #include "video/adaptation/balanced_constraint.h"
@ -84,7 +83,7 @@ class VideoStreamEncoderResourceManager
const FieldTrialsView& field_trials); const FieldTrialsView& field_trials);
~VideoStreamEncoderResourceManager() override; ~VideoStreamEncoderResourceManager() override;
void Initialize(rtc::TaskQueue* encoder_queue); void Initialize(TaskQueueBase* encoder_queue);
void SetAdaptationProcessor( void SetAdaptationProcessor(
ResourceAdaptationProcessorInterface* adaptation_processor, ResourceAdaptationProcessorInterface* adaptation_processor,
VideoStreamAdapter* stream_adapter); VideoStreamAdapter* stream_adapter);
@ -196,7 +195,7 @@ class VideoStreamEncoderResourceManager
const rtc::scoped_refptr<BandwidthQualityScalerResource> const rtc::scoped_refptr<BandwidthQualityScalerResource>
bandwidth_quality_scaler_resource_; bandwidth_quality_scaler_resource_;
rtc::TaskQueue* encoder_queue_; TaskQueueBase* encoder_queue_;
VideoStreamInputStateProvider* const input_state_provider_ VideoStreamInputStateProvider* const input_state_provider_
RTC_GUARDED_BY(encoder_queue_); RTC_GUARDED_BY(encoder_queue_);
ResourceAdaptationProcessorInterface* adaptation_processor_; ResourceAdaptationProcessorInterface* adaptation_processor_;

View file

@ -15,10 +15,10 @@
#include <memory> #include <memory>
#include "api/task_queue/pending_task_safety_flag.h" #include "api/task_queue/pending_task_safety_flag.h"
#include "api/task_queue/task_queue_base.h"
#include "api/units/timestamp.h" #include "api/units/timestamp.h"
#include "modules/include/module_common_types.h" #include "modules/include/module_common_types.h"
#include "modules/rtp_rtcp/include/rtp_rtcp_defines.h" #include "modules/rtp_rtcp/include/rtp_rtcp_defines.h"
#include "rtc_base/task_queue.h"
#include "rtc_base/task_utils/repeating_task.h" #include "rtc_base/task_utils/repeating_task.h"
#include "system_wrappers/include/clock.h" #include "system_wrappers/include/clock.h"

View file

@ -13,6 +13,7 @@
#include <memory> #include <memory>
#include "api/task_queue/default_task_queue_factory.h" #include "api/task_queue/default_task_queue_factory.h"
#include "api/task_queue/task_queue_base.h"
#include "modules/rtp_rtcp/include/rtp_rtcp_defines.h" #include "modules/rtp_rtcp/include/rtp_rtcp_defines.h"
#include "rtc_base/thread.h" #include "rtc_base/thread.h"
#include "system_wrappers/include/metrics.h" #include "system_wrappers/include/metrics.h"
@ -42,20 +43,21 @@ class CallStats2Test : public ::testing::Test {
// Queues an rtt update call on the process thread. // Queues an rtt update call on the process thread.
void AsyncSimulateRttUpdate(int64_t rtt) { void AsyncSimulateRttUpdate(int64_t rtt) {
RtcpRttStats* rtcp_rtt_stats = call_stats_.AsRtcpRttStats(); RtcpRttStats* rtcp_rtt_stats = call_stats_.AsRtcpRttStats();
task_queue_.PostTask( task_queue_->PostTask(
[rtcp_rtt_stats, rtt] { rtcp_rtt_stats->OnRttUpdate(rtt); }); [rtcp_rtt_stats, rtt] { rtcp_rtt_stats->OnRttUpdate(rtt); });
} }
protected: protected:
void FlushProcessAndWorker() { void FlushProcessAndWorker() {
task_queue_.PostTask([this] { loop_.PostTask([this] { loop_.Quit(); }); }); task_queue_->PostTask([this] { loop_.PostTask([this] { loop_.Quit(); }); });
loop_.Run(); loop_.Run();
} }
test::RunLoop loop_; test::RunLoop loop_;
rtc::TaskQueue task_queue_{CreateDefaultTaskQueueFactory()->CreateTaskQueue( std::unique_ptr<TaskQueueBase, TaskQueueDeleter> task_queue_ =
"CallStats", CreateDefaultTaskQueueFactory()->CreateTaskQueue(
TaskQueueFactory::Priority::NORMAL)}; "CallStats",
TaskQueueFactory::Priority::NORMAL);
// Note: Since rtc::Thread doesn't support injecting a Clock, we're going // Note: Since rtc::Thread doesn't support injecting a Clock, we're going
// to be using a mix of the fake clock (used by CallStats) as well as the // to be using a mix of the fake clock (used by CallStats) as well as the

View file

@ -17,6 +17,7 @@
#include "absl/base/attributes.h" #include "absl/base/attributes.h"
#include "absl/functional/bind_front.h" #include "absl/functional/bind_front.h"
#include "api/sequence_checker.h" #include "api/sequence_checker.h"
#include "api/task_queue/task_queue_base.h"
#include "api/units/data_size.h" #include "api/units/data_size.h"
#include "api/video/encoded_frame.h" #include "api/video/encoded_frame.h"
#include "api/video/frame_buffer.h" #include "api/video/frame_buffer.h"
@ -41,7 +42,7 @@ class FrameBuffer2Proxy : public FrameBufferProxy {
FrameBuffer2Proxy(Clock* clock, FrameBuffer2Proxy(Clock* clock,
VCMTiming* timing, VCMTiming* timing,
VCMReceiveStatisticsCallback* stats_proxy, VCMReceiveStatisticsCallback* stats_proxy,
rtc::TaskQueue* decode_queue, TaskQueueBase* decode_queue,
FrameSchedulingReceiver* receiver, FrameSchedulingReceiver* receiver,
TimeDelta max_wait_for_keyframe, TimeDelta max_wait_for_keyframe,
TimeDelta max_wait_for_frame, TimeDelta max_wait_for_frame,
@ -127,7 +128,7 @@ class FrameBuffer2Proxy : public FrameBufferProxy {
const TimeDelta max_wait_for_keyframe_; const TimeDelta max_wait_for_keyframe_;
const TimeDelta max_wait_for_frame_; const TimeDelta max_wait_for_frame_;
video_coding::FrameBuffer frame_buffer_; video_coding::FrameBuffer frame_buffer_;
rtc::TaskQueue* const decode_queue_; TaskQueueBase* const decode_queue_;
VCMReceiveStatisticsCallback* const stats_proxy_; VCMReceiveStatisticsCallback* const stats_proxy_;
FrameSchedulingReceiver* const receiver_; FrameSchedulingReceiver* const receiver_;
rtc::scoped_refptr<PendingTaskSafetyFlag> decode_safety_ = rtc::scoped_refptr<PendingTaskSafetyFlag> decode_safety_ =
@ -179,7 +180,7 @@ class FrameBuffer3Proxy : public FrameBufferProxy {
TaskQueueBase* worker_queue, TaskQueueBase* worker_queue,
VCMTiming* timing, VCMTiming* timing,
VCMReceiveStatisticsCallback* stats_proxy, VCMReceiveStatisticsCallback* stats_proxy,
rtc::TaskQueue* decode_queue, TaskQueueBase* decode_queue,
FrameSchedulingReceiver* receiver, FrameSchedulingReceiver* receiver,
TimeDelta max_wait_for_keyframe, TimeDelta max_wait_for_keyframe,
TimeDelta max_wait_for_frame, TimeDelta max_wait_for_frame,
@ -490,7 +491,7 @@ class FrameBuffer3Proxy : public FrameBufferProxy {
RttMultExperiment::GetRttMultValue(); RttMultExperiment::GetRttMultValue();
Clock* const clock_; Clock* const clock_;
TaskQueueBase* const worker_queue_; TaskQueueBase* const worker_queue_;
rtc::TaskQueue* const decode_queue_; TaskQueueBase* const decode_queue_;
VCMReceiveStatisticsCallback* const stats_proxy_; VCMReceiveStatisticsCallback* const stats_proxy_;
FrameSchedulingReceiver* const receiver_; FrameSchedulingReceiver* const receiver_;
VCMTiming* const timing_; VCMTiming* const timing_;
@ -556,7 +557,7 @@ std::unique_ptr<FrameBufferProxy> FrameBufferProxy::CreateFromFieldTrial(
TaskQueueBase* worker_queue, TaskQueueBase* worker_queue,
VCMTiming* timing, VCMTiming* timing,
VCMReceiveStatisticsCallback* stats_proxy, VCMReceiveStatisticsCallback* stats_proxy,
rtc::TaskQueue* decode_queue, TaskQueueBase* decode_queue,
FrameSchedulingReceiver* receiver, FrameSchedulingReceiver* receiver,
TimeDelta max_wait_for_keyframe, TimeDelta max_wait_for_keyframe,
TimeDelta max_wait_for_frame, TimeDelta max_wait_for_frame,

View file

@ -19,7 +19,6 @@
#include "api/video/encoded_frame.h" #include "api/video/encoded_frame.h"
#include "modules/video_coding/include/video_coding_defines.h" #include "modules/video_coding/include/video_coding_defines.h"
#include "modules/video_coding/timing/timing.h" #include "modules/video_coding/timing/timing.h"
#include "rtc_base/task_queue.h"
#include "system_wrappers/include/clock.h" #include "system_wrappers/include/clock.h"
#include "video/decode_synchronizer.h" #include "video/decode_synchronizer.h"
@ -44,7 +43,7 @@ class FrameBufferProxy {
TaskQueueBase* worker_queue, TaskQueueBase* worker_queue,
VCMTiming* timing, VCMTiming* timing,
VCMReceiveStatisticsCallback* stats_proxy, VCMReceiveStatisticsCallback* stats_proxy,
rtc::TaskQueue* decode_queue, TaskQueueBase* decode_queue,
FrameSchedulingReceiver* receiver, FrameSchedulingReceiver* receiver,
TimeDelta max_wait_for_keyframe, TimeDelta max_wait_for_keyframe,
TimeDelta max_wait_for_frame, TimeDelta max_wait_for_frame,

View file

@ -132,7 +132,7 @@ class FrameBufferProxyFixture
run_loop_.task_queue(), run_loop_.task_queue(),
&timing_, &timing_,
&stats_callback_, &stats_callback_,
&decode_queue_, decode_queue_.Get(),
this, this,
kMaxWaitForKeyframe, kMaxWaitForKeyframe,
kMaxWaitForFrame, kMaxWaitForFrame,

View file

@ -14,8 +14,8 @@
#include <memory> #include <memory>
#include "api/sequence_checker.h" #include "api/sequence_checker.h"
#include "api/task_queue/task_queue_base.h"
#include "rtc_base/system/no_unique_address.h" #include "rtc_base/system/no_unique_address.h"
#include "rtc_base/task_queue.h"
#include "rtc_base/task_utils/repeating_task.h" #include "rtc_base/task_utils/repeating_task.h"
#include "video/stream_synchronization.h" #include "video/stream_synchronization.h"

View file

@ -55,7 +55,6 @@
#include "rtc_base/logging.h" #include "rtc_base/logging.h"
#include "rtc_base/strings/string_builder.h" #include "rtc_base/strings/string_builder.h"
#include "rtc_base/synchronization/mutex.h" #include "rtc_base/synchronization/mutex.h"
#include "rtc_base/task_queue.h"
#include "rtc_base/thread_annotations.h" #include "rtc_base/thread_annotations.h"
#include "rtc_base/time_utils.h" #include "rtc_base/time_utils.h"
#include "rtc_base/trace_event.h" #include "rtc_base/trace_event.h"
@ -268,7 +267,7 @@ VideoReceiveStream2::VideoReceiveStream2(
frame_buffer_ = FrameBufferProxy::CreateFromFieldTrial( frame_buffer_ = FrameBufferProxy::CreateFromFieldTrial(
clock_, call_->worker_thread(), timing_.get(), &stats_proxy_, clock_, call_->worker_thread(), timing_.get(), &stats_proxy_,
&decode_queue_, this, max_wait_for_keyframe_, max_wait_for_frame_, decode_queue_.Get(), this, max_wait_for_keyframe_, max_wait_for_frame_,
decode_sync_, call_->trials()); decode_sync_, call_->trials());
if (rtx_ssrc()) { if (rtx_ssrc()) {

View file

@ -149,7 +149,7 @@ VideoSendStream::VideoSendStream(
const std::map<uint32_t, RtpPayloadState>& suspended_payload_states, const std::map<uint32_t, RtpPayloadState>& suspended_payload_states,
std::unique_ptr<FecController> fec_controller, std::unique_ptr<FecController> fec_controller,
const FieldTrialsView& field_trials) const FieldTrialsView& field_trials)
: rtp_transport_queue_(transport->GetWorkerQueue()), : rtp_transport_queue_(transport->GetWorkerQueue()->Get()),
transport_(transport), transport_(transport),
stats_proxy_(clock, config, encoder_config.content_type, field_trials), stats_proxy_(clock, config, encoder_config.content_type, field_trials),
config_(std::move(config)), config_(std::move(config)),

View file

@ -25,7 +25,6 @@
#include "call/video_send_stream.h" #include "call/video_send_stream.h"
#include "rtc_base/event.h" #include "rtc_base/event.h"
#include "rtc_base/system/no_unique_address.h" #include "rtc_base/system/no_unique_address.h"
#include "rtc_base/task_queue.h"
#include "video/encoder_rtcp_feedback.h" #include "video/encoder_rtcp_feedback.h"
#include "video/send_delay_stats.h" #include "video/send_delay_stats.h"
#include "video/send_statistics_proxy.h" #include "video/send_statistics_proxy.h"
@ -100,7 +99,7 @@ class VideoSendStream : public webrtc::VideoSendStream {
absl::optional<float> GetPacingFactorOverride() const; absl::optional<float> GetPacingFactorOverride() const;
RTC_NO_UNIQUE_ADDRESS SequenceChecker thread_checker_; RTC_NO_UNIQUE_ADDRESS SequenceChecker thread_checker_;
rtc::TaskQueue* const rtp_transport_queue_; TaskQueueBase* const rtp_transport_queue_;
RtpTransportControllerSendInterface* const transport_; RtpTransportControllerSendInterface* const transport_;
rtc::Event thread_sync_event_; rtc::Event thread_sync_event_;
rtc::scoped_refptr<PendingTaskSafetyFlag> transport_queue_safety_ = rtc::scoped_refptr<PendingTaskSafetyFlag> transport_queue_safety_ =

View file

@ -202,7 +202,7 @@ PacingConfig::~PacingConfig() = default;
VideoSendStreamImpl::VideoSendStreamImpl( VideoSendStreamImpl::VideoSendStreamImpl(
Clock* clock, Clock* clock,
SendStatisticsProxy* stats_proxy, SendStatisticsProxy* stats_proxy,
rtc::TaskQueue* rtp_transport_queue, TaskQueueBase* rtp_transport_queue,
RtpTransportControllerSendInterface* transport, RtpTransportControllerSendInterface* transport,
BitrateAllocatorInterface* bitrate_allocator, BitrateAllocatorInterface* bitrate_allocator,
VideoStreamEncoderInterface* video_stream_encoder, VideoStreamEncoderInterface* video_stream_encoder,
@ -341,7 +341,7 @@ void VideoSendStreamImpl::StartupVideoSendStream() {
activity_ = false; activity_ = false;
timed_out_ = false; timed_out_ = false;
check_encoder_activity_task_ = RepeatingTaskHandle::DelayedStart( check_encoder_activity_task_ = RepeatingTaskHandle::DelayedStart(
rtp_transport_queue_->Get(), kEncoderTimeOut, [this] { rtp_transport_queue_, kEncoderTimeOut, [this] {
RTC_DCHECK_RUN_ON(rtp_transport_queue_); RTC_DCHECK_RUN_ON(rtp_transport_queue_);
if (!activity_) { if (!activity_) {
if (!timed_out_) { if (!timed_out_) {

View file

@ -21,6 +21,7 @@
#include "absl/types/optional.h" #include "absl/types/optional.h"
#include "api/field_trials_view.h" #include "api/field_trials_view.h"
#include "api/task_queue/pending_task_safety_flag.h" #include "api/task_queue/pending_task_safety_flag.h"
#include "api/task_queue/task_queue_base.h"
#include "api/video/encoded_image.h" #include "api/video/encoded_image.h"
#include "api/video/video_bitrate_allocation.h" #include "api/video/video_bitrate_allocation.h"
#include "api/video/video_bitrate_allocator.h" #include "api/video/video_bitrate_allocator.h"
@ -36,7 +37,6 @@
#include "modules/video_coding/include/video_codec_interface.h" #include "modules/video_coding/include/video_codec_interface.h"
#include "rtc_base/experiments/field_trial_parser.h" #include "rtc_base/experiments/field_trial_parser.h"
#include "rtc_base/system/no_unique_address.h" #include "rtc_base/system/no_unique_address.h"
#include "rtc_base/task_queue.h"
#include "rtc_base/task_utils/repeating_task.h" #include "rtc_base/task_utils/repeating_task.h"
#include "rtc_base/thread_annotations.h" #include "rtc_base/thread_annotations.h"
#include "video/send_statistics_proxy.h" #include "video/send_statistics_proxy.h"
@ -66,7 +66,7 @@ class VideoSendStreamImpl : public webrtc::BitrateAllocatorObserver,
public: public:
VideoSendStreamImpl(Clock* clock, VideoSendStreamImpl(Clock* clock,
SendStatisticsProxy* stats_proxy, SendStatisticsProxy* stats_proxy,
rtc::TaskQueue* rtp_transport_queue, TaskQueueBase* rtp_transport_queue,
RtpTransportControllerSendInterface* transport, RtpTransportControllerSendInterface* transport,
BitrateAllocatorInterface* bitrate_allocator, BitrateAllocatorInterface* bitrate_allocator,
VideoStreamEncoderInterface* video_stream_encoder, VideoStreamEncoderInterface* video_stream_encoder,
@ -139,7 +139,7 @@ class VideoSendStreamImpl : public webrtc::BitrateAllocatorObserver,
SendStatisticsProxy* const stats_proxy_; SendStatisticsProxy* const stats_proxy_;
const VideoSendStream::Config* const config_; const VideoSendStream::Config* const config_;
rtc::TaskQueue* const rtp_transport_queue_; TaskQueueBase* const rtp_transport_queue_;
RepeatingTaskHandle check_encoder_activity_task_ RepeatingTaskHandle check_encoder_activity_task_
RTC_GUARDED_BY(rtp_transport_queue_); RTC_GUARDED_BY(rtp_transport_queue_);

View file

@ -150,7 +150,7 @@ class VideoSendStreamImplTest : public ::testing::Test {
std::map<uint32_t, RtpState> suspended_ssrcs; std::map<uint32_t, RtpState> suspended_ssrcs;
std::map<uint32_t, RtpPayloadState> suspended_payload_states; std::map<uint32_t, RtpPayloadState> suspended_payload_states;
auto ret = std::make_unique<VideoSendStreamImpl>( auto ret = std::make_unique<VideoSendStreamImpl>(
&clock_, &stats_proxy_, &test_queue_, &transport_controller_, &clock_, &stats_proxy_, test_queue_.Get(), &transport_controller_,
&bitrate_allocator_, &video_stream_encoder_, &config_, &bitrate_allocator_, &video_stream_encoder_, &config_,
initial_encoder_max_bitrate, initial_encoder_bitrate_priority, initial_encoder_max_bitrate, initial_encoder_bitrate_priority,
content_type, &rtp_video_sender_, field_trials_); content_type, &rtp_video_sender_, field_trials_);

View file

@ -141,7 +141,7 @@ void VideoStreamDecoderImpl::StartNextDecode() {
int64_t max_wait_time = keyframe_required_ ? 200 : 3000; int64_t max_wait_time = keyframe_required_ ? 200 : 3000;
frame_buffer_.NextFrame(max_wait_time, keyframe_required_, frame_buffer_.NextFrame(max_wait_time, keyframe_required_,
&bookkeeping_queue_, bookkeeping_queue_.Get(),
[this](std::unique_ptr<EncodedFrame> frame) { [this](std::unique_ptr<EncodedFrame> frame) {
RTC_DCHECK_RUN_ON(&bookkeeping_queue_); RTC_DCHECK_RUN_ON(&bookkeeping_queue_);
OnNextFrameCallback(std::move(frame)); OnNextFrameCallback(std::move(frame));

View file

@ -702,7 +702,7 @@ VideoStreamEncoder::VideoStreamEncoder(
RTC_DCHECK_GE(number_of_cores, 1); RTC_DCHECK_GE(number_of_cores, 1);
frame_cadence_adapter_->Initialize(&cadence_callback_); frame_cadence_adapter_->Initialize(&cadence_callback_);
stream_resource_manager_.Initialize(&encoder_queue_); stream_resource_manager_.Initialize(encoder_queue_.Get());
encoder_queue_.PostTask([this] { encoder_queue_.PostTask([this] {
RTC_DCHECK_RUN_ON(&encoder_queue_); RTC_DCHECK_RUN_ON(&encoder_queue_);

View file

@ -128,7 +128,7 @@ class VideoStreamEncoder : public VideoStreamEncoderInterface,
protected: protected:
// Used for testing. For example the `ScalingObserverInterface` methods must // Used for testing. For example the `ScalingObserverInterface` methods must
// be called on `encoder_queue_`. // be called on `encoder_queue_`.
rtc::TaskQueue* encoder_queue() { return &encoder_queue_; } TaskQueueBase* encoder_queue() { return encoder_queue_.Get(); }
void OnVideoSourceRestrictionsUpdated( void OnVideoSourceRestrictionsUpdated(
VideoSourceRestrictions restrictions, VideoSourceRestrictions restrictions,