mirror of
https://github.com/mollyim/webrtc.git
synced 2025-05-19 16:47:50 +01:00

Use cases of TaskQueue or TaskQueueBase that are considered high precision are updated to make use of PostDelayedHighPrecisionTask (see go/postdelayedtask-precision-in-webrtc) instead of PostDelayedTask. The cases here are the ones covered by that document, plus some testing-only uses. The FrameBuffer2 and DataTracker use cases will be covered by separate CLs because FrameBuffer2 uses RepeatingTaskHandle and DataTracker uses dcsctp::Timer. This protects these use cases against regressions when PostDelayedTask gets its precision lowered. This CL also adds TaskQueue::PostDelayedHighPrecisionTask which calls TaskQueueBase::PostDelayedHighPrecisionTask (same pattern as for PostDelayedTask). Bug: webrtc:13604 Change-Id: I7dcab59cbe4d274d27b734ceb4fc06daa12ffd0f Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/248864 Reviewed-by: Erik Språng <sprang@webrtc.org> Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org> Commit-Queue: Henrik Boström <hbos@webrtc.org> Cr-Commit-Position: refs/heads/main@{#35781}
47 lines
1.5 KiB
C++
47 lines
1.5 KiB
C++
/*
|
|
* Copyright 2019 The WebRTC Project Authors. All rights reserved.
|
|
*
|
|
* Use of this source code is governed by a BSD-style license
|
|
* that can be found in the LICENSE file in the root of the source
|
|
* tree. An additional intellectual property rights grant can be found
|
|
* in the file PATENTS. All contributing project authors may
|
|
* be found in the AUTHORS file in the root of the source tree.
|
|
*/
|
|
#include "rtc_base/task_queue.h"
|
|
|
|
#include "api/task_queue/task_queue_base.h"
|
|
|
|
namespace rtc {
|
|
|
|
TaskQueue::TaskQueue(
|
|
std::unique_ptr<webrtc::TaskQueueBase, webrtc::TaskQueueDeleter> task_queue)
|
|
: impl_(task_queue.release()) {}
|
|
|
|
TaskQueue::~TaskQueue() {
|
|
// There might running task that tries to rescheduler itself to the TaskQueue
|
|
// and not yet aware TaskQueue destructor is called.
|
|
// Calling back to TaskQueue::PostTask need impl_ pointer still be valid, so
|
|
// do not invalidate impl_ pointer until Delete returns.
|
|
impl_->Delete();
|
|
}
|
|
|
|
bool TaskQueue::IsCurrent() const {
|
|
return impl_->IsCurrent();
|
|
}
|
|
|
|
void TaskQueue::PostTask(std::unique_ptr<webrtc::QueuedTask> task) {
|
|
return impl_->PostTask(std::move(task));
|
|
}
|
|
|
|
void TaskQueue::PostDelayedTask(std::unique_ptr<webrtc::QueuedTask> task,
|
|
uint32_t milliseconds) {
|
|
return impl_->PostDelayedTask(std::move(task), milliseconds);
|
|
}
|
|
|
|
void TaskQueue::PostDelayedHighPrecisionTask(
|
|
std::unique_ptr<webrtc::QueuedTask> task,
|
|
uint32_t milliseconds) {
|
|
return impl_->PostDelayedHighPrecisionTask(std::move(task), milliseconds);
|
|
}
|
|
|
|
} // namespace rtc
|