Replacing SequencedTaskChecker with SequenceChecker.
Bug: webrtc:9883
Change-Id: I5e3189da2a46e6f4ed1a3c5a5dfd2f7d75a16b5d
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/130961
Commit-Queue: Sebastian Jansson <srte@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#27518}
diff --git a/modules/video_coding/BUILD.gn b/modules/video_coding/BUILD.gn
index 304dd4f..12d02bf 100644
--- a/modules/video_coding/BUILD.gn
+++ b/modules/video_coding/BUILD.gn
@@ -165,10 +165,10 @@
"../../rtc_base:rtc_base_approved",
"../../rtc_base:rtc_numerics",
"../../rtc_base:rtc_task_queue",
- "../../rtc_base:sequenced_task_checker",
"../../rtc_base/experiments:alr_experiment",
"../../rtc_base/experiments:jitter_upper_bound_experiment",
"../../rtc_base/experiments:rtt_mult_experiment",
+ "../../rtc_base/synchronization:sequence_checker",
"../../rtc_base/system:fallthrough",
"../../rtc_base/third_party/base64",
"../../rtc_base/time:timestamp_extrapolator",
@@ -255,9 +255,9 @@
"../../rtc_base:rtc_base_approved",
"../../rtc_base:rtc_numerics",
"../../rtc_base:rtc_task_queue",
- "../../rtc_base:sequenced_task_checker",
"../../rtc_base/experiments:quality_scaling_experiment",
"../../rtc_base/experiments:rate_control_settings",
+ "../../rtc_base/synchronization:sequence_checker",
"../../rtc_base/system:arch",
"../../rtc_base/system:file_wrapper",
"../../rtc_base/task_utils:repeating_task",
@@ -577,7 +577,7 @@
"../../rtc_base:checks",
"../../rtc_base:rtc_base_approved",
"../../rtc_base:rtc_task_queue",
- "../../rtc_base:sequenced_task_checker",
+ "../../rtc_base/synchronization:sequence_checker",
"../../rtc_base/task_utils:to_queued_task",
"../../test:test_support",
"../../test:video_test_common",
diff --git a/modules/video_coding/codecs/test/videoprocessor.cc b/modules/video_coding/codecs/test/videoprocessor.cc
index e2e79aa..708f6fe 100644
--- a/modules/video_coding/codecs/test/videoprocessor.cc
+++ b/modules/video_coding/codecs/test/videoprocessor.cc
@@ -226,7 +226,7 @@
}
VideoProcessor::~VideoProcessor() {
- RTC_DCHECK_CALLED_SEQUENTIALLY(&sequence_checker_);
+ RTC_DCHECK_RUN_ON(&sequence_checker_);
// Explicitly reset codecs, in case they don't do that themselves when they
// go out of scope.
@@ -242,7 +242,7 @@
}
void VideoProcessor::ProcessFrame() {
- RTC_DCHECK_CALLED_SEQUENTIALLY(&sequence_checker_);
+ RTC_DCHECK_RUN_ON(&sequence_checker_);
const size_t frame_number = last_inputed_frame_num_++;
// Get input frame and store for future quality calculation.
@@ -296,7 +296,7 @@
}
void VideoProcessor::SetRates(size_t bitrate_kbps, size_t framerate_fps) {
- RTC_DCHECK_CALLED_SEQUENTIALLY(&sequence_checker_);
+ RTC_DCHECK_RUN_ON(&sequence_checker_);
framerate_fps_ = static_cast<uint32_t>(framerate_fps);
bitrate_allocation_ = bitrate_allocator_->GetAllocation(
static_cast<uint32_t>(bitrate_kbps * 1000), framerate_fps_);
@@ -333,7 +333,7 @@
void VideoProcessor::FrameEncoded(
const webrtc::EncodedImage& encoded_image,
const webrtc::CodecSpecificInfo& codec_specific) {
- RTC_DCHECK_CALLED_SEQUENTIALLY(&sequence_checker_);
+ RTC_DCHECK_RUN_ON(&sequence_checker_);
// For the highest measurement accuracy of the encode time, the start/stop
// time recordings should wrap the Encode call as tightly as possible.
@@ -455,7 +455,7 @@
void VideoProcessor::FrameDecoded(const VideoFrame& decoded_frame,
size_t spatial_idx) {
- RTC_DCHECK_CALLED_SEQUENTIALLY(&sequence_checker_);
+ RTC_DCHECK_RUN_ON(&sequence_checker_);
// For the highest measurement accuracy of the decode time, the start/stop
// time recordings should wrap the Decode call as tightly as possible.
@@ -529,7 +529,7 @@
void VideoProcessor::DecodeFrame(const EncodedImage& encoded_image,
size_t spatial_idx) {
- RTC_DCHECK_CALLED_SEQUENTIALLY(&sequence_checker_);
+ RTC_DCHECK_RUN_ON(&sequence_checker_);
FrameStatistics* frame_stat =
stats_->GetFrameWithTimestamp(encoded_image.Timestamp(), spatial_idx);
diff --git a/modules/video_coding/codecs/test/videoprocessor.h b/modules/video_coding/codecs/test/videoprocessor.h
index 4935796..64f9c5c 100644
--- a/modules/video_coding/codecs/test/videoprocessor.h
+++ b/modules/video_coding/codecs/test/videoprocessor.h
@@ -36,7 +36,7 @@
#include "rtc_base/buffer.h"
#include "rtc_base/checks.h"
#include "rtc_base/constructor_magic.h"
-#include "rtc_base/sequenced_task_checker.h"
+#include "rtc_base/synchronization/sequence_checker.h"
#include "rtc_base/thread_annotations.h"
#include "rtc_base/thread_checker.h"
#include "test/testsupport/frame_reader.h"
@@ -250,7 +250,7 @@
int64_t post_encode_time_ns_ RTC_GUARDED_BY(sequence_checker_);
// This class must be operated on a TaskQueue.
- rtc::SequencedTaskChecker sequence_checker_;
+ SequenceChecker sequence_checker_;
RTC_DISALLOW_COPY_AND_ASSIGN(VideoProcessor);
};
diff --git a/modules/video_coding/loss_notification_controller.cc b/modules/video_coding/loss_notification_controller.cc
index 44cca34..3bab787 100644
--- a/modules/video_coding/loss_notification_controller.cc
+++ b/modules/video_coding/loss_notification_controller.cc
@@ -44,7 +44,7 @@
LossNotificationController::~LossNotificationController() = default;
void LossNotificationController::OnReceivedPacket(const VCMPacket& packet) {
- RTC_DCHECK_CALLED_SEQUENTIALLY(&sequenced_task_checker_);
+ RTC_DCHECK_RUN_ON(&sequence_checker_);
if (!packet.generic_descriptor) {
RTC_LOG(LS_WARNING) << "Generic frame descriptor missing. Buggy remote? "
@@ -116,7 +116,7 @@
uint16_t frame_id,
bool discardable,
rtc::ArrayView<const uint16_t> frame_dependency_diffs) {
- RTC_DCHECK_CALLED_SEQUENTIALLY(&sequenced_task_checker_);
+ RTC_DCHECK_RUN_ON(&sequence_checker_);
DiscardOldInformation(); // Prevent memory overconsumption.
@@ -144,7 +144,7 @@
bool LossNotificationController::AllDependenciesDecodable(
int64_t unwrapped_frame_id,
rtc::ArrayView<const uint16_t> frame_dependency_diffs) const {
- RTC_DCHECK_CALLED_SEQUENTIALLY(&sequenced_task_checker_);
+ RTC_DCHECK_RUN_ON(&sequence_checker_);
// Due to packet reordering, frame buffering and asynchronous decoders, it is
// infeasible to make reliable conclusions on the decodability of a frame
@@ -170,7 +170,7 @@
void LossNotificationController::HandleLoss(uint16_t last_received_seq_num,
bool decodability_flag) {
- RTC_DCHECK_CALLED_SEQUENTIALLY(&sequenced_task_checker_);
+ RTC_DCHECK_RUN_ON(&sequence_checker_);
if (last_decodable_non_discardable_) {
RTC_DCHECK(AheadOf(last_received_seq_num,
diff --git a/modules/video_coding/loss_notification_controller.h b/modules/video_coding/loss_notification_controller.h
index 4cdfbb8..09f4fef 100644
--- a/modules/video_coding/loss_notification_controller.h
+++ b/modules/video_coding/loss_notification_controller.h
@@ -17,7 +17,7 @@
#include "modules/include/module_common_types.h"
#include "modules/video_coding/packet.h"
#include "rtc_base/numerics/sequence_number_util.h"
-#include "rtc_base/sequenced_task_checker.h"
+#include "rtc_base/synchronization/sequence_checker.h"
namespace webrtc {
@@ -61,26 +61,25 @@
void HandleLoss(uint16_t last_received_seq_num, bool decodability_flag);
KeyFrameRequestSender* const key_frame_request_sender_
- RTC_GUARDED_BY(sequenced_task_checker_);
+ RTC_GUARDED_BY(sequence_checker_);
LossNotificationSender* const loss_notification_sender_
- RTC_GUARDED_BY(sequenced_task_checker_);
+ RTC_GUARDED_BY(sequence_checker_);
SeqNumUnwrapper<uint16_t> frame_id_unwrapper_
- RTC_GUARDED_BY(sequenced_task_checker_);
+ RTC_GUARDED_BY(sequence_checker_);
// Tracked to avoid processing repeated frames (buggy/malicious remote).
absl::optional<int64_t> last_received_unwrapped_frame_id_
- RTC_GUARDED_BY(sequenced_task_checker_);
+ RTC_GUARDED_BY(sequence_checker_);
// Tracked to avoid processing repeated packets.
absl::optional<uint16_t> last_received_seq_num_
- RTC_GUARDED_BY(sequenced_task_checker_);
+ RTC_GUARDED_BY(sequence_checker_);
// Tracked in order to correctly report the potential-decodability of
// multi-packet frames.
- bool current_frame_potentially_decodable_
- RTC_GUARDED_BY(sequenced_task_checker_);
+ bool current_frame_potentially_decodable_ RTC_GUARDED_BY(sequence_checker_);
// Loss notifications contain the sequence number of the first packet of
// the last decodable-and-non-discardable frame. Since this is a bit of
@@ -92,15 +91,15 @@
uint16_t first_seq_num;
};
absl::optional<FrameInfo> last_decodable_non_discardable_
- RTC_GUARDED_BY(sequenced_task_checker_);
+ RTC_GUARDED_BY(sequence_checker_);
// Track which frames are decodable. Later frames are also decodable if
// all of their dependencies can be found in this container.
// (Naturally, later frames must also be assemblable to be decodable.)
std::set<int64_t> decodable_unwrapped_frame_ids_
- RTC_GUARDED_BY(sequenced_task_checker_);
+ RTC_GUARDED_BY(sequence_checker_);
- rtc::SequencedTaskChecker sequenced_task_checker_;
+ SequenceChecker sequence_checker_;
};
} // namespace webrtc
diff --git a/modules/video_coding/utility/quality_scaler.cc b/modules/video_coding/utility/quality_scaler.cc
index 4f4bb3b..54ef76a 100644
--- a/modules/video_coding/utility/quality_scaler.cc
+++ b/modules/video_coding/utility/quality_scaler.cc
@@ -88,7 +88,7 @@
framedrop_percent_all_(5 * 30),
experiment_enabled_(QualityScalingExperiment::Enabled()),
observed_enough_frames_(false) {
- RTC_DCHECK_CALLED_SEQUENTIALLY(&task_checker_);
+ RTC_DCHECK_RUN_ON(&task_checker_);
if (experiment_enabled_) {
config_ = QualityScalingExperiment::GetConfig();
qp_smoother_high_.reset(new QpSmoother(config_.alpha_high));
@@ -105,12 +105,12 @@
}
QualityScaler::~QualityScaler() {
- RTC_DCHECK_CALLED_SEQUENTIALLY(&task_checker_);
+ RTC_DCHECK_RUN_ON(&task_checker_);
check_qp_task_.Stop();
}
int64_t QualityScaler::GetSamplingPeriodMs() const {
- RTC_DCHECK_CALLED_SEQUENTIALLY(&task_checker_);
+ RTC_DCHECK_RUN_ON(&task_checker_);
if (fast_rampup_) {
return sampling_period_ms_;
}
@@ -122,18 +122,18 @@
}
void QualityScaler::ReportDroppedFrameByMediaOpt() {
- RTC_DCHECK_CALLED_SEQUENTIALLY(&task_checker_);
+ RTC_DCHECK_RUN_ON(&task_checker_);
framedrop_percent_media_opt_.AddSample(100);
framedrop_percent_all_.AddSample(100);
}
void QualityScaler::ReportDroppedFrameByEncoder() {
- RTC_DCHECK_CALLED_SEQUENTIALLY(&task_checker_);
+ RTC_DCHECK_RUN_ON(&task_checker_);
framedrop_percent_all_.AddSample(100);
}
void QualityScaler::ReportQp(int qp, int64_t time_sent_us) {
- RTC_DCHECK_CALLED_SEQUENTIALLY(&task_checker_);
+ RTC_DCHECK_RUN_ON(&task_checker_);
framedrop_percent_media_opt_.AddSample(0);
framedrop_percent_all_.AddSample(0);
average_qp_.AddSample(qp);
@@ -144,7 +144,7 @@
}
void QualityScaler::CheckQp() {
- RTC_DCHECK_CALLED_SEQUENTIALLY(&task_checker_);
+ RTC_DCHECK_RUN_ON(&task_checker_);
// Should be set through InitEncode -> Should be set by now.
RTC_DCHECK_GE(thresholds_.low, 0);
@@ -193,13 +193,13 @@
}
void QualityScaler::ReportQpLow() {
- RTC_DCHECK_CALLED_SEQUENTIALLY(&task_checker_);
+ RTC_DCHECK_RUN_ON(&task_checker_);
ClearSamples();
observer_->AdaptUp(AdaptationObserverInterface::AdaptReason::kQuality);
}
void QualityScaler::ReportQpHigh() {
- RTC_DCHECK_CALLED_SEQUENTIALLY(&task_checker_);
+ RTC_DCHECK_RUN_ON(&task_checker_);
ClearSamples();
observer_->AdaptDown(AdaptationObserverInterface::AdaptReason::kQuality);
// If we've scaled down, wait longer before scaling up again.
@@ -209,7 +209,7 @@
}
void QualityScaler::ClearSamples() {
- RTC_DCHECK_CALLED_SEQUENTIALLY(&task_checker_);
+ RTC_DCHECK_RUN_ON(&task_checker_);
framedrop_percent_media_opt_.Reset();
framedrop_percent_all_.Reset();
average_qp_.Reset();
diff --git a/modules/video_coding/utility/quality_scaler.h b/modules/video_coding/utility/quality_scaler.h
index 5e7ee0d..500d931 100644
--- a/modules/video_coding/utility/quality_scaler.h
+++ b/modules/video_coding/utility/quality_scaler.h
@@ -18,7 +18,7 @@
#include "api/video_codecs/video_encoder.h"
#include "rtc_base/experiments/quality_scaling_experiment.h"
#include "rtc_base/numerics/moving_average.h"
-#include "rtc_base/sequenced_task_checker.h"
+#include "rtc_base/synchronization/sequence_checker.h"
#include "rtc_base/task_queue.h"
#include "rtc_base/task_utils/repeating_task.h"
@@ -77,7 +77,7 @@
RepeatingTaskHandle check_qp_task_ RTC_GUARDED_BY(&task_checker_);
AdaptationObserverInterface* const observer_ RTC_GUARDED_BY(&task_checker_);
- rtc::SequencedTaskChecker task_checker_;
+ SequenceChecker task_checker_;
const VideoEncoder::QpThresholds thresholds_;
const int64_t sampling_period_ms_;
diff --git a/modules/video_coding/video_coding_impl.h b/modules/video_coding/video_coding_impl.h
index e077633..4d83047 100644
--- a/modules/video_coding/video_coding_impl.h
+++ b/modules/video_coding/video_coding_impl.h
@@ -25,7 +25,7 @@
#include "modules/video_coding/receiver.h"
#include "modules/video_coding/timing.h"
#include "rtc_base/one_time_event.h"
-#include "rtc_base/sequenced_task_checker.h"
+#include "rtc_base/synchronization/sequence_checker.h"
#include "rtc_base/thread_annotations.h"
#include "rtc_base/thread_checker.h"
#include "system_wrappers/include/clock.h"