mirror of
https://github.com/mollyim/webrtc.git
synced 2025-05-13 05:40:42 +01:00
Remove usage of the rtc::TaskQueue in test/
Bug: webrtc:14169 Change-Id: Ie95973e5f58ee203c13243866782696ed14de908 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/335144 Commit-Queue: Danil Chapovalov <danilchap@webrtc.org> Reviewed-by: Jeremy Leconte <jleconte@webrtc.org> Cr-Commit-Position: refs/heads/main@{#41569}
This commit is contained in:
parent
3b2b2afdaa
commit
f49d96d6e4
5 changed files with 11 additions and 14 deletions
|
@ -167,7 +167,6 @@ rtc_library("frame_generator_capturer") {
|
||||||
"../rtc_base:checks",
|
"../rtc_base:checks",
|
||||||
"../rtc_base:logging",
|
"../rtc_base:logging",
|
||||||
"../rtc_base:macromagic",
|
"../rtc_base:macromagic",
|
||||||
"../rtc_base:rtc_task_queue",
|
|
||||||
"../rtc_base/synchronization:mutex",
|
"../rtc_base/synchronization:mutex",
|
||||||
"../rtc_base/task_utils:repeating_task",
|
"../rtc_base/task_utils:repeating_task",
|
||||||
"../system_wrappers",
|
"../system_wrappers",
|
||||||
|
@ -215,7 +214,6 @@ rtc_library("video_test_common") {
|
||||||
"../rtc_base:criticalsection",
|
"../rtc_base:criticalsection",
|
||||||
"../rtc_base:logging",
|
"../rtc_base:logging",
|
||||||
"../rtc_base:refcount",
|
"../rtc_base:refcount",
|
||||||
"../rtc_base:rtc_task_queue",
|
|
||||||
"../rtc_base:timeutils",
|
"../rtc_base:timeutils",
|
||||||
"../rtc_base/synchronization:mutex",
|
"../rtc_base/synchronization:mutex",
|
||||||
"../rtc_base/task_utils:repeating_task",
|
"../rtc_base/task_utils:repeating_task",
|
||||||
|
@ -729,6 +727,7 @@ if (rtc_include_tests) {
|
||||||
"../api:mock_video_encoder",
|
"../api:mock_video_encoder",
|
||||||
"../api:scoped_refptr",
|
"../api:scoped_refptr",
|
||||||
"../api:simulcast_test_fixture_api",
|
"../api:simulcast_test_fixture_api",
|
||||||
|
"../api/task_queue",
|
||||||
"../api/task_queue:task_queue_test",
|
"../api/task_queue:task_queue_test",
|
||||||
"../api/test/video:function_video_factory",
|
"../api/test/video:function_video_factory",
|
||||||
"../api/test/video:video_frame_writer",
|
"../api/test/video:video_frame_writer",
|
||||||
|
@ -755,7 +754,6 @@ if (rtc_include_tests) {
|
||||||
"../modules/video_coding/svc:scalability_mode_util",
|
"../modules/video_coding/svc:scalability_mode_util",
|
||||||
"../rtc_base:criticalsection",
|
"../rtc_base:criticalsection",
|
||||||
"../rtc_base:rtc_event",
|
"../rtc_base:rtc_event",
|
||||||
"../rtc_base:rtc_task_queue",
|
|
||||||
"../rtc_base/synchronization:mutex",
|
"../rtc_base/synchronization:mutex",
|
||||||
"../rtc_base/system:file_wrapper",
|
"../rtc_base/system:file_wrapper",
|
||||||
"jitter:jitter_unittests",
|
"jitter:jitter_unittests",
|
||||||
|
@ -1017,7 +1015,6 @@ rtc_library("fake_video_codecs") {
|
||||||
"../rtc_base:checks",
|
"../rtc_base:checks",
|
||||||
"../rtc_base:criticalsection",
|
"../rtc_base:criticalsection",
|
||||||
"../rtc_base:macromagic",
|
"../rtc_base:macromagic",
|
||||||
"../rtc_base:rtc_task_queue",
|
|
||||||
"../rtc_base:timeutils",
|
"../rtc_base:timeutils",
|
||||||
"../rtc_base/synchronization:mutex",
|
"../rtc_base/synchronization:mutex",
|
||||||
"../system_wrappers",
|
"../system_wrappers",
|
||||||
|
|
|
@ -15,13 +15,13 @@
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#include "api/scoped_refptr.h"
|
#include "api/scoped_refptr.h"
|
||||||
|
#include "api/task_queue/task_queue_factory.h"
|
||||||
#include "api/video/i420_buffer.h"
|
#include "api/video/i420_buffer.h"
|
||||||
#include "api/video/video_frame.h"
|
#include "api/video/video_frame.h"
|
||||||
#include "api/video/video_frame_buffer.h"
|
#include "api/video/video_frame_buffer.h"
|
||||||
#include "api/video/video_rotation.h"
|
#include "api/video/video_rotation.h"
|
||||||
#include "modules/video_coding/include/video_error_codes.h"
|
#include "modules/video_coding/include/video_error_codes.h"
|
||||||
#include "rtc_base/checks.h"
|
#include "rtc_base/checks.h"
|
||||||
#include "rtc_base/task_queue.h"
|
|
||||||
#include "rtc_base/time_utils.h"
|
#include "rtc_base/time_utils.h"
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
|
|
@ -29,7 +29,6 @@
|
||||||
#include "rtc_base/checks.h"
|
#include "rtc_base/checks.h"
|
||||||
#include "rtc_base/logging.h"
|
#include "rtc_base/logging.h"
|
||||||
#include "rtc_base/synchronization/mutex.h"
|
#include "rtc_base/synchronization/mutex.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"
|
||||||
#include "test/test_video_capturer.h"
|
#include "test/test_video_capturer.h"
|
||||||
|
@ -58,6 +57,9 @@ FrameGeneratorCapturer::FrameGeneratorCapturer(
|
||||||
|
|
||||||
FrameGeneratorCapturer::~FrameGeneratorCapturer() {
|
FrameGeneratorCapturer::~FrameGeneratorCapturer() {
|
||||||
Stop();
|
Stop();
|
||||||
|
// Deconstruct first as tasks in the TaskQueue access other fields of the
|
||||||
|
// instance of this class.
|
||||||
|
task_queue_ = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FrameGeneratorCapturer::SetFakeRotation(VideoRotation rotation) {
|
void FrameGeneratorCapturer::SetFakeRotation(VideoRotation rotation) {
|
||||||
|
@ -78,7 +80,7 @@ bool FrameGeneratorCapturer::Init() {
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
frame_task_ = RepeatingTaskHandle::DelayedStart(
|
frame_task_ = RepeatingTaskHandle::DelayedStart(
|
||||||
task_queue_.Get(),
|
task_queue_.get(),
|
||||||
TimeDelta::Seconds(1) / GetCurrentConfiguredFramerate(),
|
TimeDelta::Seconds(1) / GetCurrentConfiguredFramerate(),
|
||||||
[this] {
|
[this] {
|
||||||
InsertFrame();
|
InsertFrame();
|
||||||
|
@ -131,7 +133,7 @@ void FrameGeneratorCapturer::Start() {
|
||||||
}
|
}
|
||||||
if (!frame_task_.Running()) {
|
if (!frame_task_.Running()) {
|
||||||
frame_task_ = RepeatingTaskHandle::Start(
|
frame_task_ = RepeatingTaskHandle::Start(
|
||||||
task_queue_.Get(),
|
task_queue_.get(),
|
||||||
[this] {
|
[this] {
|
||||||
InsertFrame();
|
InsertFrame();
|
||||||
return TimeDelta::Seconds(1) / GetCurrentConfiguredFramerate();
|
return TimeDelta::Seconds(1) / GetCurrentConfiguredFramerate();
|
||||||
|
@ -219,7 +221,7 @@ void FrameGeneratorCapturer::UpdateFps(int max_fps) {
|
||||||
|
|
||||||
void FrameGeneratorCapturer::ForceFrame() {
|
void FrameGeneratorCapturer::ForceFrame() {
|
||||||
// One-time non-repeating task,
|
// One-time non-repeating task,
|
||||||
task_queue_.PostTask([this] { InsertFrame(); });
|
task_queue_->PostTask([this] { InsertFrame(); });
|
||||||
}
|
}
|
||||||
|
|
||||||
int FrameGeneratorCapturer::GetCurrentConfiguredFramerate() {
|
int FrameGeneratorCapturer::GetCurrentConfiguredFramerate() {
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#include "absl/types/optional.h"
|
#include "absl/types/optional.h"
|
||||||
|
#include "api/task_queue/task_queue_base.h"
|
||||||
#include "api/task_queue/task_queue_factory.h"
|
#include "api/task_queue/task_queue_factory.h"
|
||||||
#include "api/test/frame_generator_interface.h"
|
#include "api/test/frame_generator_interface.h"
|
||||||
#include "api/video/color_space.h"
|
#include "api/video/color_space.h"
|
||||||
|
@ -23,7 +24,6 @@
|
||||||
#include "api/video/video_sink_interface.h"
|
#include "api/video/video_sink_interface.h"
|
||||||
#include "api/video/video_source_interface.h"
|
#include "api/video/video_source_interface.h"
|
||||||
#include "rtc_base/synchronization/mutex.h"
|
#include "rtc_base/synchronization/mutex.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"
|
||||||
|
@ -106,9 +106,7 @@ class FrameGeneratorCapturer : public TestVideoCapturer {
|
||||||
|
|
||||||
int64_t first_frame_capture_time_;
|
int64_t first_frame_capture_time_;
|
||||||
|
|
||||||
// Must be the last field, so it will be deconstructed first as tasks
|
std::unique_ptr<TaskQueueBase, TaskQueueDeleter> task_queue_;
|
||||||
// in the TaskQueue access other fields of the instance of this class.
|
|
||||||
rtc::TaskQueue task_queue_;
|
|
||||||
};
|
};
|
||||||
} // namespace test
|
} // namespace test
|
||||||
} // namespace webrtc
|
} // namespace webrtc
|
||||||
|
|
|
@ -10,8 +10,8 @@
|
||||||
|
|
||||||
#include "test/run_loop.h"
|
#include "test/run_loop.h"
|
||||||
|
|
||||||
|
#include "api/task_queue/task_queue_base.h"
|
||||||
#include "api/units/time_delta.h"
|
#include "api/units/time_delta.h"
|
||||||
#include "rtc_base/task_queue.h"
|
|
||||||
#include "test/gtest.h"
|
#include "test/gtest.h"
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
|
Loading…
Reference in a new issue