diff --git a/api/statstypes.h b/api/statstypes.h index a034017458..2ba8ba5fd5 100644 --- a/api/statstypes.h +++ b/api/statstypes.h @@ -337,7 +337,7 @@ class StatsReport { private: 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_; // TODO(tommi): Use C++ 11 union and make value_ const. diff --git a/audio/audio_receive_stream.h b/audio/audio_receive_stream.h index 295f5f7aa6..a47b59c3e9 100644 --- a/audio/audio_receive_stream.h +++ b/audio/audio_receive_stream.h @@ -103,7 +103,7 @@ class AudioReceiveStream final : public webrtc::AudioReceiveStream, std::unique_ptr channel_proxy_; 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 rtp_stream_receiver_; diff --git a/audio/channel.h b/audio/channel.h index 7290ce8f09..e59cae11ad 100644 --- a/audio/channel.h +++ b/audio/channel.h @@ -353,7 +353,7 @@ class Channel std::unique_ptr audio_coding_; AudioSinkInterface* audio_sink_ = nullptr; 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_); @@ -378,9 +378,9 @@ class Channel ProcessThread* _moduleProcessThreadPtr; AudioDeviceModule* _audioDeviceModulePtr; 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 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_); // VoeRTP_RTCP // TODO(henrika): can today be accessed on the main thread and on the diff --git a/logging/rtc_event_log/rtc_event_log_impl.cc b/logging/rtc_event_log/rtc_event_log_impl.cc index 2173590662..735c9b34a6 100644 --- a/logging/rtc_event_log/rtc_event_log_impl.cc +++ b/logging/rtc_event_log/rtc_event_log_impl.cc @@ -113,21 +113,22 @@ class RtcEventLogImpl final : public RtcEventLog { // History containing all past configuration events. std::deque> config_history_ - RTC_ACCESS_ON(task_queue_); + RTC_GUARDED_BY(task_queue_); // History containing the most recent (non-configuration) events (~10s). - std::deque> history_ RTC_ACCESS_ON(task_queue_); + std::deque> history_ RTC_GUARDED_BY(task_queue_); - size_t max_size_bytes_ RTC_ACCESS_ON(task_queue_); - size_t written_bytes_ RTC_ACCESS_ON(task_queue_); + size_t max_size_bytes_ RTC_GUARDED_BY(task_queue_); + size_t written_bytes_ RTC_GUARDED_BY(task_queue_); - std::unique_ptr event_encoder_ RTC_ACCESS_ON(task_queue_); - std::unique_ptr event_output_ RTC_ACCESS_ON(task_queue_); + std::unique_ptr event_encoder_ + RTC_GUARDED_BY(task_queue_); + std::unique_ptr event_output_ RTC_GUARDED_BY(task_queue_); - size_t num_config_events_written_ RTC_ACCESS_ON(task_queue_); - int64_t output_period_ms_ RTC_ACCESS_ON(task_queue_); - int64_t last_output_ms_ RTC_ACCESS_ON(task_queue_); - bool output_scheduled_ RTC_ACCESS_ON(task_queue_); + size_t num_config_events_written_ RTC_GUARDED_BY(task_queue_); + int64_t output_period_ms_ RTC_GUARDED_BY(task_queue_); + int64_t last_output_ms_ RTC_GUARDED_BY(task_queue_); + bool output_scheduled_ RTC_GUARDED_BY(task_queue_); // 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_| diff --git a/media/engine/webrtcvideoengine.h b/media/engine/webrtcvideoengine.h index 231ce67479..03fa3e8eab 100644 --- a/media/engine/webrtcvideoengine.h +++ b/media/engine/webrtcvideoengine.h @@ -331,33 +331,33 @@ class WebRtcVideoChannel : public VideoMediaChannel, public webrtc::Transport { rtc::ThreadChecker thread_checker_; rtc::AsyncInvoker invoker_; rtc::Thread* worker_thread_; - const std::vector ssrcs_ RTC_ACCESS_ON(&thread_checker_); - const std::vector ssrc_groups_ RTC_ACCESS_ON(&thread_checker_); + const std::vector ssrcs_ RTC_GUARDED_BY(&thread_checker_); + const std::vector ssrc_groups_ RTC_GUARDED_BY(&thread_checker_); webrtc::Call* const call_; const bool enable_cpu_overuse_detection_; rtc::VideoSourceInterface* source_ - RTC_ACCESS_ON(&thread_checker_); + RTC_GUARDED_BY(&thread_checker_); 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* encoder_sink_ - RTC_ACCESS_ON(&thread_checker_); + RTC_GUARDED_BY(&thread_checker_); // Contains settings that are the same for all streams in the MediaChannel, // such as codecs, header extensions, and the global bitrate limit for the // 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. // Does *not* contain codecs, however. // TODO(skvlad): Move ssrcs_ and ssrc_groups_ into rtp_parameters_. // TODO(skvlad): Combine parameters_ and rtp_parameters_ once we have only // 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 allocated_encoder_ - RTC_ACCESS_ON(&thread_checker_); - VideoCodec allocated_codec_ RTC_ACCESS_ON(&thread_checker_); + RTC_GUARDED_BY(&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 diff --git a/modules/audio_device/audio_device_buffer.h b/modules/audio_device/audio_device_buffer.h index c4ef95b321..e3f7c1984c 100644 --- a/modules/audio_device/audio_device_buffer.h +++ b/modules/audio_device/audio_device_buffer.h @@ -182,46 +182,46 @@ class AudioDeviceBuffer { // 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. // Only used on the creating thread and not used to control any media flow. - bool playing_ RTC_ACCESS_ON(main_thread_checker_); - bool recording_ RTC_ACCESS_ON(main_thread_checker_); + bool playing_ RTC_GUARDED_BY(main_thread_checker_); + bool recording_ RTC_GUARDED_BY(main_thread_checker_); // Buffer used for audio samples to be played out. Size can be changed // dynamically. The 16-bit samples are interleaved, hence the size is // proportional to the number of channels. - rtc::BufferT play_buffer_ RTC_ACCESS_ON(playout_thread_checker_); + rtc::BufferT play_buffer_ RTC_GUARDED_BY(playout_thread_checker_); // Byte buffer used for recorded audio samples. Size can be changed // dynamically. - rtc::BufferT rec_buffer_ RTC_ACCESS_ON(recording_thread_checker_); + rtc::BufferT rec_buffer_ RTC_GUARDED_BY(recording_thread_checker_); // 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. - int play_delay_ms_ RTC_ACCESS_ON(recording_thread_checker_); - int rec_delay_ms_ RTC_ACCESS_ON(recording_thread_checker_); + int play_delay_ms_ RTC_GUARDED_BY(recording_thread_checker_); + int rec_delay_ms_ RTC_GUARDED_BY(recording_thread_checker_); // 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). - 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 // a new storage of audio stats shall be done. - int16_t rec_stat_count_ RTC_ACCESS_ON(recording_thread_checker_); - int16_t play_stat_count_ RTC_ACCESS_ON(playout_thread_checker_); + int16_t rec_stat_count_ RTC_GUARDED_BY(recording_thread_checker_); + int16_t play_stat_count_ RTC_GUARDED_BY(playout_thread_checker_); // Time stamps of when playout and recording starts. - int64_t play_start_time_ RTC_ACCESS_ON(main_thread_checker_); - int64_t rec_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_GUARDED_BY(main_thread_checker_); // Contains counters for playout and recording statistics. Stats stats_ RTC_GUARDED_BY(lock_); // Stores current stats at each timer task. Used to calculate differences // 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- // level estimate larger than zero is detected. @@ -231,12 +231,12 @@ class AudioDeviceBuffer { // StartPeriodicLogging() and set to false by StopPeriodicLogging(). // Setting this member to false prevents (possiby invalid) log messages from // 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. // When defined, the output signal will be replaced by a sinus tone at 440Hz. #ifdef AUDIO_DEVICE_PLAYS_SINUS_TONE - double phase_ RTC_ACCESS_ON(playout_thread_checker_); + double phase_ RTC_GUARDED_BY(playout_thread_checker_); #endif }; diff --git a/modules/audio_device/audio_device_unittest.cc b/modules/audio_device/audio_device_unittest.cc index c309ca6819..ccdc004bbd 100644 --- a/modules/audio_device/audio_device_unittest.cc +++ b/modules/audio_device/audio_device_unittest.cc @@ -295,8 +295,8 @@ class LatencyAudioStream : public AudioStream { rtc::Optional pulse_time_ RTC_GUARDED_BY(lock_); std::vector latencies_ RTC_GUARDED_BY(race_checker_); - size_t read_count_ RTC_ACCESS_ON(read_thread_checker_) = 0; - size_t write_count_ RTC_ACCESS_ON(write_thread_checker_) = 0; + size_t read_count_ RTC_GUARDED_BY(read_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 diff --git a/modules/audio_device/ios/audio_device_ios.h b/modules/audio_device/ios/audio_device_ios.h index d97e124a56..460f0ef44f 100644 --- a/modules/audio_device/ios/audio_device_ios.h +++ b/modules/audio_device/ios/audio_device_ios.h @@ -255,7 +255,7 @@ class AudioDeviceIOS : public AudioDeviceGeneric, volatile int playing_; // 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(), // false otherwise. @@ -266,14 +266,14 @@ class AudioDeviceIOS : public AudioDeviceGeneric, // Audio interruption observer instance. RTCAudioSessionDelegateAdapter* audio_session_observer_ - RTC_ACCESS_ON(thread_checker_); + RTC_GUARDED_BY(thread_checker_); // 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. - int64_t num_detected_playout_glitches_ RTC_ACCESS_ON(thread_checker_); - int64_t last_playout_time_ RTC_ACCESS_ON(io_thread_checker_); + int64_t num_detected_playout_glitches_ RTC_GUARDED_BY(thread_checker_); + int64_t last_playout_time_ RTC_GUARDED_BY(io_thread_checker_); // Counts number of playout callbacks per call. // 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_; // 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. FRIEND_TEST_ALL_PREFIXES(AudioDeviceTest, testInterruptedAudioSession); diff --git a/rtc_base/thread_checker.h b/rtc_base/thread_checker.h index 028e9bf367..cc03b8d9b0 100644 --- a/rtc_base/thread_checker.h +++ b/rtc_base/thread_checker.h @@ -101,7 +101,7 @@ class RTC_SCOPED_LOCKABLE AnnounceOnThread { } // namespace internal } // 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. // 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. @@ -115,7 +115,7 @@ class RTC_SCOPED_LOCKABLE AnnounceOnThread { // // private: // rtc::Thread* network_thread_; -// int transport_ RTC_ACCESS_ON(network_thread_); +// int transport_ RTC_GUARDED_BY(network_thread_); // }; // // class ExampleThreadChecker { @@ -131,7 +131,7 @@ class RTC_SCOPED_LOCKABLE AnnounceOnThread { // } // // private: -// int pacer_var_ RTC_ACCESS_ON(pacer_thread_checker_); +// int pacer_var_ RTC_GUARDED_BY(pacer_thread_checker_); // rtc::ThreadChecker pacer_thread_checker_; // }; // @@ -147,7 +147,7 @@ class RTC_SCOPED_LOCKABLE AnnounceOnThread { // // private: // rtc::TaskQueue* const encoder_queue_; -// Frame var_ RTC_ACCESS_ON(encoder_queue_); +// Frame var_ RTC_GUARDED_BY(encoder_queue_); // }; // // void Encode() { @@ -162,10 +162,6 @@ class RTC_SCOPED_LOCKABLE AnnounceOnThread { // rtc::scoped_ref_ptr 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. #define RTC_RUN_ON(x) RTC_THREAD_ANNOTATION_ATTRIBUTE__(exclusive_locks_required(x)) diff --git a/rtc_base/thread_checker_unittest.cc b/rtc_base/thread_checker_unittest.cc index 071815d136..ba5ac9e008 100644 --- a/rtc_base/thread_checker_unittest.cc +++ b/rtc_base/thread_checker_unittest.cc @@ -248,9 +248,9 @@ class ThreadAnnotateTest { rtc::ThreadChecker checker_; 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_queue_ RTC_ACCESS_ON(queue_); + int var_queue_ RTC_GUARDED_BY(queue_); }; // Just in case we ever get lumped together with other compilation units. diff --git a/rtc_tools/network_tester/packet_sender.h b/rtc_tools/network_tester/packet_sender.h index b2f3901e1e..da3eb293b1 100644 --- a/rtc_tools/network_tester/packet_sender.h +++ b/rtc_tools/network_tester/packet_sender.h @@ -49,10 +49,10 @@ class PacketSender { private: rtc::SequencedTaskChecker worker_queue_checker_; - size_t packet_size_ RTC_ACCESS_ON(worker_queue_checker_); - int64_t send_interval_ms_ RTC_ACCESS_ON(worker_queue_checker_); - int64_t sequence_number_ RTC_ACCESS_ON(worker_queue_checker_); - bool sending_ RTC_ACCESS_ON(worker_queue_checker_); + size_t packet_size_ RTC_GUARDED_BY(worker_queue_checker_); + int64_t send_interval_ms_ RTC_GUARDED_BY(worker_queue_checker_); + int64_t sequence_number_ RTC_GUARDED_BY(worker_queue_checker_); + bool sending_ RTC_GUARDED_BY(worker_queue_checker_); const std::string config_file_path_; TestController* const test_controller_; rtc::TaskQueue worker_queue_; diff --git a/sdk/android/src/jni/videodecoderwrapper.h b/sdk/android/src/jni/videodecoderwrapper.h index 7fc2d54935..05053f8be3 100644 --- a/sdk/android/src/jni/videodecoderwrapper.h +++ b/sdk/android/src/jni/videodecoderwrapper.h @@ -88,20 +88,20 @@ class VideoDecoderWrapper : public VideoDecoder { rtc::RaceChecker callback_race_checker_; // Initialized on InitDecode and immutable after that. - VideoCodec codec_settings_ RTC_ACCESS_ON(decoder_thread_checker_); - int32_t number_of_cores_ RTC_ACCESS_ON(decoder_thread_checker_); + VideoCodec codec_settings_ RTC_GUARDED_BY(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_ - 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. std::atomic qp_parsing_enabled_; rtc::CriticalSection frame_extra_infos_lock_; std::deque frame_extra_infos_ - RTC_ACCESS_ON(frame_extra_infos_lock_); + RTC_GUARDED_BY(frame_extra_infos_lock_); }; } // namespace jni diff --git a/test/fake_encoder.h b/test/fake_encoder.h index 06c0e0392d..f6ed2899e0 100644 --- a/test/fake_encoder.h +++ b/test/fake_encoder.h @@ -95,7 +95,7 @@ class DelayedEncoder : public test::FakeEncoder { const std::vector* frame_types) override; private: - int delay_ms_ RTC_ACCESS_ON(sequence_checker_); + int delay_ms_ RTC_GUARDED_BY(sequence_checker_); rtc::SequencedTaskChecker sequence_checker_; }; @@ -125,9 +125,9 @@ class MultithreadedFakeH264Encoder : public test::FakeH264Encoder { protected: class EncodeTask; - int current_queue_ RTC_ACCESS_ON(sequence_checker_); - std::unique_ptr queue1_ RTC_ACCESS_ON(sequence_checker_); - std::unique_ptr queue2_ RTC_ACCESS_ON(sequence_checker_); + int current_queue_ RTC_GUARDED_BY(sequence_checker_); + std::unique_ptr queue1_ RTC_GUARDED_BY(sequence_checker_); + std::unique_ptr queue2_ RTC_GUARDED_BY(sequence_checker_); rtc::SequencedTaskChecker sequence_checker_; }; diff --git a/video/rtp_streams_synchronizer.h b/video/rtp_streams_synchronizer.h index 0d3b205b41..7c42b7df51 100644 --- a/video/rtp_streams_synchronizer.h +++ b/video/rtp_streams_synchronizer.h @@ -58,7 +58,7 @@ class RtpStreamsSynchronizer : public Module { StreamSynchronization::Measurements video_measurement_ RTC_GUARDED_BY(crit_); 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 diff --git a/video/video_stream_encoder.h b/video/video_stream_encoder.h index fccf208296..9da8f93410 100644 --- a/video/video_stream_encoder.h +++ b/video/video_stream_encoder.h @@ -217,10 +217,11 @@ class VideoStreamEncoder : public rtc::VideoSinkInterface, const VideoSendStream::Config::EncoderSettings settings_; 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 overuse_detector_ - RTC_ACCESS_ON(&encoder_queue_); - std::unique_ptr quality_scaler_ RTC_ACCESS_ON(&encoder_queue_); + RTC_GUARDED_BY(&encoder_queue_); + std::unique_ptr quality_scaler_ + RTC_GUARDED_BY(&encoder_queue_); SendStatisticsProxy* const stats_proxy_; rtc::VideoSinkInterface* const pre_encode_callback_; @@ -228,24 +229,25 @@ class VideoStreamEncoder : public rtc::VideoSinkInterface, // of VideoStreamEncoder are called on the same thread. rtc::ThreadChecker thread_checker_; - VideoEncoderConfig encoder_config_ RTC_ACCESS_ON(&encoder_queue_); + VideoEncoderConfig encoder_config_ RTC_GUARDED_BY(&encoder_queue_); std::unique_ptr rate_allocator_ - RTC_ACCESS_ON(&encoder_queue_); + RTC_GUARDED_BY(&encoder_queue_); // The maximum frame rate of the current codec configuration, as determined // 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 // encoder on the next frame. - bool pending_encoder_reconfiguration_ RTC_ACCESS_ON(&encoder_queue_); - rtc::Optional last_frame_info_ RTC_ACCESS_ON(&encoder_queue_); - int crop_width_ RTC_ACCESS_ON(&encoder_queue_); - int crop_height_ RTC_ACCESS_ON(&encoder_queue_); - uint32_t encoder_start_bitrate_bps_ RTC_ACCESS_ON(&encoder_queue_); - size_t max_data_payload_length_ RTC_ACCESS_ON(&encoder_queue_); - bool nack_enabled_ RTC_ACCESS_ON(&encoder_queue_); - uint32_t last_observed_bitrate_bps_ RTC_ACCESS_ON(&encoder_queue_); - bool encoder_paused_and_dropped_frame_ RTC_ACCESS_ON(&encoder_queue_); + bool pending_encoder_reconfiguration_ RTC_GUARDED_BY(&encoder_queue_); + rtc::Optional last_frame_info_ + RTC_GUARDED_BY(&encoder_queue_); + int crop_width_ RTC_GUARDED_BY(&encoder_queue_); + int crop_height_ RTC_GUARDED_BY(&encoder_queue_); + uint32_t encoder_start_bitrate_bps_ RTC_GUARDED_BY(&encoder_queue_); + size_t max_data_payload_length_ RTC_GUARDED_BY(&encoder_queue_); + bool nack_enabled_ RTC_GUARDED_BY(&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_; // Counters used for deciding if the video resolution or framerate is // currently restricted, and if so, why, on a per degradation preference @@ -253,10 +255,10 @@ class VideoStreamEncoder : public rtc::VideoSinkInterface, // TODO(sprang): Replace this with a state holding a relative overuse measure // instead, that can be translated into suitable down-scale or fps limit. std::map - adapt_counters_ RTC_ACCESS_ON(&encoder_queue_); + adapt_counters_ RTC_GUARDED_BY(&encoder_queue_); // Set depending on degradation preferences. VideoSendStream::DegradationPreference degradation_preference_ - RTC_ACCESS_ON(&encoder_queue_); + RTC_GUARDED_BY(&encoder_queue_); struct AdaptationRequest { // The pixel count produced by the source at the time of the adaptation. @@ -269,7 +271,7 @@ class VideoStreamEncoder : public rtc::VideoSinkInterface, // Stores a snapshot of the last adaptation request triggered by an AdaptUp // or AdaptDown signal. rtc::Optional last_adaptation_request_ - RTC_ACCESS_ON(&encoder_queue_); + RTC_GUARDED_BY(&encoder_queue_); rtc::RaceChecker incoming_frame_race_checker_ RTC_GUARDED_BY(incoming_frame_race_checker_); @@ -281,13 +283,13 @@ class VideoStreamEncoder : public rtc::VideoSinkInterface, 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 dropped_frame_count_ RTC_ACCESS_ON(&encoder_queue_); + int captured_frame_count_ RTC_GUARDED_BY(&encoder_queue_); + int dropped_frame_count_ RTC_GUARDED_BY(&encoder_queue_); VideoBitrateAllocationObserver* bitrate_observer_ - RTC_ACCESS_ON(&encoder_queue_); + RTC_GUARDED_BY(&encoder_queue_); rtc::Optional 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 // destroyed first to make sure no tasks are run that use other members.