Delete macro RTC_ACCESS_ON, replaced by RTC_GUARDED_BY.
Both macros do the same thing, as wrappers for __attribute__((guarded_by)), and more names for the same thing doesn't add to clarity. Bug: none Change-Id: Iaaf7b21dbf3345ee90fee22c39b636823d195eb0 Reviewed-on: https://webrtc-review.googlesource.com/48361 Commit-Queue: Niels Moller <nisse@webrtc.org> Reviewed-by: Tommi <tommi@webrtc.org> Reviewed-by: Karl Wiberg <kwiberg@webrtc.org> Cr-Commit-Position: refs/heads/master@{#21929}
This commit is contained in:
@ -337,7 +337,7 @@ class StatsReport {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
rtc::ThreadChecker thread_checker_;
|
rtc::ThreadChecker thread_checker_;
|
||||||
mutable int ref_count_ RTC_ACCESS_ON(thread_checker_) = 0;
|
mutable int ref_count_ RTC_GUARDED_BY(thread_checker_) = 0;
|
||||||
|
|
||||||
const Type type_;
|
const Type type_;
|
||||||
// TODO(tommi): Use C++ 11 union and make value_ const.
|
// TODO(tommi): Use C++ 11 union and make value_ const.
|
||||||
|
@ -103,7 +103,7 @@ class AudioReceiveStream final : public webrtc::AudioReceiveStream,
|
|||||||
std::unique_ptr<voe::ChannelProxy> channel_proxy_;
|
std::unique_ptr<voe::ChannelProxy> channel_proxy_;
|
||||||
AudioSendStream* associated_send_stream_ = nullptr;
|
AudioSendStream* associated_send_stream_ = nullptr;
|
||||||
|
|
||||||
bool playing_ RTC_ACCESS_ON(worker_thread_checker_) = false;
|
bool playing_ RTC_GUARDED_BY(worker_thread_checker_) = false;
|
||||||
|
|
||||||
std::unique_ptr<RtpStreamReceiverInterface> rtp_stream_receiver_;
|
std::unique_ptr<RtpStreamReceiverInterface> rtp_stream_receiver_;
|
||||||
|
|
||||||
|
@ -353,7 +353,7 @@ class Channel
|
|||||||
std::unique_ptr<AudioCodingModule> audio_coding_;
|
std::unique_ptr<AudioCodingModule> audio_coding_;
|
||||||
AudioSinkInterface* audio_sink_ = nullptr;
|
AudioSinkInterface* audio_sink_ = nullptr;
|
||||||
AudioLevel _outputAudioLevel;
|
AudioLevel _outputAudioLevel;
|
||||||
uint32_t _timeStamp RTC_ACCESS_ON(encoder_queue_);
|
uint32_t _timeStamp RTC_GUARDED_BY(encoder_queue_);
|
||||||
|
|
||||||
RemoteNtpTimeEstimator ntp_estimator_ RTC_GUARDED_BY(ts_stats_lock_);
|
RemoteNtpTimeEstimator ntp_estimator_ RTC_GUARDED_BY(ts_stats_lock_);
|
||||||
|
|
||||||
@ -378,9 +378,9 @@ class Channel
|
|||||||
ProcessThread* _moduleProcessThreadPtr;
|
ProcessThread* _moduleProcessThreadPtr;
|
||||||
AudioDeviceModule* _audioDeviceModulePtr;
|
AudioDeviceModule* _audioDeviceModulePtr;
|
||||||
Transport* _transportPtr; // WebRtc socket or external transport
|
Transport* _transportPtr; // WebRtc socket or external transport
|
||||||
RmsLevel rms_level_ RTC_ACCESS_ON(encoder_queue_);
|
RmsLevel rms_level_ RTC_GUARDED_BY(encoder_queue_);
|
||||||
bool input_mute_ RTC_GUARDED_BY(volume_settings_critsect_);
|
bool input_mute_ RTC_GUARDED_BY(volume_settings_critsect_);
|
||||||
bool previous_frame_muted_ RTC_ACCESS_ON(encoder_queue_);
|
bool previous_frame_muted_ RTC_GUARDED_BY(encoder_queue_);
|
||||||
float _outputGain RTC_GUARDED_BY(volume_settings_critsect_);
|
float _outputGain RTC_GUARDED_BY(volume_settings_critsect_);
|
||||||
// VoeRTP_RTCP
|
// VoeRTP_RTCP
|
||||||
// TODO(henrika): can today be accessed on the main thread and on the
|
// TODO(henrika): can today be accessed on the main thread and on the
|
||||||
|
@ -113,21 +113,22 @@ class RtcEventLogImpl final : public RtcEventLog {
|
|||||||
|
|
||||||
// History containing all past configuration events.
|
// History containing all past configuration events.
|
||||||
std::deque<std::unique_ptr<RtcEvent>> config_history_
|
std::deque<std::unique_ptr<RtcEvent>> config_history_
|
||||||
RTC_ACCESS_ON(task_queue_);
|
RTC_GUARDED_BY(task_queue_);
|
||||||
|
|
||||||
// History containing the most recent (non-configuration) events (~10s).
|
// History containing the most recent (non-configuration) events (~10s).
|
||||||
std::deque<std::unique_ptr<RtcEvent>> history_ RTC_ACCESS_ON(task_queue_);
|
std::deque<std::unique_ptr<RtcEvent>> history_ RTC_GUARDED_BY(task_queue_);
|
||||||
|
|
||||||
size_t max_size_bytes_ RTC_ACCESS_ON(task_queue_);
|
size_t max_size_bytes_ RTC_GUARDED_BY(task_queue_);
|
||||||
size_t written_bytes_ RTC_ACCESS_ON(task_queue_);
|
size_t written_bytes_ RTC_GUARDED_BY(task_queue_);
|
||||||
|
|
||||||
std::unique_ptr<RtcEventLogEncoder> event_encoder_ RTC_ACCESS_ON(task_queue_);
|
std::unique_ptr<RtcEventLogEncoder> event_encoder_
|
||||||
std::unique_ptr<RtcEventLogOutput> event_output_ RTC_ACCESS_ON(task_queue_);
|
RTC_GUARDED_BY(task_queue_);
|
||||||
|
std::unique_ptr<RtcEventLogOutput> event_output_ RTC_GUARDED_BY(task_queue_);
|
||||||
|
|
||||||
size_t num_config_events_written_ RTC_ACCESS_ON(task_queue_);
|
size_t num_config_events_written_ RTC_GUARDED_BY(task_queue_);
|
||||||
int64_t output_period_ms_ RTC_ACCESS_ON(task_queue_);
|
int64_t output_period_ms_ RTC_GUARDED_BY(task_queue_);
|
||||||
int64_t last_output_ms_ RTC_ACCESS_ON(task_queue_);
|
int64_t last_output_ms_ RTC_GUARDED_BY(task_queue_);
|
||||||
bool output_scheduled_ RTC_ACCESS_ON(task_queue_);
|
bool output_scheduled_ RTC_GUARDED_BY(task_queue_);
|
||||||
|
|
||||||
// Since we are posting tasks bound to |this|, it is critical that the event
|
// Since we are posting tasks bound to |this|, it is critical that the event
|
||||||
// log and it's members outlive the |task_queue_|. Keep the "task_queue_|
|
// log and it's members outlive the |task_queue_|. Keep the "task_queue_|
|
||||||
|
@ -331,33 +331,33 @@ class WebRtcVideoChannel : public VideoMediaChannel, public webrtc::Transport {
|
|||||||
rtc::ThreadChecker thread_checker_;
|
rtc::ThreadChecker thread_checker_;
|
||||||
rtc::AsyncInvoker invoker_;
|
rtc::AsyncInvoker invoker_;
|
||||||
rtc::Thread* worker_thread_;
|
rtc::Thread* worker_thread_;
|
||||||
const std::vector<uint32_t> ssrcs_ RTC_ACCESS_ON(&thread_checker_);
|
const std::vector<uint32_t> ssrcs_ RTC_GUARDED_BY(&thread_checker_);
|
||||||
const std::vector<SsrcGroup> ssrc_groups_ RTC_ACCESS_ON(&thread_checker_);
|
const std::vector<SsrcGroup> ssrc_groups_ RTC_GUARDED_BY(&thread_checker_);
|
||||||
webrtc::Call* const call_;
|
webrtc::Call* const call_;
|
||||||
const bool enable_cpu_overuse_detection_;
|
const bool enable_cpu_overuse_detection_;
|
||||||
rtc::VideoSourceInterface<webrtc::VideoFrame>* source_
|
rtc::VideoSourceInterface<webrtc::VideoFrame>* source_
|
||||||
RTC_ACCESS_ON(&thread_checker_);
|
RTC_GUARDED_BY(&thread_checker_);
|
||||||
webrtc::VideoEncoderFactory* const encoder_factory_
|
webrtc::VideoEncoderFactory* const encoder_factory_
|
||||||
RTC_ACCESS_ON(&thread_checker_);
|
RTC_GUARDED_BY(&thread_checker_);
|
||||||
|
|
||||||
webrtc::VideoSendStream* stream_ RTC_ACCESS_ON(&thread_checker_);
|
webrtc::VideoSendStream* stream_ RTC_GUARDED_BY(&thread_checker_);
|
||||||
rtc::VideoSinkInterface<webrtc::VideoFrame>* encoder_sink_
|
rtc::VideoSinkInterface<webrtc::VideoFrame>* encoder_sink_
|
||||||
RTC_ACCESS_ON(&thread_checker_);
|
RTC_GUARDED_BY(&thread_checker_);
|
||||||
// Contains settings that are the same for all streams in the MediaChannel,
|
// Contains settings that are the same for all streams in the MediaChannel,
|
||||||
// such as codecs, header extensions, and the global bitrate limit for the
|
// such as codecs, header extensions, and the global bitrate limit for the
|
||||||
// entire channel.
|
// entire channel.
|
||||||
VideoSendStreamParameters parameters_ RTC_ACCESS_ON(&thread_checker_);
|
VideoSendStreamParameters parameters_ RTC_GUARDED_BY(&thread_checker_);
|
||||||
// Contains settings that are unique for each stream, such as max_bitrate.
|
// Contains settings that are unique for each stream, such as max_bitrate.
|
||||||
// Does *not* contain codecs, however.
|
// Does *not* contain codecs, however.
|
||||||
// TODO(skvlad): Move ssrcs_ and ssrc_groups_ into rtp_parameters_.
|
// TODO(skvlad): Move ssrcs_ and ssrc_groups_ into rtp_parameters_.
|
||||||
// TODO(skvlad): Combine parameters_ and rtp_parameters_ once we have only
|
// TODO(skvlad): Combine parameters_ and rtp_parameters_ once we have only
|
||||||
// one stream per MediaChannel.
|
// one stream per MediaChannel.
|
||||||
webrtc::RtpParameters rtp_parameters_ RTC_ACCESS_ON(&thread_checker_);
|
webrtc::RtpParameters rtp_parameters_ RTC_GUARDED_BY(&thread_checker_);
|
||||||
std::unique_ptr<webrtc::VideoEncoder> allocated_encoder_
|
std::unique_ptr<webrtc::VideoEncoder> allocated_encoder_
|
||||||
RTC_ACCESS_ON(&thread_checker_);
|
RTC_GUARDED_BY(&thread_checker_);
|
||||||
VideoCodec allocated_codec_ RTC_ACCESS_ON(&thread_checker_);
|
VideoCodec allocated_codec_ RTC_GUARDED_BY(&thread_checker_);
|
||||||
|
|
||||||
bool sending_ RTC_ACCESS_ON(&thread_checker_);
|
bool sending_ RTC_GUARDED_BY(&thread_checker_);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Wrapper for the receiver part, contains configs etc. that are needed to
|
// Wrapper for the receiver part, contains configs etc. that are needed to
|
||||||
|
@ -182,46 +182,46 @@ class AudioDeviceBuffer {
|
|||||||
// Keeps track of if playout/recording are active or not. A combination
|
// Keeps track of if playout/recording are active or not. A combination
|
||||||
// of these states are used to determine when to start and stop the timer.
|
// of these states are used to determine when to start and stop the timer.
|
||||||
// Only used on the creating thread and not used to control any media flow.
|
// Only used on the creating thread and not used to control any media flow.
|
||||||
bool playing_ RTC_ACCESS_ON(main_thread_checker_);
|
bool playing_ RTC_GUARDED_BY(main_thread_checker_);
|
||||||
bool recording_ RTC_ACCESS_ON(main_thread_checker_);
|
bool recording_ RTC_GUARDED_BY(main_thread_checker_);
|
||||||
|
|
||||||
// Buffer used for audio samples to be played out. Size can be changed
|
// Buffer used for audio samples to be played out. Size can be changed
|
||||||
// dynamically. The 16-bit samples are interleaved, hence the size is
|
// dynamically. The 16-bit samples are interleaved, hence the size is
|
||||||
// proportional to the number of channels.
|
// proportional to the number of channels.
|
||||||
rtc::BufferT<int16_t> play_buffer_ RTC_ACCESS_ON(playout_thread_checker_);
|
rtc::BufferT<int16_t> play_buffer_ RTC_GUARDED_BY(playout_thread_checker_);
|
||||||
|
|
||||||
// Byte buffer used for recorded audio samples. Size can be changed
|
// Byte buffer used for recorded audio samples. Size can be changed
|
||||||
// dynamically.
|
// dynamically.
|
||||||
rtc::BufferT<int16_t> rec_buffer_ RTC_ACCESS_ON(recording_thread_checker_);
|
rtc::BufferT<int16_t> rec_buffer_ RTC_GUARDED_BY(recording_thread_checker_);
|
||||||
|
|
||||||
// Contains true of a key-press has been detected.
|
// Contains true of a key-press has been detected.
|
||||||
bool typing_status_ RTC_ACCESS_ON(recording_thread_checker_);
|
bool typing_status_ RTC_GUARDED_BY(recording_thread_checker_);
|
||||||
|
|
||||||
// Delay values used by the AEC.
|
// Delay values used by the AEC.
|
||||||
int play_delay_ms_ RTC_ACCESS_ON(recording_thread_checker_);
|
int play_delay_ms_ RTC_GUARDED_BY(recording_thread_checker_);
|
||||||
int rec_delay_ms_ RTC_ACCESS_ON(recording_thread_checker_);
|
int rec_delay_ms_ RTC_GUARDED_BY(recording_thread_checker_);
|
||||||
|
|
||||||
// Counts number of times LogStats() has been called.
|
// Counts number of times LogStats() has been called.
|
||||||
size_t num_stat_reports_ RTC_ACCESS_ON(task_queue_);
|
size_t num_stat_reports_ RTC_GUARDED_BY(task_queue_);
|
||||||
|
|
||||||
// Time stamp of last timer task (drives logging).
|
// Time stamp of last timer task (drives logging).
|
||||||
int64_t last_timer_task_time_ RTC_ACCESS_ON(task_queue_);
|
int64_t last_timer_task_time_ RTC_GUARDED_BY(task_queue_);
|
||||||
|
|
||||||
// Counts number of audio callbacks modulo 50 to create a signal when
|
// Counts number of audio callbacks modulo 50 to create a signal when
|
||||||
// a new storage of audio stats shall be done.
|
// a new storage of audio stats shall be done.
|
||||||
int16_t rec_stat_count_ RTC_ACCESS_ON(recording_thread_checker_);
|
int16_t rec_stat_count_ RTC_GUARDED_BY(recording_thread_checker_);
|
||||||
int16_t play_stat_count_ RTC_ACCESS_ON(playout_thread_checker_);
|
int16_t play_stat_count_ RTC_GUARDED_BY(playout_thread_checker_);
|
||||||
|
|
||||||
// Time stamps of when playout and recording starts.
|
// Time stamps of when playout and recording starts.
|
||||||
int64_t play_start_time_ RTC_ACCESS_ON(main_thread_checker_);
|
int64_t play_start_time_ RTC_GUARDED_BY(main_thread_checker_);
|
||||||
int64_t rec_start_time_ RTC_ACCESS_ON(main_thread_checker_);
|
int64_t rec_start_time_ RTC_GUARDED_BY(main_thread_checker_);
|
||||||
|
|
||||||
// Contains counters for playout and recording statistics.
|
// Contains counters for playout and recording statistics.
|
||||||
Stats stats_ RTC_GUARDED_BY(lock_);
|
Stats stats_ RTC_GUARDED_BY(lock_);
|
||||||
|
|
||||||
// Stores current stats at each timer task. Used to calculate differences
|
// Stores current stats at each timer task. Used to calculate differences
|
||||||
// between two successive timer events.
|
// between two successive timer events.
|
||||||
Stats last_stats_ RTC_ACCESS_ON(task_queue_);
|
Stats last_stats_ RTC_GUARDED_BY(task_queue_);
|
||||||
|
|
||||||
// Set to true at construction and modified to false as soon as one audio-
|
// Set to true at construction and modified to false as soon as one audio-
|
||||||
// level estimate larger than zero is detected.
|
// level estimate larger than zero is detected.
|
||||||
@ -231,12 +231,12 @@ class AudioDeviceBuffer {
|
|||||||
// StartPeriodicLogging() and set to false by StopPeriodicLogging().
|
// StartPeriodicLogging() and set to false by StopPeriodicLogging().
|
||||||
// Setting this member to false prevents (possiby invalid) log messages from
|
// Setting this member to false prevents (possiby invalid) log messages from
|
||||||
// being printed in the LogStats() task.
|
// being printed in the LogStats() task.
|
||||||
bool log_stats_ RTC_ACCESS_ON(task_queue_);
|
bool log_stats_ RTC_GUARDED_BY(task_queue_);
|
||||||
|
|
||||||
// Should *never* be defined in production builds. Only used for testing.
|
// Should *never* be defined in production builds. Only used for testing.
|
||||||
// When defined, the output signal will be replaced by a sinus tone at 440Hz.
|
// When defined, the output signal will be replaced by a sinus tone at 440Hz.
|
||||||
#ifdef AUDIO_DEVICE_PLAYS_SINUS_TONE
|
#ifdef AUDIO_DEVICE_PLAYS_SINUS_TONE
|
||||||
double phase_ RTC_ACCESS_ON(playout_thread_checker_);
|
double phase_ RTC_GUARDED_BY(playout_thread_checker_);
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -295,8 +295,8 @@ class LatencyAudioStream : public AudioStream {
|
|||||||
|
|
||||||
rtc::Optional<int64_t> pulse_time_ RTC_GUARDED_BY(lock_);
|
rtc::Optional<int64_t> pulse_time_ RTC_GUARDED_BY(lock_);
|
||||||
std::vector<int> latencies_ RTC_GUARDED_BY(race_checker_);
|
std::vector<int> latencies_ RTC_GUARDED_BY(race_checker_);
|
||||||
size_t read_count_ RTC_ACCESS_ON(read_thread_checker_) = 0;
|
size_t read_count_ RTC_GUARDED_BY(read_thread_checker_) = 0;
|
||||||
size_t write_count_ RTC_ACCESS_ON(write_thread_checker_) = 0;
|
size_t write_count_ RTC_GUARDED_BY(write_thread_checker_) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Mocks the AudioTransport object and proxies actions for the two callbacks
|
// Mocks the AudioTransport object and proxies actions for the two callbacks
|
||||||
|
@ -255,7 +255,7 @@ class AudioDeviceIOS : public AudioDeviceGeneric,
|
|||||||
volatile int playing_;
|
volatile int playing_;
|
||||||
|
|
||||||
// Set to true after successful call to Init(), false otherwise.
|
// Set to true after successful call to Init(), false otherwise.
|
||||||
bool initialized_ RTC_ACCESS_ON(thread_checker_);
|
bool initialized_ RTC_GUARDED_BY(thread_checker_);
|
||||||
|
|
||||||
// Set to true after successful call to InitRecording() or InitPlayout(),
|
// Set to true after successful call to InitRecording() or InitPlayout(),
|
||||||
// false otherwise.
|
// false otherwise.
|
||||||
@ -266,14 +266,14 @@ class AudioDeviceIOS : public AudioDeviceGeneric,
|
|||||||
|
|
||||||
// Audio interruption observer instance.
|
// Audio interruption observer instance.
|
||||||
RTCAudioSessionDelegateAdapter* audio_session_observer_
|
RTCAudioSessionDelegateAdapter* audio_session_observer_
|
||||||
RTC_ACCESS_ON(thread_checker_);
|
RTC_GUARDED_BY(thread_checker_);
|
||||||
|
|
||||||
// Set to true if we've activated the audio session.
|
// Set to true if we've activated the audio session.
|
||||||
bool has_configured_session_ RTC_ACCESS_ON(thread_checker_);
|
bool has_configured_session_ RTC_GUARDED_BY(thread_checker_);
|
||||||
|
|
||||||
// Counts number of detected audio glitches on the playout side.
|
// Counts number of detected audio glitches on the playout side.
|
||||||
int64_t num_detected_playout_glitches_ RTC_ACCESS_ON(thread_checker_);
|
int64_t num_detected_playout_glitches_ RTC_GUARDED_BY(thread_checker_);
|
||||||
int64_t last_playout_time_ RTC_ACCESS_ON(io_thread_checker_);
|
int64_t last_playout_time_ RTC_GUARDED_BY(io_thread_checker_);
|
||||||
|
|
||||||
// Counts number of playout callbacks per call.
|
// Counts number of playout callbacks per call.
|
||||||
// The value isupdated on the native I/O thread and later read on the
|
// The value isupdated on the native I/O thread and later read on the
|
||||||
@ -282,7 +282,7 @@ class AudioDeviceIOS : public AudioDeviceGeneric,
|
|||||||
int64_t num_playout_callbacks_;
|
int64_t num_playout_callbacks_;
|
||||||
|
|
||||||
// Contains the time for when the last output volume change was detected.
|
// Contains the time for when the last output volume change was detected.
|
||||||
int64_t last_output_volume_change_time_ RTC_ACCESS_ON(thread_checker_);
|
int64_t last_output_volume_change_time_ RTC_GUARDED_BY(thread_checker_);
|
||||||
|
|
||||||
// Exposes private members for testing purposes only.
|
// Exposes private members for testing purposes only.
|
||||||
FRIEND_TEST_ALL_PREFIXES(AudioDeviceTest, testInterruptedAudioSession);
|
FRIEND_TEST_ALL_PREFIXES(AudioDeviceTest, testInterruptedAudioSession);
|
||||||
|
@ -101,7 +101,7 @@ class RTC_SCOPED_LOCKABLE AnnounceOnThread {
|
|||||||
} // namespace internal
|
} // namespace internal
|
||||||
} // namespace rtc
|
} // namespace rtc
|
||||||
|
|
||||||
// RTC_RUN_ON/RTC_ACCESS_ON/RTC_DCHECK_RUN_ON macros allows to annotate
|
// RTC_RUN_ON/RTC_GUARDED_BY/RTC_DCHECK_RUN_ON macros allows to annotate
|
||||||
// variables are accessed from same thread/task queue.
|
// variables are accessed from same thread/task queue.
|
||||||
// Using tools designed to check mutexes, it checks at compile time everywhere
|
// Using tools designed to check mutexes, it checks at compile time everywhere
|
||||||
// variable is access, there is a run-time dcheck thread/task queue is correct.
|
// variable is access, there is a run-time dcheck thread/task queue is correct.
|
||||||
@ -115,7 +115,7 @@ class RTC_SCOPED_LOCKABLE AnnounceOnThread {
|
|||||||
//
|
//
|
||||||
// private:
|
// private:
|
||||||
// rtc::Thread* network_thread_;
|
// rtc::Thread* network_thread_;
|
||||||
// int transport_ RTC_ACCESS_ON(network_thread_);
|
// int transport_ RTC_GUARDED_BY(network_thread_);
|
||||||
// };
|
// };
|
||||||
//
|
//
|
||||||
// class ExampleThreadChecker {
|
// class ExampleThreadChecker {
|
||||||
@ -131,7 +131,7 @@ class RTC_SCOPED_LOCKABLE AnnounceOnThread {
|
|||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// private:
|
// private:
|
||||||
// int pacer_var_ RTC_ACCESS_ON(pacer_thread_checker_);
|
// int pacer_var_ RTC_GUARDED_BY(pacer_thread_checker_);
|
||||||
// rtc::ThreadChecker pacer_thread_checker_;
|
// rtc::ThreadChecker pacer_thread_checker_;
|
||||||
// };
|
// };
|
||||||
//
|
//
|
||||||
@ -147,7 +147,7 @@ class RTC_SCOPED_LOCKABLE AnnounceOnThread {
|
|||||||
//
|
//
|
||||||
// private:
|
// private:
|
||||||
// rtc::TaskQueue* const encoder_queue_;
|
// rtc::TaskQueue* const encoder_queue_;
|
||||||
// Frame var_ RTC_ACCESS_ON(encoder_queue_);
|
// Frame var_ RTC_GUARDED_BY(encoder_queue_);
|
||||||
// };
|
// };
|
||||||
//
|
//
|
||||||
// void Encode() {
|
// void Encode() {
|
||||||
@ -162,10 +162,6 @@ class RTC_SCOPED_LOCKABLE AnnounceOnThread {
|
|||||||
// rtc::scoped_ref_ptr<Encoder> encoder_;
|
// rtc::scoped_ref_ptr<Encoder> encoder_;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// Document if a variable/field is not shared and should be accessed from
|
|
||||||
// same thread/task queue.
|
|
||||||
#define RTC_ACCESS_ON(x) RTC_THREAD_ANNOTATION_ATTRIBUTE__(guarded_by(x))
|
|
||||||
|
|
||||||
// Document if a function expected to be called from same thread/task queue.
|
// Document if a function expected to be called from same thread/task queue.
|
||||||
#define RTC_RUN_ON(x) RTC_THREAD_ANNOTATION_ATTRIBUTE__(exclusive_locks_required(x))
|
#define RTC_RUN_ON(x) RTC_THREAD_ANNOTATION_ATTRIBUTE__(exclusive_locks_required(x))
|
||||||
|
|
||||||
|
@ -248,9 +248,9 @@ class ThreadAnnotateTest {
|
|||||||
rtc::ThreadChecker checker_;
|
rtc::ThreadChecker checker_;
|
||||||
rtc::TaskQueue* queue_;
|
rtc::TaskQueue* queue_;
|
||||||
|
|
||||||
int var_thread_ RTC_ACCESS_ON(thread_);
|
int var_thread_ RTC_GUARDED_BY(thread_);
|
||||||
int var_checker_ RTC_GUARDED_BY(checker_);
|
int var_checker_ RTC_GUARDED_BY(checker_);
|
||||||
int var_queue_ RTC_ACCESS_ON(queue_);
|
int var_queue_ RTC_GUARDED_BY(queue_);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Just in case we ever get lumped together with other compilation units.
|
// Just in case we ever get lumped together with other compilation units.
|
||||||
|
@ -49,10 +49,10 @@ class PacketSender {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
rtc::SequencedTaskChecker worker_queue_checker_;
|
rtc::SequencedTaskChecker worker_queue_checker_;
|
||||||
size_t packet_size_ RTC_ACCESS_ON(worker_queue_checker_);
|
size_t packet_size_ RTC_GUARDED_BY(worker_queue_checker_);
|
||||||
int64_t send_interval_ms_ RTC_ACCESS_ON(worker_queue_checker_);
|
int64_t send_interval_ms_ RTC_GUARDED_BY(worker_queue_checker_);
|
||||||
int64_t sequence_number_ RTC_ACCESS_ON(worker_queue_checker_);
|
int64_t sequence_number_ RTC_GUARDED_BY(worker_queue_checker_);
|
||||||
bool sending_ RTC_ACCESS_ON(worker_queue_checker_);
|
bool sending_ RTC_GUARDED_BY(worker_queue_checker_);
|
||||||
const std::string config_file_path_;
|
const std::string config_file_path_;
|
||||||
TestController* const test_controller_;
|
TestController* const test_controller_;
|
||||||
rtc::TaskQueue worker_queue_;
|
rtc::TaskQueue worker_queue_;
|
||||||
|
@ -88,20 +88,20 @@ class VideoDecoderWrapper : public VideoDecoder {
|
|||||||
rtc::RaceChecker callback_race_checker_;
|
rtc::RaceChecker callback_race_checker_;
|
||||||
|
|
||||||
// Initialized on InitDecode and immutable after that.
|
// Initialized on InitDecode and immutable after that.
|
||||||
VideoCodec codec_settings_ RTC_ACCESS_ON(decoder_thread_checker_);
|
VideoCodec codec_settings_ RTC_GUARDED_BY(decoder_thread_checker_);
|
||||||
int32_t number_of_cores_ RTC_ACCESS_ON(decoder_thread_checker_);
|
int32_t number_of_cores_ RTC_GUARDED_BY(decoder_thread_checker_);
|
||||||
|
|
||||||
bool initialized_ RTC_ACCESS_ON(decoder_thread_checker_);
|
bool initialized_ RTC_GUARDED_BY(decoder_thread_checker_);
|
||||||
H264BitstreamParser h264_bitstream_parser_
|
H264BitstreamParser h264_bitstream_parser_
|
||||||
RTC_ACCESS_ON(decoder_thread_checker_);
|
RTC_GUARDED_BY(decoder_thread_checker_);
|
||||||
|
|
||||||
DecodedImageCallback* callback_ RTC_ACCESS_ON(callback_race_checker_);
|
DecodedImageCallback* callback_ RTC_GUARDED_BY(callback_race_checker_);
|
||||||
|
|
||||||
// Accessed both on the decoder thread and the callback thread.
|
// Accessed both on the decoder thread and the callback thread.
|
||||||
std::atomic<bool> qp_parsing_enabled_;
|
std::atomic<bool> qp_parsing_enabled_;
|
||||||
rtc::CriticalSection frame_extra_infos_lock_;
|
rtc::CriticalSection frame_extra_infos_lock_;
|
||||||
std::deque<FrameExtraInfo> frame_extra_infos_
|
std::deque<FrameExtraInfo> frame_extra_infos_
|
||||||
RTC_ACCESS_ON(frame_extra_infos_lock_);
|
RTC_GUARDED_BY(frame_extra_infos_lock_);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace jni
|
} // namespace jni
|
||||||
|
@ -95,7 +95,7 @@ class DelayedEncoder : public test::FakeEncoder {
|
|||||||
const std::vector<FrameType>* frame_types) override;
|
const std::vector<FrameType>* frame_types) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int delay_ms_ RTC_ACCESS_ON(sequence_checker_);
|
int delay_ms_ RTC_GUARDED_BY(sequence_checker_);
|
||||||
rtc::SequencedTaskChecker sequence_checker_;
|
rtc::SequencedTaskChecker sequence_checker_;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -125,9 +125,9 @@ class MultithreadedFakeH264Encoder : public test::FakeH264Encoder {
|
|||||||
protected:
|
protected:
|
||||||
class EncodeTask;
|
class EncodeTask;
|
||||||
|
|
||||||
int current_queue_ RTC_ACCESS_ON(sequence_checker_);
|
int current_queue_ RTC_GUARDED_BY(sequence_checker_);
|
||||||
std::unique_ptr<rtc::TaskQueue> queue1_ RTC_ACCESS_ON(sequence_checker_);
|
std::unique_ptr<rtc::TaskQueue> queue1_ RTC_GUARDED_BY(sequence_checker_);
|
||||||
std::unique_ptr<rtc::TaskQueue> queue2_ RTC_ACCESS_ON(sequence_checker_);
|
std::unique_ptr<rtc::TaskQueue> queue2_ RTC_GUARDED_BY(sequence_checker_);
|
||||||
rtc::SequencedTaskChecker sequence_checker_;
|
rtc::SequencedTaskChecker sequence_checker_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ class RtpStreamsSynchronizer : public Module {
|
|||||||
StreamSynchronization::Measurements video_measurement_ RTC_GUARDED_BY(crit_);
|
StreamSynchronization::Measurements video_measurement_ RTC_GUARDED_BY(crit_);
|
||||||
|
|
||||||
rtc::ThreadChecker process_thread_checker_;
|
rtc::ThreadChecker process_thread_checker_;
|
||||||
int64_t last_sync_time_ RTC_ACCESS_ON(&process_thread_checker_);
|
int64_t last_sync_time_ RTC_GUARDED_BY(&process_thread_checker_);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace webrtc
|
} // namespace webrtc
|
||||||
|
@ -217,10 +217,11 @@ class VideoStreamEncoder : public rtc::VideoSinkInterface<VideoFrame>,
|
|||||||
const VideoSendStream::Config::EncoderSettings settings_;
|
const VideoSendStream::Config::EncoderSettings settings_;
|
||||||
const VideoCodecType codec_type_;
|
const VideoCodecType codec_type_;
|
||||||
|
|
||||||
vcm::VideoSender video_sender_ RTC_ACCESS_ON(&encoder_queue_);
|
vcm::VideoSender video_sender_ RTC_GUARDED_BY(&encoder_queue_);
|
||||||
std::unique_ptr<OveruseFrameDetector> overuse_detector_
|
std::unique_ptr<OveruseFrameDetector> overuse_detector_
|
||||||
RTC_ACCESS_ON(&encoder_queue_);
|
RTC_GUARDED_BY(&encoder_queue_);
|
||||||
std::unique_ptr<QualityScaler> quality_scaler_ RTC_ACCESS_ON(&encoder_queue_);
|
std::unique_ptr<QualityScaler> quality_scaler_
|
||||||
|
RTC_GUARDED_BY(&encoder_queue_);
|
||||||
|
|
||||||
SendStatisticsProxy* const stats_proxy_;
|
SendStatisticsProxy* const stats_proxy_;
|
||||||
rtc::VideoSinkInterface<VideoFrame>* const pre_encode_callback_;
|
rtc::VideoSinkInterface<VideoFrame>* const pre_encode_callback_;
|
||||||
@ -228,24 +229,25 @@ class VideoStreamEncoder : public rtc::VideoSinkInterface<VideoFrame>,
|
|||||||
// of VideoStreamEncoder are called on the same thread.
|
// of VideoStreamEncoder are called on the same thread.
|
||||||
rtc::ThreadChecker thread_checker_;
|
rtc::ThreadChecker thread_checker_;
|
||||||
|
|
||||||
VideoEncoderConfig encoder_config_ RTC_ACCESS_ON(&encoder_queue_);
|
VideoEncoderConfig encoder_config_ RTC_GUARDED_BY(&encoder_queue_);
|
||||||
std::unique_ptr<VideoBitrateAllocator> rate_allocator_
|
std::unique_ptr<VideoBitrateAllocator> rate_allocator_
|
||||||
RTC_ACCESS_ON(&encoder_queue_);
|
RTC_GUARDED_BY(&encoder_queue_);
|
||||||
// The maximum frame rate of the current codec configuration, as determined
|
// The maximum frame rate of the current codec configuration, as determined
|
||||||
// at the last ReconfigureEncoder() call.
|
// at the last ReconfigureEncoder() call.
|
||||||
int max_framerate_ RTC_ACCESS_ON(&encoder_queue_);
|
int max_framerate_ RTC_GUARDED_BY(&encoder_queue_);
|
||||||
|
|
||||||
// Set when ConfigureEncoder has been called in order to lazy reconfigure the
|
// Set when ConfigureEncoder has been called in order to lazy reconfigure the
|
||||||
// encoder on the next frame.
|
// encoder on the next frame.
|
||||||
bool pending_encoder_reconfiguration_ RTC_ACCESS_ON(&encoder_queue_);
|
bool pending_encoder_reconfiguration_ RTC_GUARDED_BY(&encoder_queue_);
|
||||||
rtc::Optional<VideoFrameInfo> last_frame_info_ RTC_ACCESS_ON(&encoder_queue_);
|
rtc::Optional<VideoFrameInfo> last_frame_info_
|
||||||
int crop_width_ RTC_ACCESS_ON(&encoder_queue_);
|
RTC_GUARDED_BY(&encoder_queue_);
|
||||||
int crop_height_ RTC_ACCESS_ON(&encoder_queue_);
|
int crop_width_ RTC_GUARDED_BY(&encoder_queue_);
|
||||||
uint32_t encoder_start_bitrate_bps_ RTC_ACCESS_ON(&encoder_queue_);
|
int crop_height_ RTC_GUARDED_BY(&encoder_queue_);
|
||||||
size_t max_data_payload_length_ RTC_ACCESS_ON(&encoder_queue_);
|
uint32_t encoder_start_bitrate_bps_ RTC_GUARDED_BY(&encoder_queue_);
|
||||||
bool nack_enabled_ RTC_ACCESS_ON(&encoder_queue_);
|
size_t max_data_payload_length_ RTC_GUARDED_BY(&encoder_queue_);
|
||||||
uint32_t last_observed_bitrate_bps_ RTC_ACCESS_ON(&encoder_queue_);
|
bool nack_enabled_ RTC_GUARDED_BY(&encoder_queue_);
|
||||||
bool encoder_paused_and_dropped_frame_ RTC_ACCESS_ON(&encoder_queue_);
|
uint32_t last_observed_bitrate_bps_ RTC_GUARDED_BY(&encoder_queue_);
|
||||||
|
bool encoder_paused_and_dropped_frame_ RTC_GUARDED_BY(&encoder_queue_);
|
||||||
Clock* const clock_;
|
Clock* const clock_;
|
||||||
// Counters used for deciding if the video resolution or framerate is
|
// Counters used for deciding if the video resolution or framerate is
|
||||||
// currently restricted, and if so, why, on a per degradation preference
|
// currently restricted, and if so, why, on a per degradation preference
|
||||||
@ -253,10 +255,10 @@ class VideoStreamEncoder : public rtc::VideoSinkInterface<VideoFrame>,
|
|||||||
// TODO(sprang): Replace this with a state holding a relative overuse measure
|
// TODO(sprang): Replace this with a state holding a relative overuse measure
|
||||||
// instead, that can be translated into suitable down-scale or fps limit.
|
// instead, that can be translated into suitable down-scale or fps limit.
|
||||||
std::map<const VideoSendStream::DegradationPreference, AdaptCounter>
|
std::map<const VideoSendStream::DegradationPreference, AdaptCounter>
|
||||||
adapt_counters_ RTC_ACCESS_ON(&encoder_queue_);
|
adapt_counters_ RTC_GUARDED_BY(&encoder_queue_);
|
||||||
// Set depending on degradation preferences.
|
// Set depending on degradation preferences.
|
||||||
VideoSendStream::DegradationPreference degradation_preference_
|
VideoSendStream::DegradationPreference degradation_preference_
|
||||||
RTC_ACCESS_ON(&encoder_queue_);
|
RTC_GUARDED_BY(&encoder_queue_);
|
||||||
|
|
||||||
struct AdaptationRequest {
|
struct AdaptationRequest {
|
||||||
// The pixel count produced by the source at the time of the adaptation.
|
// The pixel count produced by the source at the time of the adaptation.
|
||||||
@ -269,7 +271,7 @@ class VideoStreamEncoder : public rtc::VideoSinkInterface<VideoFrame>,
|
|||||||
// Stores a snapshot of the last adaptation request triggered by an AdaptUp
|
// Stores a snapshot of the last adaptation request triggered by an AdaptUp
|
||||||
// or AdaptDown signal.
|
// or AdaptDown signal.
|
||||||
rtc::Optional<AdaptationRequest> last_adaptation_request_
|
rtc::Optional<AdaptationRequest> last_adaptation_request_
|
||||||
RTC_ACCESS_ON(&encoder_queue_);
|
RTC_GUARDED_BY(&encoder_queue_);
|
||||||
|
|
||||||
rtc::RaceChecker incoming_frame_race_checker_
|
rtc::RaceChecker incoming_frame_race_checker_
|
||||||
RTC_GUARDED_BY(incoming_frame_race_checker_);
|
RTC_GUARDED_BY(incoming_frame_race_checker_);
|
||||||
@ -281,13 +283,13 @@ class VideoStreamEncoder : public rtc::VideoSinkInterface<VideoFrame>,
|
|||||||
RTC_GUARDED_BY(incoming_frame_race_checker_);
|
RTC_GUARDED_BY(incoming_frame_race_checker_);
|
||||||
|
|
||||||
int64_t last_frame_log_ms_ RTC_GUARDED_BY(incoming_frame_race_checker_);
|
int64_t last_frame_log_ms_ RTC_GUARDED_BY(incoming_frame_race_checker_);
|
||||||
int captured_frame_count_ RTC_ACCESS_ON(&encoder_queue_);
|
int captured_frame_count_ RTC_GUARDED_BY(&encoder_queue_);
|
||||||
int dropped_frame_count_ RTC_ACCESS_ON(&encoder_queue_);
|
int dropped_frame_count_ RTC_GUARDED_BY(&encoder_queue_);
|
||||||
|
|
||||||
VideoBitrateAllocationObserver* bitrate_observer_
|
VideoBitrateAllocationObserver* bitrate_observer_
|
||||||
RTC_ACCESS_ON(&encoder_queue_);
|
RTC_GUARDED_BY(&encoder_queue_);
|
||||||
rtc::Optional<int64_t> last_parameters_update_ms_
|
rtc::Optional<int64_t> last_parameters_update_ms_
|
||||||
RTC_ACCESS_ON(&encoder_queue_);
|
RTC_GUARDED_BY(&encoder_queue_);
|
||||||
|
|
||||||
// All public methods are proxied to |encoder_queue_|. It must must be
|
// All public methods are proxied to |encoder_queue_|. It must must be
|
||||||
// destroyed first to make sure no tasks are run that use other members.
|
// destroyed first to make sure no tasks are run that use other members.
|
||||||
|
Reference in New Issue
Block a user