Migrate pacing and video_coding to absl::AnyInvocable based TaskQueueBase interface

Bug: webrtc:14245
Change-Id: Icfab3e6548055ea72a199a226eca5233b1ead20d
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/267983
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Reviewed-by: Erik Språng <sprang@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#37467}
This commit is contained in:
Danil Chapovalov
2022-07-06 13:17:54 +02:00
committed by WebRTC LUCI CQ
parent f7b30e046e
commit 0be8eba07e
10 changed files with 38 additions and 72 deletions

View File

@ -19,7 +19,6 @@
#include <utility>
#include "api/scoped_refptr.h"
#include "api/task_queue/to_queued_task.h"
#include "api/video/builtin_video_bitrate_allocator_factory.h"
#include "api/video/i420_buffer.h"
#include "api/video/video_bitrate_allocator_factory.h"
@ -340,9 +339,9 @@ int32_t VideoProcessor::VideoProcessorDecodeCompleteCallback::Decoded(
.build();
copy.set_timestamp(image.timestamp());
task_queue_->PostTask(ToQueuedTask([this, copy]() {
task_queue_->PostTask([this, copy]() {
video_processor_->FrameDecoded(copy, simulcast_svc_idx_);
}));
});
return 0;
}
video_processor_->FrameDecoded(image, simulcast_svc_idx_);

View File

@ -21,7 +21,6 @@
#include "absl/types/optional.h"
#include "api/sequence_checker.h"
#include "api/task_queue/queued_task.h"
#include "api/task_queue/task_queue_base.h"
#include "api/test/videocodec_test_fixture.h"
#include "api/video/encoded_image.h"
@ -105,8 +104,11 @@ class VideoProcessor {
// Post the callback to the right task queue, if needed.
if (!task_queue_->IsCurrent()) {
task_queue_->PostTask(std::make_unique<EncodeCallbackTask>(
video_processor_, encoded_image, codec_specific_info));
VideoProcessor* video_processor = video_processor_;
task_queue_->PostTask([video_processor, encoded_image,
codec_specific_info = *codec_specific_info] {
video_processor->FrameEncoded(encoded_image, codec_specific_info);
});
return Result(Result::OK, 0);
}
@ -115,27 +117,6 @@ class VideoProcessor {
}
private:
class EncodeCallbackTask : public QueuedTask {
public:
EncodeCallbackTask(VideoProcessor* video_processor,
const webrtc::EncodedImage& encoded_image,
const webrtc::CodecSpecificInfo* codec_specific_info)
: video_processor_(video_processor),
encoded_image_(encoded_image),
codec_specific_info_(*codec_specific_info) {
}
bool Run() override {
video_processor_->FrameEncoded(encoded_image_, codec_specific_info_);
return true;
}
private:
VideoProcessor* const video_processor_;
webrtc::EncodedImage encoded_image_;
const webrtc::CodecSpecificInfo codec_specific_info_;
};
VideoProcessor* const video_processor_;
TaskQueueBase* const task_queue_;
};