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

@ -8,6 +8,9 @@
* 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/timing/timing.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);
GlobalSimulatedTimeController time_controller(Timestamp::Seconds(0));
rtc::TaskQueue task_queue(
std::unique_ptr<TaskQueueBase, TaskQueueDeleter> task_queue =
time_controller.GetTaskQueueFactory()->CreateTaskQueue(
"time_tq", TaskQueueFactory::Priority::NORMAL));
"time_tq", TaskQueueFactory::Priority::NORMAL);
test::ScopedKeyValueConfig field_trials;
VCMTiming timing(time_controller.GetClock(), field_trials);
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;
bool keyframe_required = reader.GetNum<uint8_t>() % 2;
int max_wait_time_ms = reader.GetNum<uint8_t>();
task_queue.PostTask([&task_queue, &frame_buffer,
&next_frame_task_running, keyframe_required,
max_wait_time_ms] {
task_queue->PostTask([&task_queue, &frame_buffer,
&next_frame_task_running, keyframe_required,
max_wait_time_ms] {
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 = false;
});