Project import generated by Copybara.
GitOrigin-RevId: 852dfb05d450167899c0dd5ef7c45622a12e865b
This commit is contained in:
committed by
Hadon Nash
parent
d144e564d8
commit
de4fbc10e6
@@ -67,7 +67,7 @@ class FixedSizeInputStreamHandler : public DefaultInputStreamHandler {
|
||||
|
||||
private:
|
||||
// Drops packets if all input streams exceed trigger_queue_size.
|
||||
void EraseAllSurplus() EXCLUSIVE_LOCKS_REQUIRED(erase_mutex_) {
|
||||
void EraseAllSurplus() ABSL_EXCLUSIVE_LOCKS_REQUIRED(erase_mutex_) {
|
||||
Timestamp min_timestamp_all_streams = Timestamp::Max();
|
||||
for (const auto& stream : input_stream_managers_) {
|
||||
// Check whether every InputStreamImpl grew beyond trigger_queue_size.
|
||||
@@ -127,7 +127,8 @@ class FixedSizeInputStreamHandler : public DefaultInputStreamHandler {
|
||||
// Keeps only the most recent target_queue_size packets in each stream
|
||||
// exceeding trigger_queue_size. Also, discards all packets older than the
|
||||
// first kept timestamp on any stream.
|
||||
void EraseAnySurplus(bool keep_one) EXCLUSIVE_LOCKS_REQUIRED(erase_mutex_) {
|
||||
void EraseAnySurplus(bool keep_one)
|
||||
ABSL_EXCLUSIVE_LOCKS_REQUIRED(erase_mutex_) {
|
||||
// Record the most recent first kept timestamp on any stream.
|
||||
for (const auto& stream : input_stream_managers_) {
|
||||
int32 queue_size = (stream->QueueSize() >= trigger_queue_size_)
|
||||
@@ -151,7 +152,7 @@ class FixedSizeInputStreamHandler : public DefaultInputStreamHandler {
|
||||
}
|
||||
|
||||
void EraseSurplusPackets(bool keep_one)
|
||||
EXCLUSIVE_LOCKS_REQUIRED(erase_mutex_) {
|
||||
ABSL_EXCLUSIVE_LOCKS_REQUIRED(erase_mutex_) {
|
||||
return (fixed_min_size_) ? EraseAllSurplus() : EraseAnySurplus(keep_one);
|
||||
}
|
||||
|
||||
@@ -218,9 +219,9 @@ class FixedSizeInputStreamHandler : public DefaultInputStreamHandler {
|
||||
bool fixed_min_size_;
|
||||
// Indicates that GetNodeReadiness has returned kReadyForProcess once, and
|
||||
// the corresponding call to FillInputSet has not yet completed.
|
||||
bool pending_ GUARDED_BY(erase_mutex_);
|
||||
bool pending_ ABSL_GUARDED_BY(erase_mutex_);
|
||||
// The timestamp used to truncate all input streams.
|
||||
Timestamp kept_timestamp_ GUARDED_BY(erase_mutex_);
|
||||
Timestamp kept_timestamp_ ABSL_GUARDED_BY(erase_mutex_);
|
||||
absl::Mutex erase_mutex_;
|
||||
};
|
||||
|
||||
|
||||
@@ -35,13 +35,13 @@ const int64 kSlowCalculatorRate = 10;
|
||||
|
||||
// Rate limiter for TestSlowCalculator.
|
||||
ABSL_CONST_INIT absl::Mutex g_source_mutex(absl::kConstInit);
|
||||
int64 g_source_counter GUARDED_BY(g_source_mutex);
|
||||
int64 g_source_counter ABSL_GUARDED_BY(g_source_mutex);
|
||||
|
||||
// Rate limiter for TestSourceCalculator.
|
||||
int64 g_slow_counter GUARDED_BY(g_source_mutex);
|
||||
int64 g_slow_counter ABSL_GUARDED_BY(g_source_mutex);
|
||||
|
||||
// Flag that indicates that the source is done.
|
||||
bool g_source_done GUARDED_BY(g_source_mutex);
|
||||
bool g_source_done ABSL_GUARDED_BY(g_source_mutex);
|
||||
|
||||
class TestSourceCalculator : public CalculatorBase {
|
||||
public:
|
||||
@@ -74,7 +74,7 @@ class TestSourceCalculator : public CalculatorBase {
|
||||
}
|
||||
|
||||
private:
|
||||
bool CanProceed() const EXCLUSIVE_LOCKS_REQUIRED(g_source_mutex) {
|
||||
bool CanProceed() const ABSL_EXCLUSIVE_LOCKS_REQUIRED(g_source_mutex) {
|
||||
return g_source_counter <= kSlowCalculatorRate * g_slow_counter ||
|
||||
g_source_counter <= 1;
|
||||
}
|
||||
@@ -109,7 +109,7 @@ class TestSlowCalculator : public CalculatorBase {
|
||||
}
|
||||
|
||||
private:
|
||||
bool CanProceed() const EXCLUSIVE_LOCKS_REQUIRED(g_source_mutex) {
|
||||
bool CanProceed() const ABSL_EXCLUSIVE_LOCKS_REQUIRED(g_source_mutex) {
|
||||
return g_source_counter > kSlowCalculatorRate * g_slow_counter ||
|
||||
g_source_done;
|
||||
}
|
||||
|
||||
@@ -40,15 +40,15 @@ class InOrderOutputStreamHandler : public OutputStreamHandler {
|
||||
options, calculator_run_in_parallel) {}
|
||||
|
||||
private:
|
||||
void PropagationLoop() EXCLUSIVE_LOCKS_REQUIRED(timestamp_mutex_) final;
|
||||
void PropagationLoop() ABSL_EXCLUSIVE_LOCKS_REQUIRED(timestamp_mutex_) final;
|
||||
|
||||
void PropagatePackets(CalculatorContext** calculator_context,
|
||||
Timestamp* context_timestamp)
|
||||
EXCLUSIVE_LOCKS_REQUIRED(timestamp_mutex_);
|
||||
ABSL_EXCLUSIVE_LOCKS_REQUIRED(timestamp_mutex_);
|
||||
|
||||
void PropagationBound(CalculatorContext** calculator_context,
|
||||
Timestamp* context_timestamp)
|
||||
EXCLUSIVE_LOCKS_REQUIRED(timestamp_mutex_);
|
||||
ABSL_EXCLUSIVE_LOCKS_REQUIRED(timestamp_mutex_);
|
||||
};
|
||||
} // namespace mediapipe
|
||||
|
||||
|
||||
@@ -64,18 +64,18 @@ class SyncSetInputStreamHandler : public InputStreamHandler {
|
||||
// Populates timestamp bounds for streams outside the ready sync-set.
|
||||
void FillInputBounds(Timestamp input_timestamp,
|
||||
InputStreamShardSet* input_set)
|
||||
EXCLUSIVE_LOCKS_REQUIRED(mutex_);
|
||||
ABSL_EXCLUSIVE_LOCKS_REQUIRED(mutex_);
|
||||
|
||||
private:
|
||||
absl::Mutex mutex_;
|
||||
// The ids of each set of inputs.
|
||||
std::vector<std::vector<CollectionItemId>> sync_sets_ GUARDED_BY(mutex_);
|
||||
std::vector<std::vector<CollectionItemId>> sync_sets_ ABSL_GUARDED_BY(mutex_);
|
||||
// The index of the ready sync set. A value of -1 indicates that no
|
||||
// sync sets are ready.
|
||||
int ready_sync_set_index_ GUARDED_BY(mutex_) = -1;
|
||||
int ready_sync_set_index_ ABSL_GUARDED_BY(mutex_) = -1;
|
||||
// The timestamp at which the sync set is ready. If no sync set is
|
||||
// ready then this variable should be Timestamp::Done() .
|
||||
Timestamp ready_timestamp_ GUARDED_BY(mutex_);
|
||||
Timestamp ready_timestamp_ ABSL_GUARDED_BY(mutex_);
|
||||
};
|
||||
|
||||
REGISTER_INPUT_STREAM_HANDLER(SyncSetInputStreamHandler);
|
||||
|
||||
@@ -79,7 +79,7 @@ class TimestampAlignInputStreamHandler : public InputStreamHandler {
|
||||
CollectionItemId timestamp_base_stream_id_;
|
||||
|
||||
absl::Mutex mutex_;
|
||||
bool offsets_initialized_ GUARDED_BY(mutex_) = false;
|
||||
bool offsets_initialized_ ABSL_GUARDED_BY(mutex_) = false;
|
||||
std::vector<TimestampDiff> timestamp_offsets_;
|
||||
};
|
||||
REGISTER_INPUT_STREAM_HANDLER(TimestampAlignInputStreamHandler);
|
||||
|
||||
Reference in New Issue
Block a user