From 20e4c80fbefb1cbfd6756a03cdb19d887bf98079 Mon Sep 17 00:00:00 2001 From: Mirko Bonadei Date: Mon, 23 Nov 2020 11:07:42 +0100 Subject: [PATCH] Reland "Introduce RTC_NO_UNIQUE_ADDRESS." This is a reland of f5e261aaf65cdf2eb903cdf40d651846be44f447 This CL disables RTC_NO_UNIQUE_ADDRESS on MSan builds since there have been some issues. Original change's description: > Introduce RTC_NO_UNIQUE_ADDRESS. > > This macro introduces the possibility to suggest the compiler that a > data member doesn't need an address different from other non static > data members. > > The usage of a macro is to maintain portability since at the moment > the attribute [[no_unique_address]] is only supported by clang > with at least -std=c++11 but it should be supported by all the > compilers starting from C++20. > > Bug: webrtc:11495 > Change-Id: I9f12b67b4422a2749649eaa6b004a67d5fd572d8 > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/173331 > Commit-Queue: Mirko Bonadei > Reviewed-by: Karl Wiberg > Cr-Commit-Position: refs/heads/master@{#32246} Bug: webrtc:11495, webrtc:12218 Change-Id: I4e6c7cc37d3daffad2407c9a2acfa897fa5b426a Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/189968 Commit-Queue: Mirko Bonadei Reviewed-by: Karl Wiberg Cr-Commit-Position: refs/heads/master@{#32668} --- audio/BUILD.gn | 1 + ...annel_receive_frame_transformer_delegate.h | 3 +- audio/voip/BUILD.gn | 1 + call/BUILD.gn | 2 + call/bitrate_allocator.h | 3 +- call/call.cc | 3 +- call/call_factory.h | 3 +- logging/BUILD.gn | 1 + logging/rtc_event_log/rtc_event_log_impl.h | 3 +- media/BUILD.gn | 1 + media/engine/simulcast_encoder_adapter.h | 3 +- modules/congestion_controller/rtp/BUILD.gn | 1 + .../rtp/control_handler.h | 3 +- modules/rtp_rtcp/BUILD.gn | 1 + modules/rtp_rtcp/include/flexfec_receiver.h | 3 +- modules/rtp_rtcp/source/rtp_rtcp_impl2.h | 3 +- modules/rtp_rtcp/source/rtp_sender_egress.h | 3 +- modules/video_coding/BUILD.gn | 3 ++ .../video_coding/codecs/test/videoprocessor.h | 3 +- modules/video_coding/frame_buffer2.h | 5 ++- .../loss_notification_controller.h | 3 +- modules/video_coding/utility/quality_scaler.h | 3 +- p2p/BUILD.gn | 1 + p2p/base/dtls_transport.h | 3 +- pc/BUILD.gn | 2 + pc/video_rtp_track_source.h | 3 +- rtc_base/BUILD.gn | 4 ++ rtc_base/buffer_queue.h | 3 +- rtc_base/net_helpers.h | 3 +- rtc_base/operations_chain.h | 3 +- rtc_base/system/BUILD.gn | 4 ++ rtc_base/system/no_unique_address.h | 38 +++++++++++++++++++ rtc_base/task_utils/BUILD.gn | 1 + .../task_utils/pending_task_safety_flag.h | 3 +- rtc_base/weak_ptr.h | 3 +- rtc_tools/network_tester/BUILD.gn | 1 + rtc_tools/network_tester/packet_sender.h | 3 +- video/BUILD.gn | 2 + video/adaptation/BUILD.gn | 1 + video/adaptation/balanced_constraint.h | 3 +- video/adaptation/bitrate_constraint.h | 3 +- video/adaptation/overuse_frame_detector.h | 3 +- video/call_stats2.h | 5 ++- video/receive_statistics_proxy2.h | 5 ++- video/rtp_streams_synchronizer2.h | 3 +- video/rtp_video_stream_receiver.h | 3 +- video/rtp_video_stream_receiver2.h | 5 ++- ...ream_receiver_frame_transformer_delegate.h | 3 +- video/video_receive_stream.h | 7 ++-- video/video_receive_stream2.h | 5 ++- video/video_source_sink_controller.h | 3 +- video/video_stream_encoder.cc | 3 +- 52 files changed, 142 insertions(+), 42 deletions(-) create mode 100644 rtc_base/system/no_unique_address.h diff --git a/audio/BUILD.gn b/audio/BUILD.gn index bc61c3169b..04ad6fa507 100644 --- a/audio/BUILD.gn +++ b/audio/BUILD.gn @@ -94,6 +94,7 @@ rtc_library("audio") { "../rtc_base/experiments:field_trial_parser", "../rtc_base/synchronization:mutex", "../rtc_base/synchronization:sequence_checker", + "../rtc_base/system:no_unique_address", "../rtc_base/task_utils:to_queued_task", "../system_wrappers", "../system_wrappers:field_trial", diff --git a/audio/channel_receive_frame_transformer_delegate.h b/audio/channel_receive_frame_transformer_delegate.h index 73112d10e3..3227c55914 100644 --- a/audio/channel_receive_frame_transformer_delegate.h +++ b/audio/channel_receive_frame_transformer_delegate.h @@ -15,6 +15,7 @@ #include "api/frame_transformer_interface.h" #include "rtc_base/synchronization/sequence_checker.h" +#include "rtc_base/system/no_unique_address.h" #include "rtc_base/task_queue.h" #include "rtc_base/thread.h" @@ -61,7 +62,7 @@ class ChannelReceiveFrameTransformerDelegate : public TransformedFrameCallback { ~ChannelReceiveFrameTransformerDelegate() override = default; private: - SequenceChecker sequence_checker_; + RTC_NO_UNIQUE_ADDRESS SequenceChecker sequence_checker_; ReceiveFrameCallback receive_frame_callback_ RTC_GUARDED_BY(sequence_checker_); rtc::scoped_refptr frame_transformer_ diff --git a/audio/voip/BUILD.gn b/audio/voip/BUILD.gn index 52f9d07f17..f4b6142a74 100644 --- a/audio/voip/BUILD.gn +++ b/audio/voip/BUILD.gn @@ -98,6 +98,7 @@ rtc_library("audio_egress") { "../../rtc_base:thread_checker", "../../rtc_base:timeutils", "../../rtc_base/synchronization:mutex", + "../../rtc_base/system:no_unique_address", "../utility:audio_frame_operations", ] } diff --git a/call/BUILD.gn b/call/BUILD.gn index 15e3b481ad..764aa33aef 100644 --- a/call/BUILD.gn +++ b/call/BUILD.gn @@ -225,6 +225,7 @@ rtc_library("bitrate_allocator") { "../rtc_base:rtc_base_approved", "../rtc_base:safe_minmax", "../rtc_base/synchronization:sequence_checker", + "../rtc_base/system:no_unique_address", "../system_wrappers", "../system_wrappers:field_trial", "../system_wrappers:metrics", @@ -285,6 +286,7 @@ rtc_library("call") { "../rtc_base/experiments:field_trial_parser", "../rtc_base/network:sent_packet", "../rtc_base/synchronization:sequence_checker", + "../rtc_base/system:no_unique_address", "../rtc_base/task_utils:pending_task_safety_flag", "../system_wrappers", "../system_wrappers:field_trial", diff --git a/call/bitrate_allocator.h b/call/bitrate_allocator.h index 8d9a1adb0e..481d91b23c 100644 --- a/call/bitrate_allocator.h +++ b/call/bitrate_allocator.h @@ -22,6 +22,7 @@ #include "api/call/bitrate_allocation.h" #include "api/transport/network_types.h" #include "rtc_base/synchronization/sequence_checker.h" +#include "rtc_base/system/no_unique_address.h" namespace webrtc { @@ -148,7 +149,7 @@ class BitrateAllocator : public BitrateAllocatorInterface { // video send stream. static uint8_t GetTransmissionMaxBitrateMultiplier(); - SequenceChecker sequenced_checker_; + RTC_NO_UNIQUE_ADDRESS SequenceChecker sequenced_checker_; LimitObserver* const limit_observer_ RTC_GUARDED_BY(&sequenced_checker_); // Stored in a list to keep track of the insertion order. std::vector allocatable_tracks_ diff --git a/call/call.cc b/call/call.cc index e814cff5b6..ca6973238e 100644 --- a/call/call.cc +++ b/call/call.cc @@ -51,6 +51,7 @@ #include "rtc_base/logging.h" #include "rtc_base/strings/string_builder.h" #include "rtc_base/synchronization/sequence_checker.h" +#include "rtc_base/system/no_unique_address.h" #include "rtc_base/task_utils/pending_task_safety_flag.h" #include "rtc_base/thread_annotations.h" #include "rtc_base/time_utils.h" @@ -532,7 +533,7 @@ class SharedModuleThread::Impl { } private: - SequenceChecker sequence_checker_; + RTC_NO_UNIQUE_ADDRESS SequenceChecker sequence_checker_; mutable int ref_count_ RTC_GUARDED_BY(sequence_checker_) = 0; std::unique_ptr const module_thread_; std::function const on_one_ref_remaining_; diff --git a/call/call_factory.h b/call/call_factory.h index 65c0b6532a..2426caae47 100644 --- a/call/call_factory.h +++ b/call/call_factory.h @@ -15,6 +15,7 @@ #include "call/call.h" #include "call/call_config.h" #include "rtc_base/synchronization/sequence_checker.h" +#include "rtc_base/system/no_unique_address.h" namespace webrtc { @@ -27,7 +28,7 @@ class CallFactory : public CallFactoryInterface { Call* CreateCall(const CallConfig& config) override; - SequenceChecker call_thread_; + RTC_NO_UNIQUE_ADDRESS SequenceChecker call_thread_; rtc::scoped_refptr module_thread_ RTC_GUARDED_BY(call_thread_); }; diff --git a/logging/BUILD.gn b/logging/BUILD.gn index 7a8922d4a2..7111f0a9da 100644 --- a/logging/BUILD.gn +++ b/logging/BUILD.gn @@ -268,6 +268,7 @@ if (rtc_enable_protobuf) { "../rtc_base:rtc_task_queue", "../rtc_base:safe_minmax", "../rtc_base/synchronization:sequence_checker", + "../rtc_base/system:no_unique_address", ] absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ] } diff --git a/logging/rtc_event_log/rtc_event_log_impl.h b/logging/rtc_event_log/rtc_event_log_impl.h index 9c7aae669d..bdbde612eb 100644 --- a/logging/rtc_event_log/rtc_event_log_impl.h +++ b/logging/rtc_event_log/rtc_event_log_impl.h @@ -24,6 +24,7 @@ #include "api/task_queue/task_queue_factory.h" #include "logging/rtc_event_log/encoder/rtc_event_log_encoder.h" #include "rtc_base/synchronization/sequence_checker.h" +#include "rtc_base/system/no_unique_address.h" #include "rtc_base/task_queue.h" #include "rtc_base/thread_annotations.h" @@ -78,7 +79,7 @@ class RtcEventLogImpl final : public RtcEventLog { int64_t last_output_ms_ RTC_GUARDED_BY(*task_queue_); bool output_scheduled_ RTC_GUARDED_BY(*task_queue_); - SequenceChecker logging_state_checker_; + RTC_NO_UNIQUE_ADDRESS SequenceChecker logging_state_checker_; bool logging_state_started_ RTC_GUARDED_BY(logging_state_checker_); // Since we are posting tasks bound to |this|, it is critical that the event diff --git a/media/BUILD.gn b/media/BUILD.gn index f5f1dfa0e0..a3c1b92ae0 100644 --- a/media/BUILD.gn +++ b/media/BUILD.gn @@ -194,6 +194,7 @@ rtc_library("rtc_simulcast_encoder_adapter") { "../rtc_base:rtc_base_approved", "../rtc_base/experiments:rate_control_settings", "../rtc_base/synchronization:sequence_checker", + "../rtc_base/system:no_unique_address", "../rtc_base/system:rtc_export", "../system_wrappers", "../system_wrappers:field_trial", diff --git a/media/engine/simulcast_encoder_adapter.h b/media/engine/simulcast_encoder_adapter.h index 5b2c027577..1067df8ed1 100644 --- a/media/engine/simulcast_encoder_adapter.h +++ b/media/engine/simulcast_encoder_adapter.h @@ -26,6 +26,7 @@ #include "modules/video_coding/utility/framerate_controller.h" #include "rtc_base/atomic_ops.h" #include "rtc_base/synchronization/sequence_checker.h" +#include "rtc_base/system/no_unique_address.h" #include "rtc_base/system/rtc_export.h" namespace webrtc { @@ -124,7 +125,7 @@ class RTC_EXPORT SimulcastEncoderAdapter : public VideoEncoder { EncodedImageCallback* encoded_complete_callback_; // Used for checking the single-threaded access of the encoder interface. - SequenceChecker encoder_queue_; + RTC_NO_UNIQUE_ADDRESS SequenceChecker encoder_queue_; // Store encoders in between calls to Release and InitEncode, so they don't // have to be recreated. Remaining encoders are destroyed by the destructor. diff --git a/modules/congestion_controller/rtp/BUILD.gn b/modules/congestion_controller/rtp/BUILD.gn index 2f97b67263..a030976a96 100644 --- a/modules/congestion_controller/rtp/BUILD.gn +++ b/modules/congestion_controller/rtp/BUILD.gn @@ -31,6 +31,7 @@ rtc_library("control_handler") { "../../../rtc_base:checks", "../../../rtc_base:safe_minmax", "../../../rtc_base/synchronization:sequence_checker", + "../../../rtc_base/system:no_unique_address", "../../../system_wrappers:field_trial", "../../pacing", ] diff --git a/modules/congestion_controller/rtp/control_handler.h b/modules/congestion_controller/rtp/control_handler.h index 9cce0d72bf..e3450f3eb1 100644 --- a/modules/congestion_controller/rtp/control_handler.h +++ b/modules/congestion_controller/rtp/control_handler.h @@ -20,6 +20,7 @@ #include "modules/pacing/paced_sender.h" #include "rtc_base/constructor_magic.h" #include "rtc_base/synchronization/sequence_checker.h" +#include "rtc_base/system/no_unique_address.h" namespace webrtc { // This is used to observe the network controller state and route calls to @@ -46,7 +47,7 @@ class CongestionControlHandler { const bool disable_pacer_emergency_stop_; int64_t pacer_expected_queue_ms_ = 0; - SequenceChecker sequenced_checker_; + RTC_NO_UNIQUE_ADDRESS SequenceChecker sequenced_checker_; RTC_DISALLOW_COPY_AND_ASSIGN(CongestionControlHandler); }; } // namespace webrtc diff --git a/modules/rtp_rtcp/BUILD.gn b/modules/rtp_rtcp/BUILD.gn index 9761790410..100a338710 100644 --- a/modules/rtp_rtcp/BUILD.gn +++ b/modules/rtp_rtcp/BUILD.gn @@ -298,6 +298,7 @@ rtc_library("rtp_rtcp") { "../../rtc_base/experiments:field_trial_parser", "../../rtc_base/synchronization:mutex", "../../rtc_base/synchronization:sequence_checker", + "../../rtc_base/system:no_unique_address", "../../rtc_base/task_utils:pending_task_safety_flag", "../../rtc_base/task_utils:repeating_task", "../../rtc_base/task_utils:to_queued_task", diff --git a/modules/rtp_rtcp/include/flexfec_receiver.h b/modules/rtp_rtcp/include/flexfec_receiver.h index 6df984f85a..f9bac9c7fa 100644 --- a/modules/rtp_rtcp/include/flexfec_receiver.h +++ b/modules/rtp_rtcp/include/flexfec_receiver.h @@ -20,6 +20,7 @@ #include "modules/rtp_rtcp/source/forward_error_correction.h" #include "modules/rtp_rtcp/source/rtp_packet_received.h" #include "rtc_base/synchronization/sequence_checker.h" +#include "rtc_base/system/no_unique_address.h" #include "rtc_base/thread_annotations.h" namespace webrtc { @@ -69,7 +70,7 @@ class FlexfecReceiver { int64_t last_recovered_packet_ms_ RTC_GUARDED_BY(sequence_checker_); FecPacketCounter packet_counter_ RTC_GUARDED_BY(sequence_checker_); - SequenceChecker sequence_checker_; + RTC_NO_UNIQUE_ADDRESS SequenceChecker sequence_checker_; }; } // namespace webrtc diff --git a/modules/rtp_rtcp/source/rtp_rtcp_impl2.h b/modules/rtp_rtcp/source/rtp_rtcp_impl2.h index 9eb7e3a6d6..d93e72b286 100644 --- a/modules/rtp_rtcp/source/rtp_rtcp_impl2.h +++ b/modules/rtp_rtcp/source/rtp_rtcp_impl2.h @@ -37,6 +37,7 @@ #include "rtc_base/gtest_prod_util.h" #include "rtc_base/synchronization/mutex.h" #include "rtc_base/synchronization/sequence_checker.h" +#include "rtc_base/system/no_unique_address.h" #include "rtc_base/task_utils/pending_task_safety_flag.h" #include "rtc_base/task_utils/repeating_task.h" @@ -292,7 +293,7 @@ class ModuleRtpRtcpImpl2 final : public RtpRtcpInterface, void PeriodicUpdate(); TaskQueueBase* const worker_queue_; - SequenceChecker process_thread_checker_; + RTC_NO_UNIQUE_ADDRESS SequenceChecker process_thread_checker_; std::unique_ptr rtp_sender_; diff --git a/modules/rtp_rtcp/source/rtp_sender_egress.h b/modules/rtp_rtcp/source/rtp_sender_egress.h index 8e36425f29..d7d71e2f1f 100644 --- a/modules/rtp_rtcp/source/rtp_sender_egress.h +++ b/modules/rtp_rtcp/source/rtp_sender_egress.h @@ -30,6 +30,7 @@ #include "rtc_base/rate_statistics.h" #include "rtc_base/synchronization/mutex.h" #include "rtc_base/synchronization/sequence_checker.h" +#include "rtc_base/system/no_unique_address.h" #include "rtc_base/task_utils/pending_task_safety_flag.h" #include "rtc_base/task_utils/repeating_task.h" #include "rtc_base/thread_annotations.h" @@ -127,7 +128,7 @@ class RtpSenderEgress { void PeriodicUpdate(); TaskQueueBase* const worker_queue_; - SequenceChecker pacer_checker_; + RTC_NO_UNIQUE_ADDRESS SequenceChecker pacer_checker_; const uint32_t ssrc_; const absl::optional rtx_ssrc_; const absl::optional flexfec_ssrc_; diff --git a/modules/video_coding/BUILD.gn b/modules/video_coding/BUILD.gn index e7a9def577..742a3056ff 100644 --- a/modules/video_coding/BUILD.gn +++ b/modules/video_coding/BUILD.gn @@ -108,6 +108,7 @@ rtc_library("video_coding") { "../../api/video:video_bitrate_allocation", "../../api/video:video_bitrate_allocator_factory", "../../rtc_base:deprecation", + "../../rtc_base/system:no_unique_address", "../../rtc_base/task_utils:to_queued_task", "../../system_wrappers:field_trial", "../../system_wrappers:metrics", @@ -351,6 +352,7 @@ rtc_library("video_coding_utility") { "../../rtc_base/synchronization:sequence_checker", "../../rtc_base/system:arch", "../../rtc_base/system:file_wrapper", + "../../rtc_base/system:no_unique_address", "../../rtc_base/task_utils:repeating_task", "../../rtc_base/task_utils:to_queued_task", "../../system_wrappers:field_trial", @@ -702,6 +704,7 @@ if (rtc_include_tests) { "../../rtc_base:rtc_task_queue", "../../rtc_base/synchronization:mutex", "../../rtc_base/synchronization:sequence_checker", + "../../rtc_base/system:no_unique_address", "../../rtc_base/task_utils:to_queued_task", "../../test:test_support", "../../test:video_test_common", diff --git a/modules/video_coding/codecs/test/videoprocessor.h b/modules/video_coding/codecs/test/videoprocessor.h index cd755ea0e0..ba171d6cd9 100644 --- a/modules/video_coding/codecs/test/videoprocessor.h +++ b/modules/video_coding/codecs/test/videoprocessor.h @@ -38,6 +38,7 @@ #include "rtc_base/checks.h" #include "rtc_base/constructor_magic.h" #include "rtc_base/synchronization/sequence_checker.h" +#include "rtc_base/system/no_unique_address.h" #include "rtc_base/thread_annotations.h" #include "rtc_base/thread_checker.h" #include "test/testsupport/frame_reader.h" @@ -270,7 +271,7 @@ class VideoProcessor { bool is_finalized_ RTC_GUARDED_BY(sequence_checker_); // This class must be operated on a TaskQueue. - SequenceChecker sequence_checker_; + RTC_NO_UNIQUE_ADDRESS SequenceChecker sequence_checker_; RTC_DISALLOW_COPY_AND_ASSIGN(VideoProcessor); }; diff --git a/modules/video_coding/frame_buffer2.h b/modules/video_coding/frame_buffer2.h index 2ed21c4f70..b19b6d3a41 100644 --- a/modules/video_coding/frame_buffer2.h +++ b/modules/video_coding/frame_buffer2.h @@ -28,6 +28,7 @@ #include "rtc_base/numerics/sequence_number_util.h" #include "rtc_base/synchronization/mutex.h" #include "rtc_base/synchronization/sequence_checker.h" +#include "rtc_base/system/no_unique_address.h" #include "rtc_base/task_queue.h" #include "rtc_base/task_utils/repeating_task.h" #include "rtc_base/thread_annotations.h" @@ -161,8 +162,8 @@ class FrameBuffer { EncodedFrame* CombineAndDeleteFrames( const std::vector& frames) const; - SequenceChecker construction_checker_; - SequenceChecker callback_checker_; + RTC_NO_UNIQUE_ADDRESS SequenceChecker construction_checker_; + RTC_NO_UNIQUE_ADDRESS SequenceChecker callback_checker_; // Stores only undecoded frames. FrameMap frames_ RTC_GUARDED_BY(mutex_); diff --git a/modules/video_coding/loss_notification_controller.h b/modules/video_coding/loss_notification_controller.h index a7a1fb9fe8..06e193b557 100644 --- a/modules/video_coding/loss_notification_controller.h +++ b/modules/video_coding/loss_notification_controller.h @@ -19,6 +19,7 @@ #include "api/array_view.h" #include "modules/include/module_common_types.h" #include "rtc_base/synchronization/sequence_checker.h" +#include "rtc_base/system/no_unique_address.h" namespace webrtc { @@ -102,7 +103,7 @@ class LossNotificationController { // (Naturally, later frames must also be assemblable to be decodable.) std::set decodable_frame_ids_ RTC_GUARDED_BY(sequence_checker_); - SequenceChecker sequence_checker_; + RTC_NO_UNIQUE_ADDRESS SequenceChecker sequence_checker_; }; } // namespace webrtc diff --git a/modules/video_coding/utility/quality_scaler.h b/modules/video_coding/utility/quality_scaler.h index 28f225f397..987d49f1a8 100644 --- a/modules/video_coding/utility/quality_scaler.h +++ b/modules/video_coding/utility/quality_scaler.h @@ -24,6 +24,7 @@ #include "rtc_base/ref_count.h" #include "rtc_base/ref_counted_object.h" #include "rtc_base/synchronization/sequence_checker.h" +#include "rtc_base/system/no_unique_address.h" #include "rtc_base/task_queue.h" namespace webrtc { @@ -82,7 +83,7 @@ class QualityScaler { std::unique_ptr pending_qp_task_ RTC_GUARDED_BY(&task_checker_); QualityScalerQpUsageHandlerInterface* const handler_ RTC_GUARDED_BY(&task_checker_); - SequenceChecker task_checker_; + RTC_NO_UNIQUE_ADDRESS SequenceChecker task_checker_; VideoEncoder::QpThresholds thresholds_ RTC_GUARDED_BY(&task_checker_); const int64_t sampling_period_ms_; diff --git a/p2p/BUILD.gn b/p2p/BUILD.gn index f8f20de784..d4330ef94a 100644 --- a/p2p/BUILD.gn +++ b/p2p/BUILD.gn @@ -100,6 +100,7 @@ rtc_library("rtc_p2p") { "../rtc_base:rtc_numerics", "../rtc_base/experiments:field_trial_parser", "../rtc_base/synchronization:sequence_checker", + "../rtc_base/system:no_unique_address", # Needed by pseudo_tcp, which should move to a separate target. "../rtc_base:safe_minmax", diff --git a/p2p/base/dtls_transport.h b/p2p/base/dtls_transport.h index 430c912330..5c8a721d03 100644 --- a/p2p/base/dtls_transport.h +++ b/p2p/base/dtls_transport.h @@ -25,6 +25,7 @@ #include "rtc_base/stream.h" #include "rtc_base/strings/string_builder.h" #include "rtc_base/synchronization/sequence_checker.h" +#include "rtc_base/system/no_unique_address.h" #include "rtc_base/thread_checker.h" namespace rtc { @@ -55,7 +56,7 @@ class StreamInterfaceChannel : public rtc::StreamInterface { int* error) override; private: - webrtc::SequenceChecker sequence_checker_; + RTC_NO_UNIQUE_ADDRESS webrtc::SequenceChecker sequence_checker_; IceTransportInternal* const ice_transport_; // owned by DtlsTransport rtc::StreamState state_ RTC_GUARDED_BY(sequence_checker_); rtc::BufferQueue packets_ RTC_GUARDED_BY(sequence_checker_); diff --git a/pc/BUILD.gn b/pc/BUILD.gn index 84aba07764..143ce25c74 100644 --- a/pc/BUILD.gn +++ b/pc/BUILD.gn @@ -286,6 +286,7 @@ rtc_library("peerconnection") { "../rtc_base/synchronization:mutex", "../rtc_base/synchronization:sequence_checker", "../rtc_base/system:file_wrapper", + "../rtc_base/system:no_unique_address", "../rtc_base/system:rtc_export", "../rtc_base/task_utils:pending_task_safety_flag", "../rtc_base/task_utils:to_queued_task", @@ -515,6 +516,7 @@ rtc_library("video_rtp_track_source") { "../media:rtc_media_base", "../rtc_base", "../rtc_base/synchronization:mutex", + "../rtc_base/system:no_unique_address", ] } diff --git a/pc/video_rtp_track_source.h b/pc/video_rtp_track_source.h index b887849312..9903aaa232 100644 --- a/pc/video_rtp_track_source.h +++ b/pc/video_rtp_track_source.h @@ -17,6 +17,7 @@ #include "pc/video_track_source.h" #include "rtc_base/callback.h" #include "rtc_base/synchronization/mutex.h" +#include "rtc_base/system/no_unique_address.h" namespace webrtc { @@ -67,7 +68,7 @@ class VideoRtpTrackSource : public VideoTrackSource { rtc::VideoSinkInterface* sink) override; private: - SequenceChecker worker_sequence_checker_; + RTC_NO_UNIQUE_ADDRESS SequenceChecker worker_sequence_checker_; // |broadcaster_| is needed since the decoder can only handle one sink. // It might be better if the decoder can handle multiple sinks and consider // the VideoSinkWants. diff --git a/rtc_base/BUILD.gn b/rtc_base/BUILD.gn index 6ee7190125..8b920908f3 100644 --- a/rtc_base/BUILD.gn +++ b/rtc_base/BUILD.gn @@ -76,6 +76,7 @@ rtc_library("rtc_base_approved") { "../api:scoped_refptr", "synchronization:mutex", "system:arch", + "system:no_unique_address", "system:rtc_export", "system:unused", "third_party/base64", @@ -483,6 +484,7 @@ rtc_source_set("rtc_operations_chain") { ":refcount", "../api:scoped_refptr", "synchronization:sequence_checker", + "system:no_unique_address", ] absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ] } @@ -586,6 +588,7 @@ rtc_library("weak_ptr") { ":refcount", "../api:scoped_refptr", "synchronization:sequence_checker", + "system:no_unique_address", ] } @@ -834,6 +837,7 @@ rtc_library("rtc_base") { "synchronization:sequence_checker", "system:file_wrapper", "system:inline", + "system:no_unique_address", "system:rtc_export", "task_utils:pending_task_safety_flag", "task_utils:repeating_task", diff --git a/rtc_base/buffer_queue.h b/rtc_base/buffer_queue.h index 24a9b04dc2..5895530969 100644 --- a/rtc_base/buffer_queue.h +++ b/rtc_base/buffer_queue.h @@ -19,6 +19,7 @@ #include "rtc_base/buffer.h" #include "rtc_base/constructor_magic.h" #include "rtc_base/synchronization/sequence_checker.h" +#include "rtc_base/system/no_unique_address.h" #include "rtc_base/thread_annotations.h" namespace rtc { @@ -55,7 +56,7 @@ class BufferQueue final { } private: - webrtc::SequenceChecker sequence_checker_; + RTC_NO_UNIQUE_ADDRESS webrtc::SequenceChecker sequence_checker_; const size_t capacity_; const size_t default_size_; std::deque queue_ RTC_GUARDED_BY(sequence_checker_); diff --git a/rtc_base/net_helpers.h b/rtc_base/net_helpers.h index c6aa4be5b2..172a222456 100644 --- a/rtc_base/net_helpers.h +++ b/rtc_base/net_helpers.h @@ -23,6 +23,7 @@ #include "rtc_base/ip_address.h" #include "rtc_base/socket_address.h" #include "rtc_base/synchronization/sequence_checker.h" +#include "rtc_base/system/no_unique_address.h" #include "rtc_base/system/rtc_export.h" #include "rtc_base/task_utils/pending_task_safety_flag.h" #include "rtc_base/thread.h" @@ -62,7 +63,7 @@ class RTC_EXPORT AsyncResolver : public AsyncResolverInterface { bool recursion_check_ = false; // Protects against SignalDone calling into Destroy. bool destroy_called_ = false; - webrtc::SequenceChecker sequence_checker_; + RTC_NO_UNIQUE_ADDRESS webrtc::SequenceChecker sequence_checker_; }; // rtc namespaced wrappers for inet_ntop and inet_pton so we can avoid diff --git a/rtc_base/operations_chain.h b/rtc_base/operations_chain.h index 44a3d9acb8..a7252d46f0 100644 --- a/rtc_base/operations_chain.h +++ b/rtc_base/operations_chain.h @@ -25,6 +25,7 @@ #include "rtc_base/ref_count.h" #include "rtc_base/ref_counted_object.h" #include "rtc_base/synchronization/sequence_checker.h" +#include "rtc_base/system/no_unique_address.h" namespace rtc { @@ -183,7 +184,7 @@ class OperationsChain final : public RefCountedObject { std::function CreateOperationsChainCallback(); void OnOperationComplete(); - webrtc::SequenceChecker sequence_checker_; + RTC_NO_UNIQUE_ADDRESS webrtc::SequenceChecker sequence_checker_; // FIFO-list of operations that are chained. An operation that is executing // remains on this list until it has completed by invoking the callback passed // to it. diff --git a/rtc_base/system/BUILD.gn b/rtc_base/system/BUILD.gn index bf8cf94e3a..9f83c629e2 100644 --- a/rtc_base/system/BUILD.gn +++ b/rtc_base/system/BUILD.gn @@ -55,6 +55,10 @@ rtc_source_set("rtc_export") { ] } +rtc_source_set("no_unique_address") { + sources = [ "no_unique_address.h" ] +} + if (is_mac || is_ios) { rtc_library("cocoa_threading") { sources = [ diff --git a/rtc_base/system/no_unique_address.h b/rtc_base/system/no_unique_address.h new file mode 100644 index 0000000000..403f2b8fb2 --- /dev/null +++ b/rtc_base/system/no_unique_address.h @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2020 The WebRTC project authors. All Rights Reserved. + * + * Use of this source code is governed by a BSD-style license + * that can be found in the LICENSE file in the root of the source + * tree. An additional intellectual property rights grant can be found + * in the file PATENTS. All contributing project authors may + * be found in the AUTHORS file in the root of the source tree. + */ + +#ifndef RTC_BASE_SYSTEM_NO_UNIQUE_ADDRESS_H_ +#define RTC_BASE_SYSTEM_NO_UNIQUE_ADDRESS_H_ + +// RTC_NO_UNIQUE_ADDRESS is a portable annotation to tell the compiler that +// a data member need not have an address distinct from all other non-static +// data members of its class. +// It allows empty types to actually occupy zero bytes as class members, +// instead of occupying at least one byte just so that they get their own +// address. There is almost never any reason not to use it on class members +// that could possibly be empty. +// The macro expands to [[no_unique_address]] if the compiler supports the +// attribute, it expands to nothing otherwise. +// Clang should supports this attribute since C++11, while other compilers +// should add support for it starting from C++20. Among clang compilers, +// clang-cl doesn't support it yet and support is unclear also when the target +// platform is iOS. +// +// TODO(bugs.webrtc.org/12218): Re-enable on MSan builds. +#if !defined(__SANITIZE_MEMORY__) && \ + ((defined(__clang__) && !defined(_MSC_VER) && !defined(WEBRTC_IOS)) || \ + __cplusplus > 201703L) +// NOLINTNEXTLINE(whitespace/braces) +#define RTC_NO_UNIQUE_ADDRESS [[no_unique_address]] +#else +#define RTC_NO_UNIQUE_ADDRESS +#endif + +#endif // RTC_BASE_SYSTEM_NO_UNIQUE_ADDRESS_H_ diff --git a/rtc_base/task_utils/BUILD.gn b/rtc_base/task_utils/BUILD.gn index 54f9a048f0..018844fe65 100644 --- a/rtc_base/task_utils/BUILD.gn +++ b/rtc_base/task_utils/BUILD.gn @@ -38,6 +38,7 @@ rtc_library("pending_task_safety_flag") { "..:thread_checker", "../../api:scoped_refptr", "../synchronization:sequence_checker", + "../system:no_unique_address", ] } diff --git a/rtc_base/task_utils/pending_task_safety_flag.h b/rtc_base/task_utils/pending_task_safety_flag.h index 580fb3f912..182db2cbbc 100644 --- a/rtc_base/task_utils/pending_task_safety_flag.h +++ b/rtc_base/task_utils/pending_task_safety_flag.h @@ -15,6 +15,7 @@ #include "rtc_base/checks.h" #include "rtc_base/ref_count.h" #include "rtc_base/synchronization/sequence_checker.h" +#include "rtc_base/system/no_unique_address.h" namespace webrtc { @@ -58,7 +59,7 @@ class PendingTaskSafetyFlag : public rtc::RefCountInterface { private: bool alive_ = true; - SequenceChecker main_sequence_; + RTC_NO_UNIQUE_ADDRESS SequenceChecker main_sequence_; }; // Makes using PendingTaskSafetyFlag very simple. Automatic PTSF creation diff --git a/rtc_base/weak_ptr.h b/rtc_base/weak_ptr.h index 8b2ba099cb..68d57fc557 100644 --- a/rtc_base/weak_ptr.h +++ b/rtc_base/weak_ptr.h @@ -18,6 +18,7 @@ #include "rtc_base/ref_count.h" #include "rtc_base/ref_counted_object.h" #include "rtc_base/synchronization/sequence_checker.h" +#include "rtc_base/system/no_unique_address.h" // The implementation is borrowed from chromium except that it does not // implement SupportsWeakPtr. @@ -103,7 +104,7 @@ class WeakReference { ~Flag() override; - ::webrtc::SequenceChecker checker_; + RTC_NO_UNIQUE_ADDRESS ::webrtc::SequenceChecker checker_; bool is_valid_; }; diff --git a/rtc_tools/network_tester/BUILD.gn b/rtc_tools/network_tester/BUILD.gn index ff823806e2..b270262f0d 100644 --- a/rtc_tools/network_tester/BUILD.gn +++ b/rtc_tools/network_tester/BUILD.gn @@ -50,6 +50,7 @@ if (rtc_enable_protobuf) { "../../rtc_base:rtc_task_queue", "../../rtc_base/synchronization:mutex", "../../rtc_base/synchronization:sequence_checker", + "../../rtc_base/system:no_unique_address", "../../rtc_base/third_party/sigslot", ] absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ] diff --git a/rtc_tools/network_tester/packet_sender.h b/rtc_tools/network_tester/packet_sender.h index ffc1118e20..c0ea2c1680 100644 --- a/rtc_tools/network_tester/packet_sender.h +++ b/rtc_tools/network_tester/packet_sender.h @@ -18,6 +18,7 @@ #include "rtc_base/constructor_magic.h" #include "rtc_base/ignore_wundef.h" #include "rtc_base/synchronization/sequence_checker.h" +#include "rtc_base/system/no_unique_address.h" #include "rtc_base/task_queue.h" #ifdef WEBRTC_NETWORK_TESTER_PROTO @@ -49,7 +50,7 @@ class PacketSender { void UpdateTestSetting(size_t packet_size, int64_t send_interval_ms); private: - SequenceChecker worker_queue_checker_; + RTC_NO_UNIQUE_ADDRESS SequenceChecker worker_queue_checker_; size_t packet_size_ RTC_GUARDED_BY(worker_queue_checker_); int64_t send_interval_ms_ RTC_GUARDED_BY(worker_queue_checker_); int64_t sequence_number_ RTC_GUARDED_BY(worker_queue_checker_); diff --git a/video/BUILD.gn b/video/BUILD.gn index c6774dc799..84ca9bd677 100644 --- a/video/BUILD.gn +++ b/video/BUILD.gn @@ -129,6 +129,7 @@ rtc_library("video") { "../rtc_base/experiments:rate_control_settings", "../rtc_base/synchronization:mutex", "../rtc_base/synchronization:sequence_checker", + "../rtc_base/system:no_unique_address", "../rtc_base/system:thread_registry", "../rtc_base/task_utils:pending_task_safety_flag", "../rtc_base/task_utils:repeating_task", @@ -254,6 +255,7 @@ rtc_library("video_stream_encoder_impl") { "../rtc_base/experiments:rate_control_settings", "../rtc_base/synchronization:mutex", "../rtc_base/synchronization:sequence_checker", + "../rtc_base/system:no_unique_address", "../rtc_base/task_utils:pending_task_safety_flag", "../rtc_base/task_utils:repeating_task", "../system_wrappers", diff --git a/video/adaptation/BUILD.gn b/video/adaptation/BUILD.gn index a96f4cf36a..755e2f6b4c 100644 --- a/video/adaptation/BUILD.gn +++ b/video/adaptation/BUILD.gn @@ -53,6 +53,7 @@ rtc_library("video_adaptation") { "../../rtc_base/experiments:quality_scaler_settings", "../../rtc_base/synchronization:mutex", "../../rtc_base/synchronization:sequence_checker", + "../../rtc_base/system:no_unique_address", "../../rtc_base/task_utils:repeating_task", "../../rtc_base/task_utils:to_queued_task", "../../system_wrappers:field_trial", diff --git a/video/adaptation/balanced_constraint.h b/video/adaptation/balanced_constraint.h index 5e02408025..15219360f5 100644 --- a/video/adaptation/balanced_constraint.h +++ b/video/adaptation/balanced_constraint.h @@ -18,6 +18,7 @@ #include "call/adaptation/degradation_preference_provider.h" #include "rtc_base/experiments/balanced_degradation_settings.h" #include "rtc_base/synchronization/sequence_checker.h" +#include "rtc_base/system/no_unique_address.h" namespace webrtc { @@ -38,7 +39,7 @@ class BalancedConstraint : public AdaptationConstraint { const VideoSourceRestrictions& restrictions_after) const override; private: - SequenceChecker sequence_checker_; + RTC_NO_UNIQUE_ADDRESS SequenceChecker sequence_checker_; absl::optional encoder_target_bitrate_bps_ RTC_GUARDED_BY(&sequence_checker_); const BalancedDegradationSettings balanced_settings_; diff --git a/video/adaptation/bitrate_constraint.h b/video/adaptation/bitrate_constraint.h index 015edcc13f..6fefb04c24 100644 --- a/video/adaptation/bitrate_constraint.h +++ b/video/adaptation/bitrate_constraint.h @@ -19,6 +19,7 @@ #include "call/adaptation/video_source_restrictions.h" #include "call/adaptation/video_stream_input_state.h" #include "rtc_base/synchronization/sequence_checker.h" +#include "rtc_base/system/no_unique_address.h" namespace webrtc { @@ -40,7 +41,7 @@ class BitrateConstraint : public AdaptationConstraint { const VideoSourceRestrictions& restrictions_after) const override; private: - SequenceChecker sequence_checker_; + RTC_NO_UNIQUE_ADDRESS SequenceChecker sequence_checker_; absl::optional encoder_settings_ RTC_GUARDED_BY(&sequence_checker_); absl::optional encoder_target_bitrate_bps_ diff --git a/video/adaptation/overuse_frame_detector.h b/video/adaptation/overuse_frame_detector.h index 16217fff84..c9095d63a5 100644 --- a/video/adaptation/overuse_frame_detector.h +++ b/video/adaptation/overuse_frame_detector.h @@ -21,6 +21,7 @@ #include "rtc_base/experiments/field_trial_parser.h" #include "rtc_base/numerics/exp_filter.h" #include "rtc_base/synchronization/sequence_checker.h" +#include "rtc_base/system/no_unique_address.h" #include "rtc_base/task_utils/repeating_task.h" #include "rtc_base/thread_annotations.h" @@ -134,7 +135,7 @@ class OveruseFrameDetector { static std::unique_ptr CreateProcessingUsage( const CpuOveruseOptions& options); - SequenceChecker task_checker_; + RTC_NO_UNIQUE_ADDRESS SequenceChecker task_checker_; // Owned by the task queue from where StartCheckForOveruse is called. RepeatingTaskHandle check_overuse_task_ RTC_GUARDED_BY(task_checker_); diff --git a/video/call_stats2.h b/video/call_stats2.h index 822685320f..30e8263e2f 100644 --- a/video/call_stats2.h +++ b/video/call_stats2.h @@ -19,6 +19,7 @@ #include "modules/rtp_rtcp/include/rtp_rtcp_defines.h" #include "rtc_base/constructor_magic.h" #include "rtc_base/synchronization/sequence_checker.h" +#include "rtc_base/system/no_unique_address.h" #include "rtc_base/task_queue.h" #include "rtc_base/task_utils/pending_task_safety_flag.h" #include "rtc_base/task_utils/repeating_task.h" @@ -132,8 +133,8 @@ class CallStats { // for the observers_ list, which makes the most common case lock free. std::list observers_; - SequenceChecker construction_thread_checker_; - SequenceChecker process_thread_checker_; + RTC_NO_UNIQUE_ADDRESS SequenceChecker construction_thread_checker_; + RTC_NO_UNIQUE_ADDRESS SequenceChecker process_thread_checker_; TaskQueueBase* const task_queue_; // Used to signal destruction to potentially pending tasks. diff --git a/video/receive_statistics_proxy2.h b/video/receive_statistics_proxy2.h index 1357c407ad..e9950c5e84 100644 --- a/video/receive_statistics_proxy2.h +++ b/video/receive_statistics_proxy2.h @@ -28,6 +28,7 @@ #include "rtc_base/rate_statistics.h" #include "rtc_base/rate_tracker.h" #include "rtc_base/synchronization/sequence_checker.h" +#include "rtc_base/system/no_unique_address.h" #include "rtc_base/task_utils/pending_task_safety_flag.h" #include "rtc_base/thread_annotations.h" #include "rtc_base/thread_checker.h" @@ -213,9 +214,9 @@ class ReceiveStatisticsProxy : public VCMReceiveStatisticsCallback, ScopedTaskSafety task_safety_; - SequenceChecker decode_queue_; + RTC_NO_UNIQUE_ADDRESS SequenceChecker decode_queue_; rtc::ThreadChecker main_thread_; - SequenceChecker incoming_render_queue_; + RTC_NO_UNIQUE_ADDRESS SequenceChecker incoming_render_queue_; }; } // namespace internal diff --git a/video/rtp_streams_synchronizer2.h b/video/rtp_streams_synchronizer2.h index 6a522e801d..3d31738225 100644 --- a/video/rtp_streams_synchronizer2.h +++ b/video/rtp_streams_synchronizer2.h @@ -14,6 +14,7 @@ #include #include "rtc_base/synchronization/sequence_checker.h" +#include "rtc_base/system/no_unique_address.h" #include "rtc_base/task_queue.h" #include "rtc_base/task_utils/repeating_task.h" #include "video/stream_synchronization.h" @@ -54,7 +55,7 @@ class RtpStreamsSynchronizer { // we might be running on an rtc::Thread implementation of TaskQueue, which // does not consistently set itself as the active TaskQueue. // Instead, we rely on a SequenceChecker for now. - SequenceChecker main_checker_; + RTC_NO_UNIQUE_ADDRESS SequenceChecker main_checker_; Syncable* const syncable_video_; diff --git a/video/rtp_video_stream_receiver.h b/video/rtp_video_stream_receiver.h index 2c4342dd7d..40958c48ec 100644 --- a/video/rtp_video_stream_receiver.h +++ b/video/rtp_video_stream_receiver.h @@ -46,6 +46,7 @@ #include "rtc_base/numerics/sequence_number_util.h" #include "rtc_base/synchronization/mutex.h" #include "rtc_base/synchronization/sequence_checker.h" +#include "rtc_base/system/no_unique_address.h" #include "rtc_base/thread_annotations.h" #include "rtc_base/thread_checker.h" #include "video/buffered_frame_decryptor.h" @@ -323,7 +324,7 @@ class RtpVideoStreamReceiver : public LossNotificationSender, ReceiveStatistics* const rtp_receive_statistics_; std::unique_ptr ulpfec_receiver_; - SequenceChecker worker_task_checker_; + RTC_NO_UNIQUE_ADDRESS SequenceChecker worker_task_checker_; bool receiving_ RTC_GUARDED_BY(worker_task_checker_); int64_t last_packet_log_ms_ RTC_GUARDED_BY(worker_task_checker_); diff --git a/video/rtp_video_stream_receiver2.h b/video/rtp_video_stream_receiver2.h index fb31328629..40e7ef6f1b 100644 --- a/video/rtp_video_stream_receiver2.h +++ b/video/rtp_video_stream_receiver2.h @@ -43,6 +43,7 @@ #include "rtc_base/experiments/field_trial_parser.h" #include "rtc_base/numerics/sequence_number_util.h" #include "rtc_base/synchronization/sequence_checker.h" +#include "rtc_base/system/no_unique_address.h" #include "rtc_base/thread_annotations.h" #include "video/buffered_frame_decryptor.h" #include "video/rtp_video_stream_receiver_frame_transformer_delegate.h" @@ -233,7 +234,7 @@ class RtpVideoStreamReceiver2 : public LossNotificationSender, bool decodability_flag; }; - SequenceChecker worker_task_checker_; + RTC_NO_UNIQUE_ADDRESS SequenceChecker worker_task_checker_; KeyFrameRequestSender* const key_frame_request_sender_; NackSender* const nack_sender_; LossNotificationSender* const loss_notification_sender_; @@ -286,7 +287,7 @@ class RtpVideoStreamReceiver2 : public LossNotificationSender, ReceiveStatistics* const rtp_receive_statistics_; std::unique_ptr ulpfec_receiver_; - SequenceChecker worker_task_checker_; + RTC_NO_UNIQUE_ADDRESS SequenceChecker worker_task_checker_; bool receiving_ RTC_GUARDED_BY(worker_task_checker_); int64_t last_packet_log_ms_ RTC_GUARDED_BY(worker_task_checker_); diff --git a/video/rtp_video_stream_receiver_frame_transformer_delegate.h b/video/rtp_video_stream_receiver_frame_transformer_delegate.h index e687e7f47b..2ae8e63bba 100644 --- a/video/rtp_video_stream_receiver_frame_transformer_delegate.h +++ b/video/rtp_video_stream_receiver_frame_transformer_delegate.h @@ -16,6 +16,7 @@ #include "api/frame_transformer_interface.h" #include "modules/video_coding/frame_object.h" #include "rtc_base/synchronization/sequence_checker.h" +#include "rtc_base/system/no_unique_address.h" #include "rtc_base/thread.h" namespace webrtc { @@ -61,7 +62,7 @@ class RtpVideoStreamReceiverFrameTransformerDelegate ~RtpVideoStreamReceiverFrameTransformerDelegate() override = default; private: - SequenceChecker network_sequence_checker_; + RTC_NO_UNIQUE_ADDRESS SequenceChecker network_sequence_checker_; RtpVideoFrameReceiver* receiver_ RTC_GUARDED_BY(network_sequence_checker_); rtc::scoped_refptr frame_transformer_ RTC_GUARDED_BY(network_sequence_checker_); diff --git a/video/video_receive_stream.h b/video/video_receive_stream.h index 5fb9cf72da..5e52063536 100644 --- a/video/video_receive_stream.h +++ b/video/video_receive_stream.h @@ -25,6 +25,7 @@ #include "modules/video_coding/video_receiver2.h" #include "rtc_base/synchronization/mutex.h" #include "rtc_base/synchronization/sequence_checker.h" +#include "rtc_base/system/no_unique_address.h" #include "rtc_base/task_queue.h" #include "system_wrappers/include/clock.h" #include "video/receive_statistics_proxy.h" @@ -150,9 +151,9 @@ class VideoReceiveStream : public webrtc::VideoReceiveStream, void UpdateHistograms(); - SequenceChecker worker_sequence_checker_; - SequenceChecker module_process_sequence_checker_; - SequenceChecker network_sequence_checker_; + RTC_NO_UNIQUE_ADDRESS SequenceChecker worker_sequence_checker_; + RTC_NO_UNIQUE_ADDRESS SequenceChecker module_process_sequence_checker_; + RTC_NO_UNIQUE_ADDRESS SequenceChecker network_sequence_checker_; TaskQueueFactory* const task_queue_factory_; diff --git a/video/video_receive_stream2.h b/video/video_receive_stream2.h index e8e3edc3d1..658fab510c 100644 --- a/video/video_receive_stream2.h +++ b/video/video_receive_stream2.h @@ -25,6 +25,7 @@ #include "modules/video_coding/frame_buffer2.h" #include "modules/video_coding/video_receiver2.h" #include "rtc_base/synchronization/sequence_checker.h" +#include "rtc_base/system/no_unique_address.h" #include "rtc_base/task_queue.h" #include "rtc_base/task_utils/pending_task_safety_flag.h" #include "system_wrappers/include/clock.h" @@ -177,8 +178,8 @@ class VideoReceiveStream2 : public webrtc::VideoReceiveStream, void UpdateHistograms(); - SequenceChecker worker_sequence_checker_; - SequenceChecker module_process_sequence_checker_; + RTC_NO_UNIQUE_ADDRESS SequenceChecker worker_sequence_checker_; + RTC_NO_UNIQUE_ADDRESS SequenceChecker module_process_sequence_checker_; TaskQueueFactory* const task_queue_factory_; diff --git a/video/video_source_sink_controller.h b/video/video_source_sink_controller.h index ed8f990970..134366cfd0 100644 --- a/video/video_source_sink_controller.h +++ b/video/video_source_sink_controller.h @@ -19,6 +19,7 @@ #include "api/video/video_source_interface.h" #include "call/adaptation/video_source_restrictions.h" #include "rtc_base/synchronization/sequence_checker.h" +#include "rtc_base/system/no_unique_address.h" namespace webrtc { @@ -62,7 +63,7 @@ class VideoSourceSinkController { // Used to ensure that this class is called on threads/sequences that it and // downstream implementations were designed for. // In practice, this represent's libjingle's worker thread. - SequenceChecker sequence_checker_; + RTC_NO_UNIQUE_ADDRESS SequenceChecker sequence_checker_; rtc::VideoSinkInterface* const sink_; rtc::VideoSourceInterface* source_ diff --git a/video/video_stream_encoder.cc b/video/video_stream_encoder.cc index c197d234dd..5502139eb9 100644 --- a/video/video_stream_encoder.cc +++ b/video/video_stream_encoder.cc @@ -42,6 +42,7 @@ #include "rtc_base/logging.h" #include "rtc_base/strings/string_builder.h" #include "rtc_base/synchronization/sequence_checker.h" +#include "rtc_base/system/no_unique_address.h" #include "rtc_base/thread_annotations.h" #include "rtc_base/trace_event.h" #include "system_wrappers/include/field_trial.h" @@ -347,7 +348,7 @@ class VideoStreamEncoder::DegradationPreferenceManager } } - SequenceChecker sequence_checker_; + RTC_NO_UNIQUE_ADDRESS SequenceChecker sequence_checker_; DegradationPreference degradation_preference_ RTC_GUARDED_BY(&sequence_checker_); bool is_screenshare_ RTC_GUARDED_BY(&sequence_checker_);