diff --git a/webrtc/api/statstypes.h b/webrtc/api/statstypes.h index 378b014b17..6391ff569f 100644 --- a/webrtc/api/statstypes.h +++ b/webrtc/api/statstypes.h @@ -335,7 +335,7 @@ class StatsReport { private: rtc::ThreadChecker thread_checker_; - mutable int ref_count_ ACCESS_ON(thread_checker_) = 0; + mutable int ref_count_ RTC_ACCESS_ON(thread_checker_) = 0; const Type type_; // TODO(tommi): Use C++ 11 union and make value_ const. diff --git a/webrtc/audio/audio_receive_stream.h b/webrtc/audio/audio_receive_stream.h index dc7992f400..0615dc1586 100644 --- a/webrtc/audio/audio_receive_stream.h +++ b/webrtc/audio/audio_receive_stream.h @@ -90,7 +90,7 @@ class AudioReceiveStream final : public webrtc::AudioReceiveStream, rtc::scoped_refptr audio_state_; std::unique_ptr channel_proxy_; - bool playing_ ACCESS_ON(worker_thread_checker_) = false; + bool playing_ RTC_ACCESS_ON(worker_thread_checker_) = false; std::unique_ptr rtp_stream_receiver_; diff --git a/webrtc/audio/audio_send_stream.h b/webrtc/audio/audio_send_stream.h index f46608d59a..cf36c1393f 100644 --- a/webrtc/audio/audio_send_stream.h +++ b/webrtc/audio/audio_send_stream.h @@ -115,7 +115,7 @@ class AudioSendStream final : public webrtc::AudioSendStream, rtc::CriticalSection packet_loss_tracker_cs_; TransportFeedbackPacketLossTracker packet_loss_tracker_ - GUARDED_BY(&packet_loss_tracker_cs_); + RTC_GUARDED_BY(&packet_loss_tracker_cs_); RtpRtcp* rtp_rtcp_module_; rtc::Optional const suspended_rtp_state_; diff --git a/webrtc/audio/audio_state.h b/webrtc/audio/audio_state.h index c8ce44b8b2..893c1f9406 100644 --- a/webrtc/audio/audio_state.h +++ b/webrtc/audio/audio_state.h @@ -55,7 +55,7 @@ class AudioState final : public webrtc::AudioState, // The critical section isn't strictly needed in this case, but xSAN bots may // trigger on unprotected cross-thread access. rtc::CriticalSection crit_sect_; - bool typing_noise_detected_ GUARDED_BY(crit_sect_) = false; + bool typing_noise_detected_ RTC_GUARDED_BY(crit_sect_) = false; // Reference count; implementation copied from rtc::RefCountedObject. mutable volatile int ref_count_ = 0; diff --git a/webrtc/call/bitrate_allocator.h b/webrtc/call/bitrate_allocator.h index b36d38e652..b9bbc93b77 100644 --- a/webrtc/call/bitrate_allocator.h +++ b/webrtc/call/bitrate_allocator.h @@ -153,20 +153,20 @@ class BitrateAllocator { uint32_t sum_min_bitrates); rtc::SequencedTaskChecker sequenced_checker_; - LimitObserver* const limit_observer_ GUARDED_BY(&sequenced_checker_); + LimitObserver* const limit_observer_ RTC_GUARDED_BY(&sequenced_checker_); // Stored in a list to keep track of the insertion order. - ObserverConfigs bitrate_observer_configs_ GUARDED_BY(&sequenced_checker_); - uint32_t last_bitrate_bps_ GUARDED_BY(&sequenced_checker_); - uint32_t last_non_zero_bitrate_bps_ GUARDED_BY(&sequenced_checker_); - uint8_t last_fraction_loss_ GUARDED_BY(&sequenced_checker_); - int64_t last_rtt_ GUARDED_BY(&sequenced_checker_); - int64_t last_bwe_period_ms_ GUARDED_BY(&sequenced_checker_); + ObserverConfigs bitrate_observer_configs_ RTC_GUARDED_BY(&sequenced_checker_); + uint32_t last_bitrate_bps_ RTC_GUARDED_BY(&sequenced_checker_); + uint32_t last_non_zero_bitrate_bps_ RTC_GUARDED_BY(&sequenced_checker_); + uint8_t last_fraction_loss_ RTC_GUARDED_BY(&sequenced_checker_); + int64_t last_rtt_ RTC_GUARDED_BY(&sequenced_checker_); + int64_t last_bwe_period_ms_ RTC_GUARDED_BY(&sequenced_checker_); // Number of mute events based on too low BWE, not network up/down. - int num_pause_events_ GUARDED_BY(&sequenced_checker_); - Clock* const clock_ GUARDED_BY(&sequenced_checker_); - int64_t last_bwe_log_time_ GUARDED_BY(&sequenced_checker_); - uint32_t total_requested_padding_bitrate_ GUARDED_BY(&sequenced_checker_); - uint32_t total_requested_min_bitrate_ GUARDED_BY(&sequenced_checker_); + int num_pause_events_ RTC_GUARDED_BY(&sequenced_checker_); + Clock* const clock_ RTC_GUARDED_BY(&sequenced_checker_); + int64_t last_bwe_log_time_ RTC_GUARDED_BY(&sequenced_checker_); + uint32_t total_requested_padding_bitrate_ RTC_GUARDED_BY(&sequenced_checker_); + uint32_t total_requested_min_bitrate_ RTC_GUARDED_BY(&sequenced_checker_); }; } // namespace webrtc #endif // WEBRTC_CALL_BITRATE_ALLOCATOR_H_ diff --git a/webrtc/call/bitrate_estimator_tests.cc b/webrtc/call/bitrate_estimator_tests.cc index 5d4acbb76a..49f149bf0a 100644 --- a/webrtc/call/bitrate_estimator_tests.cc +++ b/webrtc/call/bitrate_estimator_tests.cc @@ -83,8 +83,8 @@ class LogObserver { private: typedef std::list Strings; rtc::CriticalSection crit_sect_; - Strings received_log_lines_ GUARDED_BY(crit_sect_); - Strings expected_log_lines_ GUARDED_BY(crit_sect_); + Strings received_log_lines_ RTC_GUARDED_BY(crit_sect_); + Strings expected_log_lines_ RTC_GUARDED_BY(crit_sect_); rtc::Event done_; }; diff --git a/webrtc/call/call.cc b/webrtc/call/call.cc index e8b51f9bb1..b7cd059085 100644 --- a/webrtc/call/call.cc +++ b/webrtc/call/call.cc @@ -236,11 +236,11 @@ class Call : public webrtc::Call, size_t length, const PacketTime& packet_time); void ConfigureSync(const std::string& sync_group) - EXCLUSIVE_LOCKS_REQUIRED(receive_crit_); + RTC_EXCLUSIVE_LOCKS_REQUIRED(receive_crit_); void NotifyBweOfReceivedPacket(const RtpPacketReceived& packet, MediaType media_type) - SHARED_LOCKS_REQUIRED(receive_crit_); + RTC_SHARED_LOCKS_REQUIRED(receive_crit_); rtc::Optional ParseRtpPacket( const uint8_t* packet, @@ -248,7 +248,7 @@ class Call : public webrtc::Call, const PacketTime* packet_time) const; void UpdateSendHistograms(int64_t first_sent_packet_ms) - EXCLUSIVE_LOCKS_REQUIRED(&bitrate_crit_); + RTC_EXCLUSIVE_LOCKS_REQUIRED(&bitrate_crit_); void UpdateReceiveHistograms(); void UpdateHistograms(); void UpdateAggregateNetworkState(); @@ -274,12 +274,12 @@ class Call : public webrtc::Call, // Audio, Video, and FlexFEC receive streams are owned by the client that // creates them. std::set audio_receive_streams_ - GUARDED_BY(receive_crit_); + RTC_GUARDED_BY(receive_crit_); std::set video_receive_streams_ - GUARDED_BY(receive_crit_); + RTC_GUARDED_BY(receive_crit_); std::map sync_stream_mapping_ - GUARDED_BY(receive_crit_); + RTC_GUARDED_BY(receive_crit_); // TODO(nisse): Should eventually be injected at creation, // with a single object in the bundled case. @@ -308,19 +308,21 @@ class Call : public webrtc::Call, bool use_send_side_bwe = false; }; std::map receive_rtp_config_ - GUARDED_BY(receive_crit_); + RTC_GUARDED_BY(receive_crit_); std::unique_ptr send_crit_; // Audio and Video send streams are owned by the client that creates them. - std::map audio_send_ssrcs_ GUARDED_BY(send_crit_); - std::map video_send_ssrcs_ GUARDED_BY(send_crit_); - std::set video_send_streams_ GUARDED_BY(send_crit_); + std::map audio_send_ssrcs_ + RTC_GUARDED_BY(send_crit_); + std::map video_send_ssrcs_ + RTC_GUARDED_BY(send_crit_); + std::set video_send_streams_ RTC_GUARDED_BY(send_crit_); using RtpStateMap = std::map; RtpStateMap suspended_audio_send_ssrcs_ - GUARDED_BY(configuration_sequence_checker_); + RTC_GUARDED_BY(configuration_sequence_checker_); RtpStateMap suspended_video_send_ssrcs_ - GUARDED_BY(configuration_sequence_checker_); + RTC_GUARDED_BY(configuration_sequence_checker_); webrtc::RtcEventLog* event_log_; @@ -340,10 +342,11 @@ class Call : public webrtc::Call, // TODO(holmer): Remove this lock once BitrateController no longer calls // OnNetworkChanged from multiple threads. rtc::CriticalSection bitrate_crit_; - uint32_t min_allocated_send_bitrate_bps_ GUARDED_BY(&bitrate_crit_); - uint32_t configured_max_padding_bitrate_bps_ GUARDED_BY(&bitrate_crit_); - AvgCounter estimated_send_bitrate_kbps_counter_ GUARDED_BY(&bitrate_crit_); - AvgCounter pacer_bitrate_kbps_counter_ GUARDED_BY(&bitrate_crit_); + uint32_t min_allocated_send_bitrate_bps_ RTC_GUARDED_BY(&bitrate_crit_); + uint32_t configured_max_padding_bitrate_bps_ RTC_GUARDED_BY(&bitrate_crit_); + AvgCounter estimated_send_bitrate_kbps_counter_ + RTC_GUARDED_BY(&bitrate_crit_); + AvgCounter pacer_bitrate_kbps_counter_ RTC_GUARDED_BY(&bitrate_crit_); std::map network_routes_; diff --git a/webrtc/call/call_perf_tests.cc b/webrtc/call/call_perf_tests.cc index 29dd0e4862..46611a1826 100644 --- a/webrtc/call/call_perf_tests.cc +++ b/webrtc/call/call_perf_tests.cc @@ -131,7 +131,7 @@ class VideoRtcpAndSyncObserver : public test::RtpRtcpObserver, const int64_t creation_time_ms_; int64_t first_time_in_sync_; rtc::CriticalSection crit_; - VideoReceiveStream* receive_stream_ GUARDED_BY(crit_); + VideoReceiveStream* receive_stream_ RTC_GUARDED_BY(crit_); std::vector sync_offset_ms_list_; }; @@ -463,7 +463,7 @@ void CallPerfTest::TestCaptureNtpTime(const FakeNetworkPipe::Config& net_config, bool rtp_start_timestamp_set_; uint32_t rtp_start_timestamp_; typedef std::map FrameCaptureTimeList; - FrameCaptureTimeList capture_time_list_ GUARDED_BY(&crit_); + FrameCaptureTimeList capture_time_list_ RTC_GUARDED_BY(&crit_); std::vector time_offset_ms_list_; } test(net_config, threshold_ms, start_time_ms, run_time_ms); diff --git a/webrtc/call/rtp_stream_receiver_controller.h b/webrtc/call/rtp_stream_receiver_controller.h index 4583b9d479..feec5e453c 100644 --- a/webrtc/call/rtp_stream_receiver_controller.h +++ b/webrtc/call/rtp_stream_receiver_controller.h @@ -64,7 +64,7 @@ class RtpStreamReceiverController // by a single, but possibly distinct, thread. But applications not // using Call may have use threads differently. rtc::CriticalSection lock_; - RtpDemuxer demuxer_ GUARDED_BY(&lock_); + RtpDemuxer demuxer_ RTC_GUARDED_BY(&lock_); }; } // namespace webrtc diff --git a/webrtc/common_video/include/bitrate_adjuster.h b/webrtc/common_video/include/bitrate_adjuster.h index 1b70ebdbd9..d04486ca0e 100644 --- a/webrtc/common_video/include/bitrate_adjuster.h +++ b/webrtc/common_video/include/bitrate_adjuster.h @@ -59,29 +59,30 @@ class BitrateAdjuster { bool IsWithinTolerance(uint32_t bitrate_bps, uint32_t target_bitrate_bps); // Returns smallest possible adjusted value. - uint32_t GetMinAdjustedBitrateBps() const EXCLUSIVE_LOCKS_REQUIRED(crit_); + uint32_t GetMinAdjustedBitrateBps() const RTC_EXCLUSIVE_LOCKS_REQUIRED(crit_); // Returns largest possible adjusted value. - uint32_t GetMaxAdjustedBitrateBps() const EXCLUSIVE_LOCKS_REQUIRED(crit_); + uint32_t GetMaxAdjustedBitrateBps() const RTC_EXCLUSIVE_LOCKS_REQUIRED(crit_); void Reset(); - void UpdateBitrate(uint32_t current_time_ms) EXCLUSIVE_LOCKS_REQUIRED(crit_); + void UpdateBitrate(uint32_t current_time_ms) + RTC_EXCLUSIVE_LOCKS_REQUIRED(crit_); rtc::CriticalSection crit_; Clock* const clock_; const float min_adjusted_bitrate_pct_; const float max_adjusted_bitrate_pct_; // The bitrate we want. - volatile uint32_t target_bitrate_bps_ GUARDED_BY(crit_); + volatile uint32_t target_bitrate_bps_ RTC_GUARDED_BY(crit_); // The bitrate we use to get what we want. - volatile uint32_t adjusted_bitrate_bps_ GUARDED_BY(crit_); + volatile uint32_t adjusted_bitrate_bps_ RTC_GUARDED_BY(crit_); // The target bitrate that the adjusted bitrate was computed from. - volatile uint32_t last_adjusted_target_bitrate_bps_ GUARDED_BY(crit_); + volatile uint32_t last_adjusted_target_bitrate_bps_ RTC_GUARDED_BY(crit_); // Used to estimate bitrate. - RateStatistics bitrate_tracker_ GUARDED_BY(crit_); + RateStatistics bitrate_tracker_ RTC_GUARDED_BY(crit_); // The last time we tried to adjust the bitrate. - uint32_t last_bitrate_update_time_ms_ GUARDED_BY(crit_); + uint32_t last_bitrate_update_time_ms_ RTC_GUARDED_BY(crit_); // The number of frames since the last time we tried to adjust the bitrate. - uint32_t frames_since_last_update_ GUARDED_BY(crit_); + uint32_t frames_since_last_update_ RTC_GUARDED_BY(crit_); }; } // namespace webrtc diff --git a/webrtc/logging/rtc_event_log/rtc_event_log.cc b/webrtc/logging/rtc_event_log/rtc_event_log.cc index d1cad89414..7c295aa0e3 100644 --- a/webrtc/logging/rtc_event_log/rtc_event_log.cc +++ b/webrtc/logging/rtc_event_log/rtc_event_log.cc @@ -168,15 +168,16 @@ class RtcEventLogImpl final : public RtcEventLog { // History containing all past configuration events. std::vector> config_history_ - ACCESS_ON(task_queue_); + RTC_ACCESS_ON(task_queue_); // History containing the most recent (non-configuration) events (~10s). - std::deque> history_ ACCESS_ON(task_queue_); + std::deque> history_ + RTC_ACCESS_ON(task_queue_); - std::unique_ptr file_ ACCESS_ON(task_queue_); + std::unique_ptr file_ RTC_ACCESS_ON(task_queue_); - size_t max_size_bytes_ ACCESS_ON(task_queue_); - size_t written_bytes_ ACCESS_ON(task_queue_); + size_t max_size_bytes_ RTC_ACCESS_ON(task_queue_); + size_t written_bytes_ RTC_ACCESS_ON(task_queue_); // Keep this last to ensure it destructs first, or else tasks living on the // queue might access other members after they've been torn down. diff --git a/webrtc/media/base/adaptedvideotracksource.h b/webrtc/media/base/adaptedvideotracksource.h index 9d51c692c2..7189996ecb 100644 --- a/webrtc/media/base/adaptedvideotracksource.h +++ b/webrtc/media/base/adaptedvideotracksource.h @@ -74,7 +74,7 @@ class AdaptedVideoTrackSource cricket::VideoAdapter video_adapter_; rtc::CriticalSection stats_crit_; - rtc::Optional stats_ GUARDED_BY(stats_crit_); + rtc::Optional stats_ RTC_GUARDED_BY(stats_crit_); VideoBroadcaster broadcaster_; }; diff --git a/webrtc/media/base/videoadapter.h b/webrtc/media/base/videoadapter.h index 61de4b5980..aa786af0bc 100644 --- a/webrtc/media/base/videoadapter.h +++ b/webrtc/media/base/videoadapter.h @@ -75,15 +75,17 @@ class VideoAdapter { // Resolution must be divisible by this factor. const int required_resolution_alignment_; // The target timestamp for the next frame based on requested format. - rtc::Optional next_frame_timestamp_ns_ GUARDED_BY(critical_section_); + rtc::Optional next_frame_timestamp_ns_ + RTC_GUARDED_BY(critical_section_); // Max number of pixels requested via calls to OnOutputFormatRequest, // OnResolutionRequest respectively. // The adapted output format is the minimum of these. - rtc::Optional requested_format_ GUARDED_BY(critical_section_); - int resolution_request_target_pixel_count_ GUARDED_BY(critical_section_); - int resolution_request_max_pixel_count_ GUARDED_BY(critical_section_); - int max_framerate_request_ GUARDED_BY(critical_section_); + rtc::Optional requested_format_ + RTC_GUARDED_BY(critical_section_); + int resolution_request_target_pixel_count_ RTC_GUARDED_BY(critical_section_); + int resolution_request_max_pixel_count_ RTC_GUARDED_BY(critical_section_); + int max_framerate_request_ RTC_GUARDED_BY(critical_section_); // The critical section to protect the above variables. rtc::CriticalSection critical_section_; diff --git a/webrtc/media/base/videobroadcaster.h b/webrtc/media/base/videobroadcaster.h index 312ec7be1f..32fefdd3b3 100644 --- a/webrtc/media/base/videobroadcaster.h +++ b/webrtc/media/base/videobroadcaster.h @@ -51,15 +51,15 @@ class VideoBroadcaster : public VideoSourceBase, void OnFrame(const webrtc::VideoFrame& frame) override; protected: - void UpdateWants() EXCLUSIVE_LOCKS_REQUIRED(sinks_and_wants_lock_); + void UpdateWants() RTC_EXCLUSIVE_LOCKS_REQUIRED(sinks_and_wants_lock_); const rtc::scoped_refptr& GetBlackFrameBuffer( - int width, int height) - EXCLUSIVE_LOCKS_REQUIRED(sinks_and_wants_lock_); + int width, + int height) RTC_EXCLUSIVE_LOCKS_REQUIRED(sinks_and_wants_lock_); ThreadChecker thread_checker_; rtc::CriticalSection sinks_and_wants_lock_; - VideoSinkWants current_wants_ GUARDED_BY(sinks_and_wants_lock_); + VideoSinkWants current_wants_ RTC_GUARDED_BY(sinks_and_wants_lock_); rtc::scoped_refptr black_frame_buffer_; }; diff --git a/webrtc/media/base/videocapturer.h b/webrtc/media/base/videocapturer.h index a65d40e5ef..10c5df9e3e 100644 --- a/webrtc/media/base/videocapturer.h +++ b/webrtc/media/base/videocapturer.h @@ -271,9 +271,9 @@ class VideoCapturer : public sigslot::has_slots<>, rtc::CriticalSection frame_stats_crit_; // The captured frame size before potential adapation. - bool input_size_valid_ GUARDED_BY(frame_stats_crit_) = false; - int input_width_ GUARDED_BY(frame_stats_crit_); - int input_height_ GUARDED_BY(frame_stats_crit_); + bool input_size_valid_ RTC_GUARDED_BY(frame_stats_crit_) = false; + int input_width_ RTC_GUARDED_BY(frame_stats_crit_); + int input_height_ RTC_GUARDED_BY(frame_stats_crit_); // Whether capturer should apply rotation to the frame before // passing it on to the registered sinks. diff --git a/webrtc/media/engine/fakewebrtcvideoengine.h b/webrtc/media/engine/fakewebrtcvideoengine.h index 604728cd02..e9afc76dd2 100644 --- a/webrtc/media/engine/fakewebrtcvideoengine.h +++ b/webrtc/media/engine/fakewebrtcvideoengine.h @@ -172,8 +172,8 @@ class FakeWebRtcVideoEncoder : public webrtc::VideoEncoder { private: rtc::CriticalSection crit_; rtc::Event init_encode_event_; - int num_frames_encoded_ GUARDED_BY(crit_); - webrtc::VideoCodec codec_settings_ GUARDED_BY(crit_); + int num_frames_encoded_ RTC_GUARDED_BY(crit_); + webrtc::VideoCodec codec_settings_ RTC_GUARDED_BY(crit_); }; // Fake class for mocking out WebRtcVideoEncoderFactory. @@ -250,8 +250,8 @@ class FakeWebRtcVideoEncoderFactory : public WebRtcVideoEncoderFactory { rtc::CriticalSection crit_; rtc::Event created_video_encoder_event_; std::vector codecs_; - std::vector encoders_ GUARDED_BY(crit_); - int num_created_encoders_ GUARDED_BY(crit_); + std::vector encoders_ RTC_GUARDED_BY(crit_); + int num_created_encoders_ RTC_GUARDED_BY(crit_); bool encoders_have_internal_sources_; }; diff --git a/webrtc/media/engine/webrtcvideoengine.h b/webrtc/media/engine/webrtcvideoengine.h index 7710c043d1..81a85c8f29 100644 --- a/webrtc/media/engine/webrtcvideoengine.h +++ b/webrtc/media/engine/webrtcvideoengine.h @@ -241,11 +241,11 @@ class WebRtcVideoChannel : public VideoMediaChannel, public webrtc::Transport { webrtc::FlexfecReceiveStream::Config* flexfec_config, const StreamParams& sp) const; bool ValidateSendSsrcAvailability(const StreamParams& sp) const - EXCLUSIVE_LOCKS_REQUIRED(stream_crit_); + RTC_EXCLUSIVE_LOCKS_REQUIRED(stream_crit_); bool ValidateReceiveSsrcAvailability(const StreamParams& sp) const - EXCLUSIVE_LOCKS_REQUIRED(stream_crit_); + RTC_EXCLUSIVE_LOCKS_REQUIRED(stream_crit_); void DeleteReceiveStream(WebRtcVideoReceiveStream* stream) - EXCLUSIVE_LOCKS_REQUIRED(stream_crit_); + RTC_EXCLUSIVE_LOCKS_REQUIRED(stream_crit_); static std::string CodecSettingsVectorToString( const std::vector& codecs); @@ -326,38 +326,38 @@ class WebRtcVideoChannel : public VideoMediaChannel, public webrtc::Transport { void UpdateSendState(); webrtc::VideoSendStream::DegradationPreference GetDegradationPreference() - const EXCLUSIVE_LOCKS_REQUIRED(&thread_checker_); + const RTC_EXCLUSIVE_LOCKS_REQUIRED(&thread_checker_); rtc::ThreadChecker thread_checker_; rtc::AsyncInvoker invoker_; rtc::Thread* worker_thread_; - const std::vector ssrcs_ ACCESS_ON(&thread_checker_); - const std::vector ssrc_groups_ ACCESS_ON(&thread_checker_); + const std::vector ssrcs_ RTC_ACCESS_ON(&thread_checker_); + const std::vector ssrc_groups_ RTC_ACCESS_ON(&thread_checker_); webrtc::Call* const call_; const bool enable_cpu_overuse_detection_; rtc::VideoSourceInterface* source_ - ACCESS_ON(&thread_checker_); + RTC_ACCESS_ON(&thread_checker_); std::unique_ptr encoder_factory_ - ACCESS_ON(&thread_checker_); + RTC_ACCESS_ON(&thread_checker_); - webrtc::VideoSendStream* stream_ ACCESS_ON(&thread_checker_); + webrtc::VideoSendStream* stream_ RTC_ACCESS_ON(&thread_checker_); rtc::VideoSinkInterface* encoder_sink_ - ACCESS_ON(&thread_checker_); + RTC_ACCESS_ON(&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_ ACCESS_ON(&thread_checker_); + VideoSendStreamParameters parameters_ RTC_ACCESS_ON(&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_ ACCESS_ON(&thread_checker_); + webrtc::RtpParameters rtp_parameters_ RTC_ACCESS_ON(&thread_checker_); std::unique_ptr allocated_encoder_ - ACCESS_ON(&thread_checker_); - VideoCodec allocated_codec_ ACCESS_ON(&thread_checker_); + RTC_ACCESS_ON(&thread_checker_); + VideoCodec allocated_codec_ RTC_ACCESS_ON(&thread_checker_); - bool sending_ ACCESS_ON(&thread_checker_); + bool sending_ RTC_ACCESS_ON(&thread_checker_); }; // Wrapper for the receiver part, contains configs etc. that are needed to @@ -437,15 +437,16 @@ class WebRtcVideoChannel : public VideoMediaChannel, public webrtc::Transport { std::vector allocated_decoders_; rtc::CriticalSection sink_lock_; - rtc::VideoSinkInterface* sink_ GUARDED_BY(sink_lock_); + rtc::VideoSinkInterface* sink_ + RTC_GUARDED_BY(sink_lock_); // Expands remote RTP timestamps to int64_t to be able to estimate how long // the stream has been running. rtc::TimestampWrapAroundHandler timestamp_wraparound_handler_ - GUARDED_BY(sink_lock_); - int64_t first_frame_timestamp_ GUARDED_BY(sink_lock_); + RTC_GUARDED_BY(sink_lock_); + int64_t first_frame_timestamp_ RTC_GUARDED_BY(sink_lock_); // Start NTP time is estimated as current remote NTP time (estimated from // RTCP) minus the elapsed time, as soon as remote NTP time is available. - int64_t estimated_remote_start_ntp_time_ms_ GUARDED_BY(sink_lock_); + int64_t estimated_remote_start_ntp_time_ms_ RTC_GUARDED_BY(sink_lock_); }; void Construct(webrtc::Call* call, WebRtcVideoEngine* engine); @@ -487,11 +488,11 @@ class WebRtcVideoChannel : public VideoMediaChannel, public webrtc::Transport { rtc::CriticalSection stream_crit_; // Using primary-ssrc (first ssrc) as key. std::map send_streams_ - GUARDED_BY(stream_crit_); + RTC_GUARDED_BY(stream_crit_); std::map receive_streams_ - GUARDED_BY(stream_crit_); - std::set send_ssrcs_ GUARDED_BY(stream_crit_); - std::set receive_ssrcs_ GUARDED_BY(stream_crit_); + RTC_GUARDED_BY(stream_crit_); + std::set send_ssrcs_ RTC_GUARDED_BY(stream_crit_); + std::set receive_ssrcs_ RTC_GUARDED_BY(stream_crit_); rtc::Optional send_codec_; rtc::Optional> send_rtp_extensions_; diff --git a/webrtc/pc/mediamonitor.h b/webrtc/pc/mediamonitor.h index 5f2a1e23b9..b4efefb01b 100644 --- a/webrtc/pc/mediamonitor.h +++ b/webrtc/pc/mediamonitor.h @@ -61,7 +61,7 @@ class MediaMonitorT : public MediaMonitor { media_info_.Clear(); media_channel_->GetStats(&media_info_); } - virtual void Update() EXCLUSIVE_LOCKS_REQUIRED(crit_) { + virtual void Update() RTC_EXCLUSIVE_LOCKS_REQUIRED(crit_) { MI stats(media_info_); crit_.Leave(); SignalUpdate(media_channel_, stats); diff --git a/webrtc/pc/videotrack.h b/webrtc/pc/videotrack.h index 6e20e978b9..d0f0618b43 100644 --- a/webrtc/pc/videotrack.h +++ b/webrtc/pc/videotrack.h @@ -55,7 +55,7 @@ class VideoTrack : public MediaStreamTrack, rtc::Thread* const worker_thread_; rtc::ThreadChecker signaling_thread_checker_; rtc::scoped_refptr video_source_; - ContentHint content_hint_ GUARDED_BY(signaling_thread_checker_); + ContentHint content_hint_ RTC_GUARDED_BY(signaling_thread_checker_); }; } // namespace webrtc diff --git a/webrtc/rtc_base/task_queue_win.cc b/webrtc/rtc_base/task_queue_win.cc index 00a8c79827..6ff64c0789 100644 --- a/webrtc/rtc_base/task_queue_win.cc +++ b/webrtc/rtc_base/task_queue_win.cc @@ -236,7 +236,8 @@ class TaskQueue::Impl : public RefCountInterface { TaskQueue* const queue_; WorkerThread thread_; rtc::CriticalSection pending_lock_; - std::queue> pending_ GUARDED_BY(pending_lock_); + std::queue> pending_ + RTC_GUARDED_BY(pending_lock_); HANDLE in_queue_; }; diff --git a/webrtc/rtc_tools/network_tester/packet_sender.h b/webrtc/rtc_tools/network_tester/packet_sender.h index d47543d08f..78c3ab8b80 100644 --- a/webrtc/rtc_tools/network_tester/packet_sender.h +++ b/webrtc/rtc_tools/network_tester/packet_sender.h @@ -49,10 +49,10 @@ class PacketSender { private: rtc::SequencedTaskChecker worker_queue_checker_; - size_t packet_size_ ACCESS_ON(worker_queue_checker_); - int64_t send_interval_ms_ ACCESS_ON(worker_queue_checker_); - int64_t sequence_number_ ACCESS_ON(worker_queue_checker_); - bool sending_ ACCESS_ON(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_); const std::string config_file_path_; TestController* const test_controller_; rtc::TaskQueue worker_queue_; diff --git a/webrtc/rtc_tools/network_tester/test_controller.h b/webrtc/rtc_tools/network_tester/test_controller.h index 14ee0c4e16..870ca47548 100644 --- a/webrtc/rtc_tools/network_tester/test_controller.h +++ b/webrtc/rtc_tools/network_tester/test_controller.h @@ -67,7 +67,7 @@ class TestController : public sigslot::has_slots<> { const std::string config_file_path_; PacketLogger packet_logger_; rtc::CriticalSection local_test_done_lock_; - bool local_test_done_ GUARDED_BY(local_test_done_lock_); + bool local_test_done_ RTC_GUARDED_BY(local_test_done_lock_); bool remote_test_done_; std::array send_data_; std::unique_ptr udp_transport_; diff --git a/webrtc/system_wrappers/include/rw_lock_wrapper.h b/webrtc/system_wrappers/include/rw_lock_wrapper.h index 855ecffc71..62e75b4547 100644 --- a/webrtc/system_wrappers/include/rw_lock_wrapper.h +++ b/webrtc/system_wrappers/include/rw_lock_wrapper.h @@ -19,45 +19,41 @@ namespace webrtc { -class LOCKABLE RWLockWrapper { +class RTC_LOCKABLE RWLockWrapper { public: static RWLockWrapper* CreateRWLock(); virtual ~RWLockWrapper() {} - virtual void AcquireLockExclusive() EXCLUSIVE_LOCK_FUNCTION() = 0; - virtual void ReleaseLockExclusive() UNLOCK_FUNCTION() = 0; + virtual void AcquireLockExclusive() RTC_EXCLUSIVE_LOCK_FUNCTION() = 0; + virtual void ReleaseLockExclusive() RTC_UNLOCK_FUNCTION() = 0; - virtual void AcquireLockShared() SHARED_LOCK_FUNCTION() = 0; - virtual void ReleaseLockShared() UNLOCK_FUNCTION() = 0; + virtual void AcquireLockShared() RTC_SHARED_LOCK_FUNCTION() = 0; + virtual void ReleaseLockShared() RTC_UNLOCK_FUNCTION() = 0; }; // RAII extensions of the RW lock. Prevents Acquire/Release missmatches and // provides more compact locking syntax. -class SCOPED_LOCKABLE ReadLockScoped { +class RTC_SCOPED_LOCKABLE ReadLockScoped { public: - ReadLockScoped(RWLockWrapper& rw_lock) SHARED_LOCK_FUNCTION(rw_lock) + ReadLockScoped(RWLockWrapper& rw_lock) RTC_SHARED_LOCK_FUNCTION(rw_lock) : rw_lock_(rw_lock) { rw_lock_.AcquireLockShared(); } - ~ReadLockScoped() UNLOCK_FUNCTION() { - rw_lock_.ReleaseLockShared(); - } + ~ReadLockScoped() RTC_UNLOCK_FUNCTION() { rw_lock_.ReleaseLockShared(); } private: RWLockWrapper& rw_lock_; }; -class SCOPED_LOCKABLE WriteLockScoped { +class RTC_SCOPED_LOCKABLE WriteLockScoped { public: - WriteLockScoped(RWLockWrapper& rw_lock) EXCLUSIVE_LOCK_FUNCTION(rw_lock) + WriteLockScoped(RWLockWrapper& rw_lock) RTC_EXCLUSIVE_LOCK_FUNCTION(rw_lock) : rw_lock_(rw_lock) { rw_lock_.AcquireLockExclusive(); } - ~WriteLockScoped() UNLOCK_FUNCTION() { - rw_lock_.ReleaseLockExclusive(); - } + ~WriteLockScoped() RTC_UNLOCK_FUNCTION() { rw_lock_.ReleaseLockExclusive(); } private: RWLockWrapper& rw_lock_; diff --git a/webrtc/system_wrappers/source/metrics_default.cc b/webrtc/system_wrappers/source/metrics_default.cc index f9a6f6aaf9..6e5715ea23 100644 --- a/webrtc/system_wrappers/source/metrics_default.cc +++ b/webrtc/system_wrappers/source/metrics_default.cc @@ -93,7 +93,7 @@ class RtcHistogram { rtc::CriticalSection crit_; const int min_; const int max_; - SampleInfo info_ GUARDED_BY(crit_); + SampleInfo info_ RTC_GUARDED_BY(crit_); RTC_DISALLOW_COPY_AND_ASSIGN(RtcHistogram); }; @@ -165,7 +165,8 @@ class RtcHistogramMap { private: rtc::CriticalSection crit_; - std::map> map_ GUARDED_BY(crit_); + std::map> map_ + RTC_GUARDED_BY(crit_); RTC_DISALLOW_COPY_AND_ASSIGN(RtcHistogramMap); }; diff --git a/webrtc/system_wrappers/source/trace_impl.h b/webrtc/system_wrappers/source/trace_impl.h index 90e4a3af3b..0e36aff4c9 100644 --- a/webrtc/system_wrappers/source/trace_impl.h +++ b/webrtc/system_wrappers/source/trace_impl.h @@ -81,7 +81,7 @@ class TraceImpl : public Trace { bool UpdateFileName( char file_name_with_counter_utf8[FileWrapper::kMaxFileNameSize], - const uint32_t new_count) const EXCLUSIVE_LOCKS_REQUIRED(crit_); + const uint32_t new_count) const RTC_EXCLUSIVE_LOCKS_REQUIRED(crit_); bool CreateFileName( const char file_name_utf8[FileWrapper::kMaxFileNameSize], @@ -89,14 +89,14 @@ class TraceImpl : public Trace { const uint32_t new_count) const; void WriteToFile(const char* msg, uint16_t length) - EXCLUSIVE_LOCKS_REQUIRED(crit_); + RTC_EXCLUSIVE_LOCKS_REQUIRED(crit_); - TraceCallback* callback_ GUARDED_BY(crit_); - uint32_t row_count_text_ GUARDED_BY(crit_); - uint32_t file_count_text_ GUARDED_BY(crit_); + TraceCallback* callback_ RTC_GUARDED_BY(crit_); + uint32_t row_count_text_ RTC_GUARDED_BY(crit_); + uint32_t file_count_text_ RTC_GUARDED_BY(crit_); - const std::unique_ptr trace_file_ GUARDED_BY(crit_); - std::string trace_file_path_ GUARDED_BY(crit_); + const std::unique_ptr trace_file_ RTC_GUARDED_BY(crit_); + std::string trace_file_path_ RTC_GUARDED_BY(crit_); rtc::CriticalSection crit_; }; diff --git a/webrtc/test/direct_transport.h b/webrtc/test/direct_transport.h index 11b086dfad..c60157dc22 100644 --- a/webrtc/test/direct_transport.h +++ b/webrtc/test/direct_transport.h @@ -70,7 +70,7 @@ class DirectTransport : public Transport { SingleThreadedTaskQueueForTesting* const task_queue_; SingleThreadedTaskQueueForTesting::TaskId next_scheduled_task_ - GUARDED_BY(&sequence_checker_); + RTC_GUARDED_BY(&sequence_checker_); FakeNetworkPipe fake_network_; diff --git a/webrtc/test/fake_audio_device.h b/webrtc/test/fake_audio_device.h index db56c745e0..939d16a411 100644 --- a/webrtc/test/fake_audio_device.h +++ b/webrtc/test/fake_audio_device.h @@ -121,19 +121,19 @@ class FakeAudioDevice : public FakeAudioDeviceModule { static bool Run(void* obj); void ProcessAudio(); - const std::unique_ptr capturer_ GUARDED_BY(lock_); - const std::unique_ptr renderer_ GUARDED_BY(lock_); + const std::unique_ptr capturer_ RTC_GUARDED_BY(lock_); + const std::unique_ptr renderer_ RTC_GUARDED_BY(lock_); const float speed_; rtc::CriticalSection lock_; - AudioTransport* audio_callback_ GUARDED_BY(lock_); - bool rendering_ GUARDED_BY(lock_); - bool capturing_ GUARDED_BY(lock_); + AudioTransport* audio_callback_ RTC_GUARDED_BY(lock_); + bool rendering_ RTC_GUARDED_BY(lock_); + bool capturing_ RTC_GUARDED_BY(lock_); rtc::Event done_rendering_; rtc::Event done_capturing_; - std::vector playout_buffer_ GUARDED_BY(lock_); - rtc::BufferT recording_buffer_ GUARDED_BY(lock_); + std::vector playout_buffer_ RTC_GUARDED_BY(lock_); + rtc::BufferT recording_buffer_ RTC_GUARDED_BY(lock_); std::unique_ptr tick_; rtc::PlatformThread thread_; diff --git a/webrtc/test/fake_encoder.h b/webrtc/test/fake_encoder.h index 96218e5c27..c8912a197d 100644 --- a/webrtc/test/fake_encoder.h +++ b/webrtc/test/fake_encoder.h @@ -51,12 +51,12 @@ class FakeEncoder : public VideoEncoder { protected: Clock* const clock_; - VideoCodec config_ GUARDED_BY(crit_sect_); - EncodedImageCallback* callback_ GUARDED_BY(crit_sect_); - BitrateAllocation target_bitrate_ GUARDED_BY(crit_sect_); - int configured_input_framerate_ GUARDED_BY(crit_sect_); - int max_target_bitrate_kbps_ GUARDED_BY(crit_sect_); - bool pending_keyframe_ GUARDED_BY(crit_sect_); + VideoCodec config_ RTC_GUARDED_BY(crit_sect_); + EncodedImageCallback* callback_ RTC_GUARDED_BY(crit_sect_); + BitrateAllocation target_bitrate_ RTC_GUARDED_BY(crit_sect_); + int configured_input_framerate_ RTC_GUARDED_BY(crit_sect_); + int max_target_bitrate_kbps_ RTC_GUARDED_BY(crit_sect_); + bool pending_keyframe_ RTC_GUARDED_BY(crit_sect_); rtc::CriticalSection crit_sect_; uint8_t encoded_buffer_[100000]; @@ -79,8 +79,8 @@ class FakeH264Encoder : public FakeEncoder, public EncodedImageCallback { const RTPFragmentationHeader* fragments) override; private: - EncodedImageCallback* callback_ GUARDED_BY(local_crit_sect_); - int idr_counter_ GUARDED_BY(local_crit_sect_); + EncodedImageCallback* callback_ RTC_GUARDED_BY(local_crit_sect_); + int idr_counter_ RTC_GUARDED_BY(local_crit_sect_); rtc::CriticalSection local_crit_sect_; }; @@ -95,7 +95,7 @@ class DelayedEncoder : public test::FakeEncoder { const std::vector* frame_types) override; private: - int delay_ms_ ACCESS_ON(sequence_checker_); + int delay_ms_ RTC_ACCESS_ON(sequence_checker_); rtc::SequencedTaskChecker sequence_checker_; }; @@ -125,9 +125,9 @@ class MultithreadedFakeH264Encoder : public test::FakeH264Encoder { protected: class EncodeTask; - int current_queue_ ACCESS_ON(sequence_checker_); - std::unique_ptr queue1_ ACCESS_ON(sequence_checker_); - std::unique_ptr queue2_ ACCESS_ON(sequence_checker_); + 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_); rtc::SequencedTaskChecker sequence_checker_; }; diff --git a/webrtc/test/frame_generator.cc b/webrtc/test/frame_generator.cc index 1956cdb3d7..eff2ec237d 100644 --- a/webrtc/test/frame_generator.cc +++ b/webrtc/test/frame_generator.cc @@ -108,10 +108,10 @@ class SquareGenerator : public FrameGenerator { }; rtc::CriticalSection crit_; - int width_ GUARDED_BY(&crit_); - int height_ GUARDED_BY(&crit_); - std::vector> squares_ GUARDED_BY(&crit_); - std::unique_ptr frame_ GUARDED_BY(&crit_); + int width_ RTC_GUARDED_BY(&crit_); + int height_ RTC_GUARDED_BY(&crit_); + std::vector> squares_ RTC_GUARDED_BY(&crit_); + std::unique_ptr frame_ RTC_GUARDED_BY(&crit_); }; class YuvFileGenerator : public FrameGenerator { diff --git a/webrtc/test/frame_generator.h b/webrtc/test/frame_generator.h index dfe35b832e..d42f2268a2 100644 --- a/webrtc/test/frame_generator.h +++ b/webrtc/test/frame_generator.h @@ -42,8 +42,8 @@ class FrameForwarder : public rtc::VideoSourceInterface { void RemoveSink(rtc::VideoSinkInterface* sink) override; rtc::CriticalSection crit_; - rtc::VideoSinkInterface* sink_ GUARDED_BY(crit_); - rtc::VideoSinkWants sink_wants_ GUARDED_BY(crit_); + rtc::VideoSinkInterface* sink_ RTC_GUARDED_BY(crit_); + rtc::VideoSinkWants sink_wants_ RTC_GUARDED_BY(crit_); }; class FrameGenerator { diff --git a/webrtc/test/frame_generator_capturer.h b/webrtc/test/frame_generator_capturer.h index 44251218af..8f3232c3e4 100644 --- a/webrtc/test/frame_generator_capturer.h +++ b/webrtc/test/frame_generator_capturer.h @@ -87,14 +87,14 @@ class FrameGeneratorCapturer : public VideoCapturer { Clock* const clock_; bool sending_; - rtc::VideoSinkInterface* sink_ GUARDED_BY(&lock_); - SinkWantsObserver* sink_wants_observer_ GUARDED_BY(&lock_); + rtc::VideoSinkInterface* sink_ RTC_GUARDED_BY(&lock_); + SinkWantsObserver* sink_wants_observer_ RTC_GUARDED_BY(&lock_); rtc::CriticalSection lock_; std::unique_ptr frame_generator_; - int target_fps_ GUARDED_BY(&lock_); - rtc::Optional wanted_fps_ GUARDED_BY(&lock_); + int target_fps_ RTC_GUARDED_BY(&lock_); + rtc::Optional wanted_fps_ RTC_GUARDED_BY(&lock_); VideoRotation fake_rotation_ = kVideoRotation_0; int64_t first_frame_capture_time_; diff --git a/webrtc/test/single_threaded_task_queue.h b/webrtc/test/single_threaded_task_queue.h index ecb22b38eb..c078bdd077 100644 --- a/webrtc/test/single_threaded_task_queue.h +++ b/webrtc/test/single_threaded_task_queue.h @@ -71,10 +71,10 @@ class SingleThreadedTaskQueueForTesting { void RunLoop(); rtc::CriticalSection cs_; - std::list> tasks_ GUARDED_BY(cs_); + std::list> tasks_ RTC_GUARDED_BY(cs_); rtc::ThreadChecker owner_thread_checker_; rtc::PlatformThread thread_; - bool running_ GUARDED_BY(cs_); + bool running_ RTC_GUARDED_BY(cs_); TaskId next_task_id_; diff --git a/webrtc/test/vcm_capturer.h b/webrtc/test/vcm_capturer.h index fdb594b10e..2b4323c0e5 100644 --- a/webrtc/test/vcm_capturer.h +++ b/webrtc/test/vcm_capturer.h @@ -49,8 +49,8 @@ class VcmCapturer void Destroy(); rtc::CriticalSection crit_; - bool started_ GUARDED_BY(crit_); - rtc::VideoSinkInterface* sink_ GUARDED_BY(crit_); + bool started_ RTC_GUARDED_BY(crit_); + rtc::VideoSinkInterface* sink_ RTC_GUARDED_BY(crit_); rtc::scoped_refptr vcm_; VideoCaptureCapability capability_; }; diff --git a/webrtc/video/call_stats.h b/webrtc/video/call_stats.h index a9b42804aa..efa98adcd9 100644 --- a/webrtc/video/call_stats.h +++ b/webrtc/video/call_stats.h @@ -70,9 +70,9 @@ class CallStats : public Module { // The last RTT in the statistics update (zero if there is no valid estimate). int64_t max_rtt_ms_; int64_t avg_rtt_ms_; - int64_t sum_avg_rtt_ms_ GUARDED_BY(crit_); - int64_t num_avg_rtt_ GUARDED_BY(crit_); - int64_t time_of_first_rtt_ms_ GUARDED_BY(crit_); + int64_t sum_avg_rtt_ms_ RTC_GUARDED_BY(crit_); + int64_t num_avg_rtt_ RTC_GUARDED_BY(crit_); + int64_t time_of_first_rtt_ms_ RTC_GUARDED_BY(crit_); // All Rtt reports within valid time interval, oldest first. std::list reports_; diff --git a/webrtc/video/encoder_rtcp_feedback.h b/webrtc/video/encoder_rtcp_feedback.h index 2f24e31ca5..0e5b13b3e8 100644 --- a/webrtc/video/encoder_rtcp_feedback.h +++ b/webrtc/video/encoder_rtcp_feedback.h @@ -37,7 +37,7 @@ class EncoderRtcpFeedback : public RtcpIntraFrameObserver { VideoStreamEncoder* const video_stream_encoder_; rtc::CriticalSection crit_; - std::vector time_last_intra_request_ms_ GUARDED_BY(crit_); + std::vector time_last_intra_request_ms_ RTC_GUARDED_BY(crit_); }; } // namespace webrtc diff --git a/webrtc/video/end_to_end_tests.cc b/webrtc/video/end_to_end_tests.cc index 644319cf79..ffd52fd531 100644 --- a/webrtc/video/end_to_end_tests.cc +++ b/webrtc/video/end_to_end_tests.cc @@ -540,7 +540,7 @@ TEST_F(EndToEndTest, ReceivesAndRetransmitsNack) { std::set retransmitted_packets_; uint64_t sent_rtp_packets_; int packets_left_to_drop_; - int nacks_left_ GUARDED_BY(&crit_); + int nacks_left_ RTC_GUARDED_BY(&crit_); } test; RunBaseTest(&test); @@ -710,11 +710,11 @@ TEST_F(EndToEndTest, ReceivesUlpfec) { rtc::CriticalSection crit_; std::unique_ptr encoder_; std::unique_ptr decoder_; - std::set dropped_sequence_numbers_ GUARDED_BY(crit_); + std::set dropped_sequence_numbers_ RTC_GUARDED_BY(crit_); // Several packets can have the same timestamp. - std::multiset dropped_timestamps_ GUARDED_BY(crit_); + std::multiset dropped_timestamps_ RTC_GUARDED_BY(crit_); Random random_; - int num_packets_sent_ GUARDED_BY(crit_); + int num_packets_sent_ RTC_GUARDED_BY(crit_); } test; RunBaseTest(&test); @@ -887,12 +887,12 @@ class FlexfecRenderObserver : public test::EndToEndTest, } rtc::CriticalSection crit_; - std::set dropped_sequence_numbers_ GUARDED_BY(crit_); + std::set dropped_sequence_numbers_ RTC_GUARDED_BY(crit_); // Several packets can have the same timestamp. - std::multiset dropped_timestamps_ GUARDED_BY(crit_); + std::multiset dropped_timestamps_ RTC_GUARDED_BY(crit_); const bool enable_nack_; const bool expect_flexfec_rtcp_; - bool received_flexfec_rtcp_ GUARDED_BY(crit_); + bool received_flexfec_rtcp_ RTC_GUARDED_BY(crit_); Random random_; int num_packets_sent_; }; @@ -1069,7 +1069,7 @@ TEST_F(EndToEndTest, ReceivedUlpfecPacketsNotNacked) { } state_; rtc::CriticalSection crit_; - uint16_t ulpfec_sequence_number_ GUARDED_BY(&crit_); + uint16_t ulpfec_sequence_number_ RTC_GUARDED_BY(&crit_); bool has_last_sequence_number_; uint16_t last_sequence_number_; std::unique_ptr encoder_; @@ -1224,8 +1224,8 @@ void EndToEndTest::DecodesRetransmittedFrame(bool enable_rtx, bool enable_red) { std::unique_ptr encoder_; const std::string payload_name_; int marker_bits_observed_; - uint32_t retransmitted_timestamp_ GUARDED_BY(&crit_); - std::vector rendered_timestamps_ GUARDED_BY(&crit_); + uint32_t retransmitted_timestamp_ RTC_GUARDED_BY(&crit_); + std::vector rendered_timestamps_ RTC_GUARDED_BY(&crit_); } test(enable_rtx, enable_red); RunBaseTest(&test); @@ -1319,9 +1319,9 @@ void EndToEndTest::ReceivesPliAndRecovers(int rtp_history_ms) { rtc::CriticalSection crit_; int rtp_history_ms_; bool nack_enabled_; - uint32_t highest_dropped_timestamp_ GUARDED_BY(&crit_); - int frames_to_drop_ GUARDED_BY(&crit_); - bool received_pli_ GUARDED_BY(&crit_); + uint32_t highest_dropped_timestamp_ RTC_GUARDED_BY(&crit_); + int frames_to_drop_ RTC_GUARDED_BY(&crit_); + bool received_pli_ RTC_GUARDED_BY(&crit_); } test(rtp_history_ms); RunBaseTest(&test); @@ -1479,8 +1479,8 @@ void EndToEndTest::RespectsRtcpMode(RtcpMode rtcp_mode) { rtc::CriticalSection crit_; // Must be protected since RTCP can be sent by both the process thread // and the pacer thread. - int sent_rtp_ GUARDED_BY(&crit_); - int sent_rtcp_ GUARDED_BY(&crit_); + int sent_rtp_ RTC_GUARDED_BY(&crit_); + int sent_rtcp_ RTC_GUARDED_BY(&crit_); } test(rtcp_mode); RunBaseTest(&test); @@ -2075,8 +2075,8 @@ TEST_F(EndToEndTest, StopsSendingMediaWithoutFeedback) { const size_t num_video_streams_; const size_t num_audio_streams_; rtc::CriticalSection crit_; - int media_sent_ GUARDED_BY(crit_); - int padding_sent_ GUARDED_BY(crit_); + int media_sent_ RTC_GUARDED_BY(crit_); + int padding_sent_ RTC_GUARDED_BY(crit_); } test(1, 0); RunBaseTest(&test); } @@ -2623,7 +2623,7 @@ TEST_F(EndToEndTest, VerifyNackStats) { return SEND_PACKET; } - void VerifyStats() EXCLUSIVE_LOCKS_REQUIRED(&crit_) { + void VerifyStats() RTC_EXCLUSIVE_LOCKS_REQUIRED(&crit_) { if (!dropped_rtp_packet_requested_) return; int send_stream_nack_packets = 0; @@ -2680,8 +2680,8 @@ TEST_F(EndToEndTest, VerifyNackStats) { test::FakeVideoRenderer fake_renderer_; rtc::CriticalSection crit_; uint64_t sent_rtp_packets_; - uint16_t dropped_rtp_packet_ GUARDED_BY(&crit_); - bool dropped_rtp_packet_requested_ GUARDED_BY(&crit_); + uint16_t dropped_rtp_packet_ RTC_GUARDED_BY(&crit_); + bool dropped_rtp_packet_requested_ RTC_GUARDED_BY(&crit_); std::vector receive_streams_; VideoSendStream* send_stream_; int64_t start_runtime_ms_; @@ -2803,7 +2803,7 @@ void EndToEndTest::VerifyHistogramStats(bool use_rtx, Call* sender_call_; Call* receiver_call_; int64_t start_runtime_ms_; - int num_frames_received_ GUARDED_BY(&crit_); + int num_frames_received_ RTC_GUARDED_BY(&crit_); } test(use_rtx, use_red, screenshare); metrics::Reset(); @@ -2973,7 +2973,7 @@ TEST_F(EndToEndTest, MAYBE_ContentTypeSwitches) { } rtc::CriticalSection crit_; - int num_frames_received_ GUARDED_BY(&crit_); + int num_frames_received_ RTC_GUARDED_BY(&crit_); } test; metrics::Reset(); @@ -3277,7 +3277,7 @@ TEST_F(EndToEndTest, ReportsSetEncoderRates) { test::SingleThreadedTaskQueueForTesting* const task_queue_; rtc::CriticalSection crit_; VideoSendStream* send_stream_; - uint32_t bitrate_kbps_ GUARDED_BY(crit_); + uint32_t bitrate_kbps_ RTC_GUARDED_BY(crit_); } test(&task_queue_); RunBaseTest(&test); @@ -3762,9 +3762,9 @@ class RtcpXrObserver : public test::EndToEndTest { const bool enable_rrtr_; const bool enable_target_bitrate_; int sent_rtcp_sr_; - int sent_rtcp_rr_ GUARDED_BY(&crit_); - int sent_rtcp_rrtr_ GUARDED_BY(&crit_); - bool sent_rtcp_target_bitrate_ GUARDED_BY(&crit_); + int sent_rtcp_rr_ RTC_GUARDED_BY(&crit_); + int sent_rtcp_rrtr_ RTC_GUARDED_BY(&crit_); + bool sent_rtcp_target_bitrate_ RTC_GUARDED_BY(&crit_); int sent_rtcp_dlrr_; }; @@ -3994,7 +3994,7 @@ void EndToEndTest::TestRtpStatePreservation(bool use_rtx, void ValidateTimestampGap(uint32_t ssrc, uint32_t timestamp, bool only_padding) - EXCLUSIVE_LOCKS_REQUIRED(crit_) { + RTC_EXCLUSIVE_LOCKS_REQUIRED(crit_) { static const int32_t kMaxTimestampGap = kDefaultTimeoutMs * 90; auto timestamp_it = last_observed_timestamp_.find(ssrc); if (timestamp_it == last_observed_timestamp_.end()) { @@ -4083,8 +4083,8 @@ void EndToEndTest::TestRtpStatePreservation(bool use_rtx, std::map ssrc_is_rtx_; rtc::CriticalSection crit_; - size_t ssrcs_to_observe_ GUARDED_BY(crit_); - std::map ssrc_observed_ GUARDED_BY(crit_); + size_t ssrcs_to_observe_ RTC_GUARDED_BY(crit_); + std::map ssrc_observed_ RTC_GUARDED_BY(crit_); } observer(use_rtx); std::unique_ptr send_transport; @@ -4276,9 +4276,10 @@ TEST_F(EndToEndTest, MAYBE_TestFlexfecRtpStatePreservation) { return SEND_PACKET; } - rtc::Optional last_observed_sequence_number_ GUARDED_BY(crit_); - rtc::Optional last_observed_timestamp_ GUARDED_BY(crit_); - size_t num_flexfec_packets_sent_ GUARDED_BY(crit_); + rtc::Optional last_observed_sequence_number_ + RTC_GUARDED_BY(crit_); + rtc::Optional last_observed_timestamp_ RTC_GUARDED_BY(crit_); + size_t num_flexfec_packets_sent_ RTC_GUARDED_BY(crit_); rtc::CriticalSection crit_; } observer; @@ -4595,12 +4596,12 @@ TEST_F(EndToEndTest, RespectsNetworkState) { rtc::Event packet_event_; Call* sender_call_; Call* receiver_call_; - NetworkState sender_state_ GUARDED_BY(test_crit_); - int sender_rtp_ GUARDED_BY(test_crit_); - int sender_padding_ GUARDED_BY(test_crit_); - int sender_rtcp_ GUARDED_BY(test_crit_); - int receiver_rtcp_ GUARDED_BY(test_crit_); - int down_frames_ GUARDED_BY(test_crit_); + NetworkState sender_state_ RTC_GUARDED_BY(test_crit_); + int sender_rtp_ RTC_GUARDED_BY(test_crit_); + int sender_padding_ RTC_GUARDED_BY(test_crit_); + int sender_rtcp_ RTC_GUARDED_BY(test_crit_); + int receiver_rtcp_ RTC_GUARDED_BY(test_crit_); + int down_frames_ RTC_GUARDED_BY(test_crit_); } test(&task_queue_); RunBaseTest(&test); @@ -5016,7 +5017,7 @@ TEST_F(EndToEndLogTest, LogsEncodedFramesWhenRequested) { std::unique_ptr encoder_; std::unique_ptr decoder_; rtc::CriticalSection crit_; - int recorded_frames_ GUARDED_BY(crit_); + int recorded_frames_ RTC_GUARDED_BY(crit_); } test(this); RunBaseTest(&test); diff --git a/webrtc/video/overuse_frame_detector.h b/webrtc/video/overuse_frame_detector.h index a5eef51020..a4f4588b8c 100644 --- a/webrtc/video/overuse_frame_detector.h +++ b/webrtc/video/overuse_frame_detector.h @@ -133,27 +133,28 @@ class OveruseFrameDetector { // Stats metrics. CpuOveruseMetricsObserver* const metrics_observer_; - rtc::Optional metrics_ GUARDED_BY(task_checker_); + rtc::Optional metrics_ RTC_GUARDED_BY(task_checker_); - int64_t num_process_times_ GUARDED_BY(task_checker_); + int64_t num_process_times_ RTC_GUARDED_BY(task_checker_); - int64_t last_capture_time_us_ GUARDED_BY(task_checker_); - int64_t last_processed_capture_time_us_ GUARDED_BY(task_checker_); + int64_t last_capture_time_us_ RTC_GUARDED_BY(task_checker_); + int64_t last_processed_capture_time_us_ RTC_GUARDED_BY(task_checker_); // Number of pixels of last captured frame. - int num_pixels_ GUARDED_BY(task_checker_); - int max_framerate_ GUARDED_BY(task_checker_); - int64_t last_overuse_time_ms_ GUARDED_BY(task_checker_); - int checks_above_threshold_ GUARDED_BY(task_checker_); - int num_overuse_detections_ GUARDED_BY(task_checker_); - int64_t last_rampup_time_ms_ GUARDED_BY(task_checker_); - bool in_quick_rampup_ GUARDED_BY(task_checker_); - int current_rampup_delay_ms_ GUARDED_BY(task_checker_); + int num_pixels_ RTC_GUARDED_BY(task_checker_); + int max_framerate_ RTC_GUARDED_BY(task_checker_); + int64_t last_overuse_time_ms_ RTC_GUARDED_BY(task_checker_); + int checks_above_threshold_ RTC_GUARDED_BY(task_checker_); + int num_overuse_detections_ RTC_GUARDED_BY(task_checker_); + int64_t last_rampup_time_ms_ RTC_GUARDED_BY(task_checker_); + bool in_quick_rampup_ RTC_GUARDED_BY(task_checker_); + int current_rampup_delay_ms_ RTC_GUARDED_BY(task_checker_); // TODO(asapersson): Can these be regular members (avoid separate heap // allocs)? - const std::unique_ptr usage_ GUARDED_BY(task_checker_); - std::list frame_timing_ GUARDED_BY(task_checker_); + const std::unique_ptr usage_ + RTC_GUARDED_BY(task_checker_); + std::list frame_timing_ RTC_GUARDED_BY(task_checker_); RTC_DISALLOW_COPY_AND_ASSIGN(OveruseFrameDetector); }; diff --git a/webrtc/video/payload_router.h b/webrtc/video/payload_router.h index bfd4b8e557..082ba369ff 100644 --- a/webrtc/video/payload_router.h +++ b/webrtc/video/payload_router.h @@ -49,10 +49,10 @@ class PayloadRouter : public EncodedImageCallback { void OnBitrateAllocationUpdated(const BitrateAllocation& bitrate); private: - void UpdateModuleSendingState() EXCLUSIVE_LOCKS_REQUIRED(crit_); + void UpdateModuleSendingState() RTC_EXCLUSIVE_LOCKS_REQUIRED(crit_); rtc::CriticalSection crit_; - bool active_ GUARDED_BY(crit_); + bool active_ RTC_GUARDED_BY(crit_); // Rtp modules are assumed to be sorted in simulcast index order. Not owned. const std::vector rtp_modules_; diff --git a/webrtc/video/picture_id_tests.cc b/webrtc/video/picture_id_tests.cc index 13574b8c4e..0c83796c7b 100644 --- a/webrtc/video/picture_id_tests.cc +++ b/webrtc/video/picture_id_tests.cc @@ -124,12 +124,12 @@ class PictureIdObserver : public test::RtpRtcpObserver { } rtc::CriticalSection crit_; - std::map last_observed_timestamp_ GUARDED_BY(crit_); - std::map last_observed_picture_id_ GUARDED_BY(crit_); - std::map num_packets_sent_ GUARDED_BY(crit_); - int max_expected_picture_id_gap_ GUARDED_BY(crit_); - size_t num_ssrcs_to_observe_ GUARDED_BY(crit_); - std::set observed_ssrcs_ GUARDED_BY(crit_); + std::map last_observed_timestamp_ RTC_GUARDED_BY(crit_); + std::map last_observed_picture_id_ RTC_GUARDED_BY(crit_); + std::map num_packets_sent_ RTC_GUARDED_BY(crit_); + int max_expected_picture_id_gap_ RTC_GUARDED_BY(crit_); + size_t num_ssrcs_to_observe_ RTC_GUARDED_BY(crit_); + std::set observed_ssrcs_ RTC_GUARDED_BY(crit_); }; class PictureIdTest : public test::CallTest { diff --git a/webrtc/video/receive_statistics_proxy.h b/webrtc/video/receive_statistics_proxy.h index 45424d980f..262be64d53 100644 --- a/webrtc/video/receive_statistics_proxy.h +++ b/webrtc/video/receive_statistics_proxy.h @@ -126,12 +126,13 @@ class ReceiveStatisticsProxy : public VCMReceiveStatisticsCallback, FrameCounts frame_counts; }; - void UpdateHistograms() EXCLUSIVE_LOCKS_REQUIRED(crit_); + void UpdateHistograms() RTC_EXCLUSIVE_LOCKS_REQUIRED(crit_); - void QualitySample() EXCLUSIVE_LOCKS_REQUIRED(crit_); + void QualitySample() RTC_EXCLUSIVE_LOCKS_REQUIRED(crit_); // Removes info about old frames and then updates the framerate. - void UpdateFramerate(int64_t now_ms) const EXCLUSIVE_LOCKS_REQUIRED(crit_); + void UpdateFramerate(int64_t now_ms) const + RTC_EXCLUSIVE_LOCKS_REQUIRED(crit_); Clock* const clock_; // Ownership of this object lies with the owner of the ReceiveStatisticsProxy @@ -145,42 +146,42 @@ class ReceiveStatisticsProxy : public VCMReceiveStatisticsCallback, const int64_t start_ms_; rtc::CriticalSection crit_; - int64_t last_sample_time_ GUARDED_BY(crit_); - QualityThreshold fps_threshold_ GUARDED_BY(crit_); - QualityThreshold qp_threshold_ GUARDED_BY(crit_); - QualityThreshold variance_threshold_ GUARDED_BY(crit_); - SampleCounter qp_sample_ GUARDED_BY(crit_); - int num_bad_states_ GUARDED_BY(crit_); - int num_certain_states_ GUARDED_BY(crit_); - mutable VideoReceiveStream::Stats stats_ GUARDED_BY(crit_); - RateStatistics decode_fps_estimator_ GUARDED_BY(crit_); - RateStatistics renders_fps_estimator_ GUARDED_BY(crit_); - rtc::RateTracker render_fps_tracker_ GUARDED_BY(crit_); - rtc::RateTracker render_pixel_tracker_ GUARDED_BY(crit_); - rtc::RateTracker total_byte_tracker_ GUARDED_BY(crit_); - SampleCounter sync_offset_counter_ GUARDED_BY(crit_); - SampleCounter decode_time_counter_ GUARDED_BY(crit_); - SampleCounter jitter_buffer_delay_counter_ GUARDED_BY(crit_); - SampleCounter target_delay_counter_ GUARDED_BY(crit_); - SampleCounter current_delay_counter_ GUARDED_BY(crit_); - SampleCounter delay_counter_ GUARDED_BY(crit_); + int64_t last_sample_time_ RTC_GUARDED_BY(crit_); + QualityThreshold fps_threshold_ RTC_GUARDED_BY(crit_); + QualityThreshold qp_threshold_ RTC_GUARDED_BY(crit_); + QualityThreshold variance_threshold_ RTC_GUARDED_BY(crit_); + SampleCounter qp_sample_ RTC_GUARDED_BY(crit_); + int num_bad_states_ RTC_GUARDED_BY(crit_); + int num_certain_states_ RTC_GUARDED_BY(crit_); + mutable VideoReceiveStream::Stats stats_ RTC_GUARDED_BY(crit_); + RateStatistics decode_fps_estimator_ RTC_GUARDED_BY(crit_); + RateStatistics renders_fps_estimator_ RTC_GUARDED_BY(crit_); + rtc::RateTracker render_fps_tracker_ RTC_GUARDED_BY(crit_); + rtc::RateTracker render_pixel_tracker_ RTC_GUARDED_BY(crit_); + rtc::RateTracker total_byte_tracker_ RTC_GUARDED_BY(crit_); + SampleCounter sync_offset_counter_ RTC_GUARDED_BY(crit_); + SampleCounter decode_time_counter_ RTC_GUARDED_BY(crit_); + SampleCounter jitter_buffer_delay_counter_ RTC_GUARDED_BY(crit_); + SampleCounter target_delay_counter_ RTC_GUARDED_BY(crit_); + SampleCounter current_delay_counter_ RTC_GUARDED_BY(crit_); + SampleCounter delay_counter_ RTC_GUARDED_BY(crit_); mutable rtc::MovingMaxCounter interframe_delay_max_moving_ - GUARDED_BY(crit_); + RTC_GUARDED_BY(crit_); std::map content_specific_stats_ - GUARDED_BY(crit_); - MaxCounter freq_offset_counter_ GUARDED_BY(crit_); - int64_t first_report_block_time_ms_ GUARDED_BY(crit_); - ReportBlockStats report_block_stats_ GUARDED_BY(crit_); + RTC_GUARDED_BY(crit_); + MaxCounter freq_offset_counter_ RTC_GUARDED_BY(crit_); + int64_t first_report_block_time_ms_ RTC_GUARDED_BY(crit_); + ReportBlockStats report_block_stats_ RTC_GUARDED_BY(crit_); QpCounters qp_counters_; // Only accessed on the decoding thread. - std::map rtx_stats_ GUARDED_BY(crit_); - int64_t avg_rtt_ms_ GUARDED_BY(crit_); - mutable std::map frame_window_ GUARDED_BY(&crit_); - VideoContentType last_content_type_ GUARDED_BY(&crit_); - rtc::Optional last_decoded_frame_time_ms_ GUARDED_BY(&crit_); + std::map rtx_stats_ RTC_GUARDED_BY(crit_); + int64_t avg_rtt_ms_ RTC_GUARDED_BY(crit_); + mutable std::map frame_window_ RTC_GUARDED_BY(&crit_); + VideoContentType last_content_type_ RTC_GUARDED_BY(&crit_); + rtc::Optional last_decoded_frame_time_ms_ RTC_GUARDED_BY(&crit_); // Mutable because calling Max() on MovingMaxCounter is not const. Yet it is // called from const GetStats(). mutable rtc::MovingMaxCounter timing_frame_info_counter_ - GUARDED_BY(&crit_); + RTC_GUARDED_BY(&crit_); }; } // namespace webrtc diff --git a/webrtc/video/rtp_streams_synchronizer.h b/webrtc/video/rtp_streams_synchronizer.h index dfc0ddb115..c8f2d2ac1d 100644 --- a/webrtc/video/rtp_streams_synchronizer.h +++ b/webrtc/video/rtp_streams_synchronizer.h @@ -52,13 +52,13 @@ class RtpStreamsSynchronizer : public Module { Syncable* syncable_video_; rtc::CriticalSection crit_; - Syncable* syncable_audio_ GUARDED_BY(crit_); - std::unique_ptr sync_ GUARDED_BY(crit_); - StreamSynchronization::Measurements audio_measurement_ GUARDED_BY(crit_); - StreamSynchronization::Measurements video_measurement_ GUARDED_BY(crit_); + Syncable* syncable_audio_ RTC_GUARDED_BY(crit_); + std::unique_ptr sync_ RTC_GUARDED_BY(crit_); + StreamSynchronization::Measurements audio_measurement_ RTC_GUARDED_BY(crit_); + StreamSynchronization::Measurements video_measurement_ RTC_GUARDED_BY(crit_); rtc::ThreadChecker process_thread_checker_; - int64_t last_sync_time_ ACCESS_ON(&process_thread_checker_); + int64_t last_sync_time_ RTC_ACCESS_ON(&process_thread_checker_); }; } // namespace webrtc diff --git a/webrtc/video/rtp_video_stream_receiver.h b/webrtc/video/rtp_video_stream_receiver.h index f65280e627..3c8b2aa167 100644 --- a/webrtc/video/rtp_video_stream_receiver.h +++ b/webrtc/video/rtp_video_stream_receiver.h @@ -184,10 +184,10 @@ class RtpVideoStreamReceiver : public RtpData, std::unique_ptr ulpfec_receiver_; rtc::SequencedTaskChecker worker_task_checker_; - bool receiving_ GUARDED_BY(worker_task_checker_); - uint8_t restored_packet_[IP_PACKET_SIZE] GUARDED_BY(worker_task_checker_); - bool restored_packet_in_use_ GUARDED_BY(worker_task_checker_); - int64_t last_packet_log_ms_ GUARDED_BY(worker_task_checker_); + bool receiving_ RTC_GUARDED_BY(worker_task_checker_); + uint8_t restored_packet_[IP_PACKET_SIZE] RTC_GUARDED_BY(worker_task_checker_); + bool restored_packet_in_use_ RTC_GUARDED_BY(worker_task_checker_); + int64_t last_packet_log_ms_ RTC_GUARDED_BY(worker_task_checker_); const std::unique_ptr rtp_rtcp_; @@ -200,7 +200,7 @@ class RtpVideoStreamReceiver : public RtpData, std::unique_ptr reference_finder_; rtc::CriticalSection last_seq_num_cs_; std::map last_seq_num_for_pic_id_ - GUARDED_BY(last_seq_num_cs_); + RTC_GUARDED_BY(last_seq_num_cs_); video_coding::H264SpsPpsTracker tracker_; // TODO(johan): Remove pt_codec_params_ once // https://bugs.chromium.org/p/webrtc/issues/detail?id=6883 is resolved. @@ -211,7 +211,7 @@ class RtpVideoStreamReceiver : public RtpData, bool has_received_frame_; std::vector secondary_sinks_ - GUARDED_BY(worker_task_checker_); + RTC_GUARDED_BY(worker_task_checker_); }; } // namespace webrtc diff --git a/webrtc/video/send_delay_stats.h b/webrtc/video/send_delay_stats.h index 5d8538eb5d..230fa9d649 100644 --- a/webrtc/video/send_delay_stats.h +++ b/webrtc/video/send_delay_stats.h @@ -64,22 +64,22 @@ class SendDelayStats : public SendPacketObserver { void UpdateHistograms(); void RemoveOld(int64_t now, PacketMap* packets) - EXCLUSIVE_LOCKS_REQUIRED(crit_); + RTC_EXCLUSIVE_LOCKS_REQUIRED(crit_); AvgCounter* GetSendDelayCounter(uint32_t ssrc) - EXCLUSIVE_LOCKS_REQUIRED(crit_); + RTC_EXCLUSIVE_LOCKS_REQUIRED(crit_); Clock* const clock_; rtc::CriticalSection crit_; - PacketMap packets_ GUARDED_BY(crit_); - size_t num_old_packets_ GUARDED_BY(crit_); - size_t num_skipped_packets_ GUARDED_BY(crit_); + PacketMap packets_ RTC_GUARDED_BY(crit_); + size_t num_old_packets_ RTC_GUARDED_BY(crit_); + size_t num_skipped_packets_ RTC_GUARDED_BY(crit_); - std::set ssrcs_ GUARDED_BY(crit_); + std::set ssrcs_ RTC_GUARDED_BY(crit_); // Mapped by SSRC. std::map> send_delay_counters_ - GUARDED_BY(crit_); + RTC_GUARDED_BY(crit_); }; } // namespace webrtc diff --git a/webrtc/video/send_statistics_proxy.h b/webrtc/video/send_statistics_proxy.h index fead8488f3..d6e91d74e0 100644 --- a/webrtc/video/send_statistics_proxy.h +++ b/webrtc/video/send_statistics_proxy.h @@ -162,30 +162,29 @@ class SendStatisticsProxy : public CpuOveruseMetricsObserver, SampleCounter vp9; // QP range: 0-255. SampleCounter h264; // QP range: 0-51. }; - void PurgeOldStats() EXCLUSIVE_LOCKS_REQUIRED(crit_); + void PurgeOldStats() RTC_EXCLUSIVE_LOCKS_REQUIRED(crit_); VideoSendStream::StreamStats* GetStatsEntry(uint32_t ssrc) - EXCLUSIVE_LOCKS_REQUIRED(crit_); + RTC_EXCLUSIVE_LOCKS_REQUIRED(crit_); void SetAdaptTimer(const VideoStreamEncoder::AdaptCounts& counts, - StatsTimer* timer) - EXCLUSIVE_LOCKS_REQUIRED(crit_); + StatsTimer* timer) RTC_EXCLUSIVE_LOCKS_REQUIRED(crit_); void UpdateAdaptationStats( const VideoStreamEncoder::AdaptCounts& cpu_counts, const VideoStreamEncoder::AdaptCounts& quality_counts) - EXCLUSIVE_LOCKS_REQUIRED(crit_); + RTC_EXCLUSIVE_LOCKS_REQUIRED(crit_); Clock* const clock_; const std::string payload_name_; const VideoSendStream::Config::Rtp rtp_config_; rtc::CriticalSection crit_; - VideoEncoderConfig::ContentType content_type_ GUARDED_BY(crit_); + VideoEncoderConfig::ContentType content_type_ RTC_GUARDED_BY(crit_); const int64_t start_ms_; - VideoSendStream::Stats stats_ GUARDED_BY(crit_); - uint32_t last_sent_frame_timestamp_ GUARDED_BY(crit_); - std::map update_times_ GUARDED_BY(crit_); - rtc::ExpFilter encode_time_ GUARDED_BY(crit_); - int quality_downscales_ GUARDED_BY(crit_); - int cpu_downscales_ GUARDED_BY(crit_); + VideoSendStream::Stats stats_ RTC_GUARDED_BY(crit_); + uint32_t last_sent_frame_timestamp_ RTC_GUARDED_BY(crit_); + std::map update_times_ RTC_GUARDED_BY(crit_); + rtc::ExpFilter encode_time_ RTC_GUARDED_BY(crit_); + int quality_downscales_ RTC_GUARDED_BY(crit_); + int cpu_downscales_ RTC_GUARDED_BY(crit_); // Contains stats used for UMA histograms. These stats will be reset if // content type changes between real-time video and screenshare, since these @@ -240,7 +239,7 @@ class SendStatisticsProxy : public CpuOveruseMetricsObserver, qp_counters_; // QP counters mapped by spatial idx. }; - std::unique_ptr uma_container_ GUARDED_BY(crit_); + std::unique_ptr uma_container_ RTC_GUARDED_BY(crit_); }; } // namespace webrtc diff --git a/webrtc/video/video_quality_test.cc b/webrtc/video/video_quality_test.cc index 92d796822a..11e060566b 100644 --- a/webrtc/video/video_quality_test.cc +++ b/webrtc/video/video_quality_test.cc @@ -649,7 +649,7 @@ class VideoAnalyzer : public PacketReceiver, const VideoFrame& render, bool dropped, int64_t render_time_ms) - EXCLUSIVE_LOCKS_REQUIRED(crit_) { + RTC_EXCLUSIVE_LOCKS_REQUIRED(crit_) { int64_t reference_timestamp = wrap_handler_.Unwrap(reference.timestamp()); int64_t send_time_ms = send_times_[reference_timestamp]; send_times_.erase(reference_timestamp); @@ -1032,7 +1032,8 @@ class VideoAnalyzer : public PacketReceiver, VideoAnalyzer* const analyzer_; rtc::CriticalSection crit_; - rtc::VideoSinkInterface* send_stream_input_ GUARDED_BY(crit_); + rtc::VideoSinkInterface* send_stream_input_ + RTC_GUARDED_BY(crit_); test::VideoCapturer* video_capturer_; Clock* clock_; }; @@ -1056,24 +1057,25 @@ class VideoAnalyzer : public PacketReceiver, const int selected_tl_; PreEncodeProxy pre_encode_proxy_; OnEncodeTimingProxy encode_timing_proxy_; - std::vector samples_ GUARDED_BY(comparison_lock_); - std::map samples_encode_time_ms_ GUARDED_BY(comparison_lock_); - test::Statistics sender_time_ GUARDED_BY(comparison_lock_); - test::Statistics receiver_time_ GUARDED_BY(comparison_lock_); - test::Statistics psnr_ GUARDED_BY(comparison_lock_); - test::Statistics ssim_ GUARDED_BY(comparison_lock_); - test::Statistics end_to_end_ GUARDED_BY(comparison_lock_); - test::Statistics rendered_delta_ GUARDED_BY(comparison_lock_); - test::Statistics encoded_frame_size_ GUARDED_BY(comparison_lock_); - test::Statistics encode_frame_rate_ GUARDED_BY(comparison_lock_); - test::Statistics encode_time_ms_ GUARDED_BY(comparison_lock_); - test::Statistics encode_usage_percent_ GUARDED_BY(comparison_lock_); - test::Statistics decode_time_ms_ GUARDED_BY(comparison_lock_); - test::Statistics decode_time_max_ms_ GUARDED_BY(comparison_lock_); - test::Statistics media_bitrate_bps_ GUARDED_BY(comparison_lock_); - test::Statistics fec_bitrate_bps_ GUARDED_BY(comparison_lock_); - test::Statistics send_bandwidth_bps_ GUARDED_BY(comparison_lock_); - test::Statistics memory_usage_ GUARDED_BY(comparison_lock_); + std::vector samples_ RTC_GUARDED_BY(comparison_lock_); + std::map samples_encode_time_ms_ + RTC_GUARDED_BY(comparison_lock_); + test::Statistics sender_time_ RTC_GUARDED_BY(comparison_lock_); + test::Statistics receiver_time_ RTC_GUARDED_BY(comparison_lock_); + test::Statistics psnr_ RTC_GUARDED_BY(comparison_lock_); + test::Statistics ssim_ RTC_GUARDED_BY(comparison_lock_); + test::Statistics end_to_end_ RTC_GUARDED_BY(comparison_lock_); + test::Statistics rendered_delta_ RTC_GUARDED_BY(comparison_lock_); + test::Statistics encoded_frame_size_ RTC_GUARDED_BY(comparison_lock_); + test::Statistics encode_frame_rate_ RTC_GUARDED_BY(comparison_lock_); + test::Statistics encode_time_ms_ RTC_GUARDED_BY(comparison_lock_); + test::Statistics encode_usage_percent_ RTC_GUARDED_BY(comparison_lock_); + test::Statistics decode_time_ms_ RTC_GUARDED_BY(comparison_lock_); + test::Statistics decode_time_max_ms_ RTC_GUARDED_BY(comparison_lock_); + test::Statistics media_bitrate_bps_ RTC_GUARDED_BY(comparison_lock_); + test::Statistics fec_bitrate_bps_ RTC_GUARDED_BY(comparison_lock_); + test::Statistics send_bandwidth_bps_ RTC_GUARDED_BY(comparison_lock_); + test::Statistics memory_usage_ RTC_GUARDED_BY(comparison_lock_); struct FrameWithPsnr { double psnr; @@ -1081,7 +1083,7 @@ class VideoAnalyzer : public PacketReceiver, }; // Rendered frame with worst PSNR is saved for further analysis. - rtc::Optional worst_frame_ GUARDED_BY(comparison_lock_); + rtc::Optional worst_frame_ RTC_GUARDED_BY(comparison_lock_); size_t last_fec_bytes_; @@ -1097,19 +1099,19 @@ class VideoAnalyzer : public PacketReceiver, int64_t first_sending_time_; int64_t last_sending_time_; - int64_t cpu_time_ GUARDED_BY(cpu_measurement_lock_); - int64_t wallclock_time_ GUARDED_BY(cpu_measurement_lock_); + int64_t cpu_time_ RTC_GUARDED_BY(cpu_measurement_lock_); + int64_t wallclock_time_ RTC_GUARDED_BY(cpu_measurement_lock_); rtc::CriticalSection cpu_measurement_lock_; rtc::CriticalSection crit_; - std::deque frames_ GUARDED_BY(crit_); - rtc::Optional last_rendered_frame_ GUARDED_BY(crit_); - rtc::TimestampWrapAroundHandler wrap_handler_ GUARDED_BY(crit_); - std::map send_times_ GUARDED_BY(crit_); - std::map recv_times_ GUARDED_BY(crit_); - std::map encoded_frame_sizes_ GUARDED_BY(crit_); - rtc::Optional first_encoded_timestamp_ GUARDED_BY(crit_); - rtc::Optional first_sent_timestamp_ GUARDED_BY(crit_); + std::deque frames_ RTC_GUARDED_BY(crit_); + rtc::Optional last_rendered_frame_ RTC_GUARDED_BY(crit_); + rtc::TimestampWrapAroundHandler wrap_handler_ RTC_GUARDED_BY(crit_); + std::map send_times_ RTC_GUARDED_BY(crit_); + std::map recv_times_ RTC_GUARDED_BY(crit_); + std::map encoded_frame_sizes_ RTC_GUARDED_BY(crit_); + rtc::Optional first_encoded_timestamp_ RTC_GUARDED_BY(crit_); + rtc::Optional first_sent_timestamp_ RTC_GUARDED_BY(crit_); const double avg_psnr_threshold_; const double avg_ssim_threshold_; bool is_quick_test_enabled_; @@ -1118,7 +1120,7 @@ class VideoAnalyzer : public PacketReceiver, std::vector comparison_thread_pool_; rtc::PlatformThread stats_polling_thread_; rtc::Event comparison_available_event_; - std::deque comparisons_ GUARDED_BY(comparison_lock_); + std::deque comparisons_ RTC_GUARDED_BY(comparison_lock_); rtc::Event done_; std::unique_ptr rtp_file_writer_; diff --git a/webrtc/video/video_receive_stream.h b/webrtc/video/video_receive_stream.h index 833e189fb1..32ce812326 100644 --- a/webrtc/video/video_receive_stream.h +++ b/webrtc/video/video_receive_stream.h @@ -134,7 +134,7 @@ class VideoReceiveStream : public webrtc::VideoReceiveStream, RtpStreamsSynchronizer rtp_stream_sync_; rtc::CriticalSection ivf_writer_lock_; - std::unique_ptr ivf_writer_ GUARDED_BY(ivf_writer_lock_); + std::unique_ptr ivf_writer_ RTC_GUARDED_BY(ivf_writer_lock_); // Members for the new jitter buffer experiment. std::unique_ptr jitter_estimator_; diff --git a/webrtc/video/video_send_stream.cc b/webrtc/video/video_send_stream.cc index f2b8d4a957..61884ca3e6 100644 --- a/webrtc/video/video_send_stream.cc +++ b/webrtc/video/video_send_stream.cc @@ -293,7 +293,7 @@ class VideoSendStreamImpl : public webrtc::BitrateAllocatorObserver, rtc::CriticalSection encoder_activity_crit_sect_; CheckEncoderActivityTask* check_encoder_activity_task_ - GUARDED_BY(encoder_activity_crit_sect_); + RTC_GUARDED_BY(encoder_activity_crit_sect_); CallStats* const call_stats_; RtpTransportControllerSendInterface* const transport_; @@ -303,8 +303,8 @@ class VideoSendStreamImpl : public webrtc::BitrateAllocatorObserver, std::unique_ptr flexfec_sender_; rtc::CriticalSection ivf_writers_crit_; - std::unique_ptr file_writers_[kMaxSimulcastStreams] GUARDED_BY( - ivf_writers_crit_); + std::unique_ptr + file_writers_[kMaxSimulcastStreams] RTC_GUARDED_BY(ivf_writers_crit_); int max_padding_bitrate_; int encoder_min_bitrate_bps_; @@ -329,7 +329,8 @@ class VideoSendStreamImpl : public webrtc::BitrateAllocatorObserver, rtc::WeakPtrFactory weak_ptr_factory_; rtc::CriticalSection overhead_bytes_per_packet_crit_; - size_t overhead_bytes_per_packet_ GUARDED_BY(overhead_bytes_per_packet_crit_); + size_t overhead_bytes_per_packet_ + RTC_GUARDED_BY(overhead_bytes_per_packet_crit_); size_t transport_overhead_bytes_per_packet_; }; diff --git a/webrtc/video/video_send_stream_tests.cc b/webrtc/video/video_send_stream_tests.cc index ce7a0eea7d..422b983ef9 100644 --- a/webrtc/video/video_send_stream_tests.cc +++ b/webrtc/video/video_send_stream_tests.cc @@ -1223,7 +1223,7 @@ TEST_F(VideoSendStreamTest, SuspendBelowMinBitrate) { }; virtual void SendRtcpFeedback(int remb_value) - EXCLUSIVE_LOCKS_REQUIRED(crit_) { + RTC_EXCLUSIVE_LOCKS_REQUIRED(crit_) { FakeReceiveStatistics receive_stats(kVideoSendSsrcs[0], last_sequence_number_, rtp_count_, 0); RTCPSender rtcp_sender(false, clock_, &receive_stats, nullptr, nullptr, @@ -1244,12 +1244,12 @@ TEST_F(VideoSendStreamTest, SuspendBelowMinBitrate) { VideoSendStream* stream_; rtc::CriticalSection crit_; - TestState test_state_ GUARDED_BY(crit_); - int rtp_count_ GUARDED_BY(crit_); - int last_sequence_number_ GUARDED_BY(crit_); - int suspended_frame_count_ GUARDED_BY(crit_); - int low_remb_bps_ GUARDED_BY(crit_); - int high_remb_bps_ GUARDED_BY(crit_); + TestState test_state_ RTC_GUARDED_BY(crit_); + int rtp_count_ RTC_GUARDED_BY(crit_); + int last_sequence_number_ RTC_GUARDED_BY(crit_); + int suspended_frame_count_ RTC_GUARDED_BY(crit_); + int low_remb_bps_ RTC_GUARDED_BY(crit_); + int high_remb_bps_ RTC_GUARDED_BY(crit_); } test; RunBaseTest(&test); @@ -1326,8 +1326,8 @@ TEST_F(VideoSendStreamTest, NoPaddingWhenVideoIsMuted) { Clock* const clock_; std::unique_ptr transport_adapter_; rtc::CriticalSection crit_; - int64_t last_packet_time_ms_ GUARDED_BY(crit_); - test::FrameGeneratorCapturer* capturer_ GUARDED_BY(crit_); + int64_t last_packet_time_ms_ RTC_GUARDED_BY(crit_); + test::FrameGeneratorCapturer* capturer_ RTC_GUARDED_BY(crit_); } test; RunBaseTest(&test); @@ -1395,8 +1395,8 @@ TEST_F(VideoSendStreamTest, PaddingIsPrimarilyRetransmissions) { rtc::CriticalSection crit_; Clock* const clock_; - size_t padding_length_ GUARDED_BY(crit_); - size_t total_length_ GUARDED_BY(crit_); + size_t padding_length_ RTC_GUARDED_BY(crit_); + size_t total_length_ RTC_GUARDED_BY(crit_); Call* call_; } test; @@ -1634,7 +1634,7 @@ TEST_F(VideoSendStreamTest, ChangingTransportOverhead) { test::SingleThreadedTaskQueueForTesting* const task_queue_; Call* call_; rtc::CriticalSection lock_; - int packets_sent_ GUARDED_BY(lock_); + int packets_sent_ RTC_GUARDED_BY(lock_); int transport_overhead_; const size_t kMaxRtpPacketSize = 1000; } test(&task_queue_); @@ -1742,10 +1742,10 @@ class MaxPaddingSetTest : public test::SendTest { rtc::CriticalSection crit_; rtc::Event content_switch_event_; Call* call_; - VideoSendStream* send_stream_ GUARDED_BY(crit_); + VideoSendStream* send_stream_ RTC_GUARDED_BY(crit_); VideoSendStream::Config send_stream_config_; VideoEncoderConfig encoder_config_; - uint32_t packets_sent_ GUARDED_BY(crit_); + uint32_t packets_sent_ RTC_GUARDED_BY(crit_); bool running_without_padding_; T* const stream_resetter_; }; @@ -1833,9 +1833,9 @@ TEST_F(VideoSendStreamTest, rtc::CriticalSection crit_; rtc::Event init_encode_called_; - size_t number_of_initializations_ GUARDED_BY(&crit_); - int last_initialized_frame_width_ GUARDED_BY(&crit_); - int last_initialized_frame_height_ GUARDED_BY(&crit_); + size_t number_of_initializations_ RTC_GUARDED_BY(&crit_); + int last_initialized_frame_width_ RTC_GUARDED_BY(&crit_); + int last_initialized_frame_height_ RTC_GUARDED_BY(&crit_); }; test::NullTransport transport; @@ -1902,7 +1902,7 @@ TEST_F(VideoSendStreamTest, CanReconfigureToUseStartBitrateAbovePreviousMax) { private: rtc::CriticalSection crit_; rtc::Event start_bitrate_changed_; - int start_bitrate_kbps_ GUARDED_BY(crit_); + int start_bitrate_kbps_ RTC_GUARDED_BY(crit_); }; CreateSenderCall(Call::Config(event_log_.get())); @@ -1992,7 +1992,7 @@ TEST_F(VideoSendStreamTest, VideoSendStreamStopSetEncoderRateToZero) { rtc::CriticalSection crit_; rtc::Event encoder_init_; rtc::Event bitrate_changed_; - rtc::Optional bitrate_kbps_ GUARDED_BY(crit_); + rtc::Optional bitrate_kbps_ RTC_GUARDED_BY(crit_); }; test::NullTransport transport; @@ -2244,10 +2244,10 @@ TEST_F(VideoSendStreamTest, EncoderIsProperlyInitializedAndDestroyed) { test::SingleThreadedTaskQueueForTesting* const task_queue_; rtc::CriticalSection crit_; VideoSendStream* stream_; - bool initialized_ GUARDED_BY(crit_); - bool callback_registered_ GUARDED_BY(crit_); - size_t num_releases_ GUARDED_BY(crit_); - bool released_ GUARDED_BY(crit_); + bool initialized_ RTC_GUARDED_BY(crit_); + bool callback_registered_ RTC_GUARDED_BY(crit_); + size_t num_releases_ RTC_GUARDED_BY(crit_); + bool released_ RTC_GUARDED_BY(crit_); VideoEncoderConfig encoder_config_; } test_encoder(&task_queue_); @@ -2557,8 +2557,8 @@ TEST_F(VideoSendStreamTest, RtcpSenderReportContainsMediaBytesSent) { } rtc::CriticalSection crit_; - size_t rtp_packets_sent_ GUARDED_BY(&crit_); - size_t media_bytes_sent_ GUARDED_BY(&crit_); + size_t rtp_packets_sent_ RTC_GUARDED_BY(&crit_); + size_t media_bytes_sent_ RTC_GUARDED_BY(&crit_); } test; RunBaseTest(&test); @@ -2792,7 +2792,7 @@ TEST_F(VideoSendStreamTest, ReconfigureBitratesSetsEncoderBitratesCorrectly) { rtc::Event init_encode_event_; rtc::Event bitrate_changed_event_; rtc::CriticalSection crit_; - uint32_t target_bitrate_ GUARDED_BY(&crit_); + uint32_t target_bitrate_ RTC_GUARDED_BY(&crit_); int num_initializations_; webrtc::Call* call_; @@ -3457,8 +3457,8 @@ TEST_F(VideoSendStreamTest, RemoveOverheadFromBandwidth) { test::SingleThreadedTaskQueueForTesting* const task_queue_; Call* call_; rtc::CriticalSection crit_; - uint32_t max_bitrate_bps_ GUARDED_BY(&crit_); - bool first_packet_sent_ GUARDED_BY(&crit_); + uint32_t max_bitrate_bps_ RTC_GUARDED_BY(&crit_); + bool first_packet_sent_ RTC_GUARDED_BY(&crit_); rtc::Event bitrate_changed_event_; } test(&task_queue_); RunBaseTest(&test); diff --git a/webrtc/video/video_stream_decoder.h b/webrtc/video/video_stream_decoder.h index 6ea722c202..88cff97364 100644 --- a/webrtc/video/video_stream_decoder.h +++ b/webrtc/video/video_stream_decoder.h @@ -97,7 +97,7 @@ class VideoStreamDecoder : public VCMReceiveCallback, ReceiveStatisticsProxy* const receive_stats_callback_; rtc::VideoSinkInterface* const incoming_video_stream_; - int64_t last_rtt_ms_ GUARDED_BY(crit_); + int64_t last_rtt_ms_ RTC_GUARDED_BY(crit_); }; } // namespace webrtc diff --git a/webrtc/video/video_stream_encoder.cc b/webrtc/video/video_stream_encoder.cc index 52dcbf0832..ccd28544e8 100644 --- a/webrtc/video/video_stream_encoder.cc +++ b/webrtc/video/video_stream_encoder.cc @@ -342,7 +342,7 @@ class VideoStreamEncoder::VideoSourceProxy { private: rtc::VideoSinkWants GetActiveSinkWantsInternal() - EXCLUSIVE_LOCKS_REQUIRED(&crit_) { + RTC_EXCLUSIVE_LOCKS_REQUIRED(&crit_) { rtc::VideoSinkWants wants = sink_wants_; // Clear any constraints from the current sink wants that don't apply to // the used degradation_preference. @@ -367,10 +367,10 @@ class VideoStreamEncoder::VideoSourceProxy { rtc::CriticalSection crit_; rtc::SequencedTaskChecker main_checker_; VideoStreamEncoder* const video_stream_encoder_; - rtc::VideoSinkWants sink_wants_ GUARDED_BY(&crit_); + rtc::VideoSinkWants sink_wants_ RTC_GUARDED_BY(&crit_); VideoSendStream::DegradationPreference degradation_preference_ - GUARDED_BY(&crit_); - rtc::VideoSourceInterface* source_ GUARDED_BY(&crit_); + RTC_GUARDED_BY(&crit_); + rtc::VideoSourceInterface* source_ RTC_GUARDED_BY(&crit_); RTC_DISALLOW_COPY_AND_ASSIGN(VideoSourceProxy); }; diff --git a/webrtc/video/video_stream_encoder.h b/webrtc/video/video_stream_encoder.h index 8f6cb07755..a0fa2df745 100644 --- a/webrtc/video/video_stream_encoder.h +++ b/webrtc/video/video_stream_encoder.h @@ -217,10 +217,10 @@ class VideoStreamEncoder : public rtc::VideoSinkInterface, std::vector resolution_counters_; }; - AdaptCounter& GetAdaptCounter() RUN_ON(&encoder_queue_); - const AdaptCounter& GetConstAdaptCounter() RUN_ON(&encoder_queue_); - void UpdateAdaptationStats(AdaptReason reason) RUN_ON(&encoder_queue_); - AdaptCounts GetActiveCounts(AdaptReason reason) RUN_ON(&encoder_queue_); + AdaptCounter& GetAdaptCounter() RTC_RUN_ON(&encoder_queue_); + const AdaptCounter& GetConstAdaptCounter() RTC_RUN_ON(&encoder_queue_); + void UpdateAdaptationStats(AdaptReason reason) RTC_RUN_ON(&encoder_queue_); + AdaptCounts GetActiveCounts(AdaptReason reason) RTC_RUN_ON(&encoder_queue_); rtc::Event shutdown_event_; @@ -233,10 +233,10 @@ class VideoStreamEncoder : public rtc::VideoSinkInterface, const VideoSendStream::Config::EncoderSettings settings_; const VideoCodecType codec_type_; - vcm::VideoSender video_sender_ ACCESS_ON(&encoder_queue_); + vcm::VideoSender video_sender_ RTC_ACCESS_ON(&encoder_queue_); std::unique_ptr overuse_detector_ - ACCESS_ON(&encoder_queue_); - std::unique_ptr quality_scaler_ ACCESS_ON(&encoder_queue_); + RTC_ACCESS_ON(&encoder_queue_); + std::unique_ptr quality_scaler_ RTC_ACCESS_ON(&encoder_queue_); SendStatisticsProxy* const stats_proxy_; rtc::VideoSinkInterface* const pre_encode_callback_; @@ -246,24 +246,24 @@ class VideoStreamEncoder : public rtc::VideoSinkInterface, // of VideoStreamEncoder are called on the same thread. rtc::ThreadChecker thread_checker_; - VideoEncoderConfig encoder_config_ ACCESS_ON(&encoder_queue_); + VideoEncoderConfig encoder_config_ RTC_ACCESS_ON(&encoder_queue_); std::unique_ptr rate_allocator_ - ACCESS_ON(&encoder_queue_); + RTC_ACCESS_ON(&encoder_queue_); // The maximum frame rate of the current codec configuration, as determined // at the last ReconfigureEncoder() call. - int max_framerate_ ACCESS_ON(&encoder_queue_); + int max_framerate_ RTC_ACCESS_ON(&encoder_queue_); // Set when ConfigureEncoder has been called in order to lazy reconfigure the // encoder on the next frame. - bool pending_encoder_reconfiguration_ ACCESS_ON(&encoder_queue_); - rtc::Optional last_frame_info_ ACCESS_ON(&encoder_queue_); - int crop_width_ ACCESS_ON(&encoder_queue_); - int crop_height_ ACCESS_ON(&encoder_queue_); - uint32_t encoder_start_bitrate_bps_ ACCESS_ON(&encoder_queue_); - size_t max_data_payload_length_ ACCESS_ON(&encoder_queue_); - bool nack_enabled_ ACCESS_ON(&encoder_queue_); - uint32_t last_observed_bitrate_bps_ ACCESS_ON(&encoder_queue_); - bool encoder_paused_and_dropped_frame_ ACCESS_ON(&encoder_queue_); + 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_); 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 @@ -271,10 +271,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_ ACCESS_ON(&encoder_queue_); + adapt_counters_ RTC_ACCESS_ON(&encoder_queue_); // Set depending on degradation preferences. VideoSendStream::DegradationPreference degradation_preference_ - ACCESS_ON(&encoder_queue_); + RTC_ACCESS_ON(&encoder_queue_); struct AdaptationRequest { // The pixel count produced by the source at the time of the adaptation. @@ -287,22 +287,25 @@ 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_ - ACCESS_ON(&encoder_queue_); + RTC_ACCESS_ON(&encoder_queue_); rtc::RaceChecker incoming_frame_race_checker_ - GUARDED_BY(incoming_frame_race_checker_); + RTC_GUARDED_BY(incoming_frame_race_checker_); Atomic32 posted_frames_waiting_for_encode_; // Used to make sure incoming time stamp is increasing for every frame. - int64_t last_captured_timestamp_ GUARDED_BY(incoming_frame_race_checker_); + int64_t last_captured_timestamp_ RTC_GUARDED_BY(incoming_frame_race_checker_); // Delta used for translating between NTP and internal timestamps. - const int64_t delta_ntp_internal_ms_ GUARDED_BY(incoming_frame_race_checker_); + const int64_t delta_ntp_internal_ms_ + RTC_GUARDED_BY(incoming_frame_race_checker_); - int64_t last_frame_log_ms_ GUARDED_BY(incoming_frame_race_checker_); - int captured_frame_count_ ACCESS_ON(&encoder_queue_); - int dropped_frame_count_ ACCESS_ON(&encoder_queue_); + 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_); - VideoBitrateAllocationObserver* bitrate_observer_ ACCESS_ON(&encoder_queue_); - rtc::Optional last_parameters_update_ms_ ACCESS_ON(&encoder_queue_); + VideoBitrateAllocationObserver* bitrate_observer_ + RTC_ACCESS_ON(&encoder_queue_); + rtc::Optional last_parameters_update_ms_ + RTC_ACCESS_ON(&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. diff --git a/webrtc/video/video_stream_encoder_unittest.cc b/webrtc/video/video_stream_encoder_unittest.cc index 9e7fa77b8f..488486c1ec 100644 --- a/webrtc/video/video_stream_encoder_unittest.cc +++ b/webrtc/video/video_stream_encoder_unittest.cc @@ -89,7 +89,7 @@ class CpuOveruseDetectorProxy : public OveruseFrameDetector { private: rtc::CriticalSection lock_; - int last_target_framerate_fps_ GUARDED_BY(lock_); + int last_target_framerate_fps_ RTC_GUARDED_BY(lock_); }; class VideoStreamEncoderUnderTest : public VideoStreamEncoder { @@ -218,8 +218,8 @@ class AdaptingFrameForwarder : public test::FrameForwarder { test::FrameForwarder::AddOrUpdateSink(sink, wants); } cricket::VideoAdapter adapter_; - bool adaptation_enabled_ GUARDED_BY(crit_); - rtc::VideoSinkWants last_wants_ GUARDED_BY(crit_); + bool adaptation_enabled_ RTC_GUARDED_BY(crit_); + rtc::VideoSinkWants last_wants_ RTC_GUARDED_BY(crit_); }; class MockableSendStatisticsProxy : public SendStatisticsProxy { @@ -248,7 +248,7 @@ class MockableSendStatisticsProxy : public SendStatisticsProxy { private: rtc::CriticalSection lock_; - rtc::Optional mock_stats_ GUARDED_BY(lock_); + rtc::Optional mock_stats_ RTC_GUARDED_BY(lock_); }; class MockBitrateObserver : public VideoBitrateAllocationObserver { @@ -551,16 +551,16 @@ class VideoStreamEncoderTest : public ::testing::Test { } rtc::CriticalSection local_crit_sect_; - bool block_next_encode_ GUARDED_BY(local_crit_sect_) = false; + bool block_next_encode_ RTC_GUARDED_BY(local_crit_sect_) = false; rtc::Event continue_encode_event_; - uint32_t timestamp_ GUARDED_BY(local_crit_sect_) = 0; - int64_t ntp_time_ms_ GUARDED_BY(local_crit_sect_) = 0; - int last_input_width_ GUARDED_BY(local_crit_sect_) = 0; - int last_input_height_ GUARDED_BY(local_crit_sect_) = 0; - bool quality_scaling_ GUARDED_BY(local_crit_sect_) = true; + uint32_t timestamp_ RTC_GUARDED_BY(local_crit_sect_) = 0; + int64_t ntp_time_ms_ RTC_GUARDED_BY(local_crit_sect_) = 0; + int last_input_width_ RTC_GUARDED_BY(local_crit_sect_) = 0; + int last_input_height_ RTC_GUARDED_BY(local_crit_sect_) = 0; + bool quality_scaling_ RTC_GUARDED_BY(local_crit_sect_) = true; std::vector> allocated_temporal_layers_ - GUARDED_BY(local_crit_sect_); - bool force_init_encode_failed_ GUARDED_BY(local_crit_sect_) = false; + RTC_GUARDED_BY(local_crit_sect_); + bool force_init_encode_failed_ RTC_GUARDED_BY(local_crit_sect_) = false; }; class TestSink : public VideoStreamEncoder::EncoderSink { diff --git a/webrtc/voice_engine/audio_level.h b/webrtc/voice_engine/audio_level.h index d69365afb6..33f8fe2d51 100644 --- a/webrtc/voice_engine/audio_level.h +++ b/webrtc/voice_engine/audio_level.h @@ -45,13 +45,13 @@ class AudioLevel { rtc::CriticalSection crit_sect_; - int16_t abs_max_ GUARDED_BY(crit_sect_); - int16_t count_ GUARDED_BY(crit_sect_); - int8_t current_level_ GUARDED_BY(crit_sect_); - int16_t current_level_full_range_ GUARDED_BY(crit_sect_); + int16_t abs_max_ RTC_GUARDED_BY(crit_sect_); + int16_t count_ RTC_GUARDED_BY(crit_sect_); + int8_t current_level_ RTC_GUARDED_BY(crit_sect_); + int16_t current_level_full_range_ RTC_GUARDED_BY(crit_sect_); - double total_energy_ GUARDED_BY(crit_sect_) = 0.0; - double total_duration_ GUARDED_BY(crit_sect_) = 0.0; + double total_energy_ RTC_GUARDED_BY(crit_sect_) = 0.0; + double total_duration_ RTC_GUARDED_BY(crit_sect_) = 0.0; }; } // namespace voe diff --git a/webrtc/voice_engine/channel.cc b/webrtc/voice_engine/channel.cc index 0e83989ccf..746db8114c 100644 --- a/webrtc/voice_engine/channel.cc +++ b/webrtc/voice_engine/channel.cc @@ -192,7 +192,7 @@ class RtcEventLogProxy final : public webrtc::RtcEventLog { private: rtc::CriticalSection crit_; - RtcEventLog* event_log_ GUARDED_BY(crit_); + RtcEventLog* event_log_ RTC_GUARDED_BY(crit_); RTC_DISALLOW_COPY_AND_ASSIGN(RtcEventLogProxy); }; @@ -220,7 +220,7 @@ class RtcpRttStatsProxy final : public RtcpRttStats { private: rtc::CriticalSection crit_; - RtcpRttStats* rtcp_rtt_stats_ GUARDED_BY(crit_); + RtcpRttStats* rtcp_rtt_stats_ RTC_GUARDED_BY(crit_); RTC_DISALLOW_COPY_AND_ASSIGN(RtcpRttStatsProxy); }; @@ -265,7 +265,7 @@ class TransportFeedbackProxy : public TransportFeedbackObserver { rtc::ThreadChecker thread_checker_; rtc::ThreadChecker pacer_thread_; rtc::ThreadChecker network_thread_; - TransportFeedbackObserver* feedback_observer_ GUARDED_BY(&crit_); + TransportFeedbackObserver* feedback_observer_ RTC_GUARDED_BY(&crit_); }; class TransportSequenceNumberProxy : public TransportSequenceNumberAllocator { @@ -294,7 +294,7 @@ class TransportSequenceNumberProxy : public TransportSequenceNumberAllocator { rtc::CriticalSection crit_; rtc::ThreadChecker thread_checker_; rtc::ThreadChecker pacer_thread_; - TransportSequenceNumberAllocator* seq_num_allocator_ GUARDED_BY(&crit_); + TransportSequenceNumberAllocator* seq_num_allocator_ RTC_GUARDED_BY(&crit_); }; class RtpPacketSenderProxy : public RtpPacketSender { @@ -324,7 +324,7 @@ class RtpPacketSenderProxy : public RtpPacketSender { private: rtc::ThreadChecker thread_checker_; rtc::CriticalSection crit_; - RtpPacketSender* rtp_packet_sender_ GUARDED_BY(&crit_); + RtpPacketSender* rtp_packet_sender_ RTC_GUARDED_BY(&crit_); }; class VoERtcpObserver : public RtcpBandwidthObserver { @@ -398,7 +398,7 @@ class VoERtcpObserver : public RtcpBandwidthObserver { // Maps remote side ssrc to extended highest sequence number received. std::map extended_max_sequence_number_; rtc::CriticalSection crit_; - RtcpBandwidthObserver* bandwidth_observer_ GUARDED_BY(crit_); + RtcpBandwidthObserver* bandwidth_observer_ RTC_GUARDED_BY(crit_); }; class Channel::ProcessAndEncodeAudioTask : public rtc::QueuedTask { diff --git a/webrtc/voice_engine/channel.h b/webrtc/voice_engine/channel.h index 89c2b430ec..e5209f503e 100644 --- a/webrtc/voice_engine/channel.h +++ b/webrtc/voice_engine/channel.h @@ -440,7 +440,7 @@ class Channel unsigned char id); void UpdateOverheadForEncoder() - EXCLUSIVE_LOCKS_REQUIRED(overhead_per_packet_lock_); + RTC_EXCLUSIVE_LOCKS_REQUIRED(overhead_per_packet_lock_); int GetRtpTimestampRateHz() const; int64_t GetRTT(bool allow_associate_channel) const; @@ -482,16 +482,16 @@ class Channel int _outputFilePlayerId; int _outputFileRecorderId; bool _outputFileRecording; - uint32_t _timeStamp ACCESS_ON(encoder_queue_); + uint32_t _timeStamp RTC_ACCESS_ON(encoder_queue_); - RemoteNtpTimeEstimator ntp_estimator_ GUARDED_BY(ts_stats_lock_); + RemoteNtpTimeEstimator ntp_estimator_ RTC_GUARDED_BY(ts_stats_lock_); // Timestamp of the audio pulled from NetEq. rtc::Optional jitter_buffer_playout_timestamp_; rtc::CriticalSection video_sync_lock_; - uint32_t playout_timestamp_rtp_ GUARDED_BY(video_sync_lock_); - uint32_t playout_delay_ms_ GUARDED_BY(video_sync_lock_); + uint32_t playout_timestamp_rtp_ RTC_GUARDED_BY(video_sync_lock_); + uint32_t playout_delay_ms_ RTC_GUARDED_BY(video_sync_lock_); uint16_t send_sequence_number_; rtc::CriticalSection ts_stats_lock_; @@ -501,7 +501,7 @@ class Channel int64_t capture_start_rtp_time_stamp_; // The capture ntp time (in local timebase) of the first played out audio // frame. - int64_t capture_start_ntp_time_ms_ GUARDED_BY(ts_stats_lock_); + int64_t capture_start_ntp_time_ms_ RTC_GUARDED_BY(ts_stats_lock_); // uses Statistics* _engineStatisticsPtr; @@ -511,18 +511,19 @@ class Channel VoiceEngineObserver* _voiceEngineObserverPtr; // owned by base rtc::CriticalSection* _callbackCritSectPtr; // owned by base Transport* _transportPtr; // WebRtc socket or external transport - RmsLevel rms_level_ ACCESS_ON(encoder_queue_); - bool input_mute_ GUARDED_BY(volume_settings_critsect_); - bool previous_frame_muted_ ACCESS_ON(encoder_queue_); - float _outputGain GUARDED_BY(volume_settings_critsect_); + RmsLevel rms_level_ RTC_ACCESS_ON(encoder_queue_); + bool input_mute_ RTC_GUARDED_BY(volume_settings_critsect_); + bool previous_frame_muted_ RTC_ACCESS_ON(encoder_queue_); + float _outputGain RTC_GUARDED_BY(volume_settings_critsect_); // VoEBase bool _mixFileWithMicrophone; // VoeRTP_RTCP // TODO(henrika): can today be accessed on the main thread and on the // task queue; hence potential race. bool _includeAudioLevelIndication; - size_t transport_overhead_per_packet_ GUARDED_BY(overhead_per_packet_lock_); - size_t rtp_overhead_per_packet_ GUARDED_BY(overhead_per_packet_lock_); + size_t transport_overhead_per_packet_ + RTC_GUARDED_BY(overhead_per_packet_lock_); + size_t rtp_overhead_per_packet_ RTC_GUARDED_BY(overhead_per_packet_lock_); rtc::CriticalSection overhead_per_packet_lock_; // VoENetwork AudioFrame::SpeechType _outputSpeechType; @@ -530,7 +531,7 @@ class Channel std::unique_ptr rtcp_observer_; // An associated send channel. rtc::CriticalSection assoc_send_channel_lock_; - ChannelOwner associate_send_channel_ GUARDED_BY(assoc_send_channel_lock_); + ChannelOwner associate_send_channel_ RTC_GUARDED_BY(assoc_send_channel_lock_); bool pacing_enabled_; PacketRouter* packet_router_ = nullptr; @@ -550,7 +551,7 @@ class Channel rtc::CriticalSection encoder_queue_lock_; - bool encoder_queue_is_active_ GUARDED_BY(encoder_queue_lock_) = false; + bool encoder_queue_is_active_ RTC_GUARDED_BY(encoder_queue_lock_) = false; rtc::TaskQueue* encoder_queue_ = nullptr; }; diff --git a/webrtc/voice_engine/shared_data.h b/webrtc/voice_engine/shared_data.h index 971d7d7139..7251c6aeaa 100644 --- a/webrtc/voice_engine/shared_data.h +++ b/webrtc/voice_engine/shared_data.h @@ -71,7 +71,7 @@ protected: std::unique_ptr _moduleProcessThreadPtr; // |encoder_queue| is defined last to ensure all pending tasks are cancelled // and deleted before any other members. - rtc::TaskQueue encoder_queue_ ACCESS_ON(construction_thread_); + rtc::TaskQueue encoder_queue_ RTC_ACCESS_ON(construction_thread_); SharedData(); virtual ~SharedData(); diff --git a/webrtc/voice_engine/test/auto_test/fakes/conference_transport.h b/webrtc/voice_engine/test/auto_test/fakes/conference_transport.h index 22711bd5fb..a0acd9e452 100644 --- a/webrtc/voice_engine/test/auto_test/fakes/conference_transport.h +++ b/webrtc/voice_engine/test/auto_test/fakes/conference_transport.h @@ -137,8 +137,9 @@ class ConferenceTransport: public webrtc::Transport { unsigned int rtt_ms_; unsigned int stream_count_; - std::map> streams_ GUARDED_BY(stream_crit_); - std::deque packet_queue_ GUARDED_BY(pq_crit_); + std::map> streams_ + RTC_GUARDED_BY(stream_crit_); + std::deque packet_queue_ RTC_GUARDED_BY(pq_crit_); int local_sender_; // Channel Id of local sender int reflector_; diff --git a/webrtc/voice_engine/test/auto_test/fixtures/after_initialization_fixture.h b/webrtc/voice_engine/test/auto_test/fixtures/after_initialization_fixture.h index 1404fa5b23..cb36f61315 100644 --- a/webrtc/voice_engine/test/auto_test/fixtures/after_initialization_fixture.h +++ b/webrtc/voice_engine/test/auto_test/fixtures/after_initialization_fixture.h @@ -145,9 +145,9 @@ class LoopBackTransport : public webrtc::Transport { rtc::CriticalSection crit_; const std::unique_ptr packet_event_; rtc::PlatformThread thread_; - std::deque packet_queue_ GUARDED_BY(crit_); + std::deque packet_queue_ RTC_GUARDED_BY(crit_); const int channel_; - std::map channels_ GUARDED_BY(crit_); + std::map channels_ RTC_GUARDED_BY(crit_); webrtc::VoENetwork* const voe_network_; webrtc::Atomic32 transmitted_packets_; };