mirror of
https://github.com/mollyim/webrtc.git
synced 2025-05-12 21:30:45 +01:00
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 <mbonadei@webrtc.org> Reviewed-by: Karl Wiberg <kwiberg@webrtc.org> Cr-Commit-Position: refs/heads/master@{#32246}
This commit is contained in:
parent
1e4d4fdf88
commit
f5e261aaf6
52 changed files with 138 additions and 42 deletions
|
@ -92,6 +92,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",
|
||||
|
|
|
@ -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<FrameTransformerInterface> frame_transformer_
|
||||
|
|
|
@ -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",
|
||||
]
|
||||
}
|
||||
|
|
|
@ -222,6 +222,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",
|
||||
|
@ -282,6 +283,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",
|
||||
|
|
|
@ -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<AllocatableTrack> allocatable_tracks_
|
||||
|
|
|
@ -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<ProcessThread> const module_thread_;
|
||||
std::function<void()> const on_one_ref_remaining_;
|
||||
|
|
|
@ -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<SharedModuleThread> module_thread_
|
||||
RTC_GUARDED_BY(call_thread_);
|
||||
};
|
||||
|
|
|
@ -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" ]
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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",
|
||||
]
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -294,6 +294,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",
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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<RtpSenderContext> rtp_sender_;
|
||||
|
||||
|
|
|
@ -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<uint32_t> rtx_ssrc_;
|
||||
const absl::optional<uint32_t> flexfec_ssrc_;
|
||||
|
|
|
@ -110,6 +110,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",
|
||||
|
@ -353,6 +354,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",
|
||||
|
@ -701,6 +703,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",
|
||||
|
|
|
@ -37,6 +37,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"
|
||||
|
@ -249,7 +250,7 @@ class VideoProcessor {
|
|||
int64_t post_encode_time_ns_ 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);
|
||||
};
|
||||
|
|
|
@ -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"
|
||||
|
@ -159,8 +160,8 @@ class FrameBuffer {
|
|||
EncodedFrame* CombineAndDeleteFrames(
|
||||
const std::vector<EncodedFrame*>& 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_);
|
||||
|
|
|
@ -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<int64_t> decodable_frame_ids_ RTC_GUARDED_BY(sequence_checker_);
|
||||
|
||||
SequenceChecker sequence_checker_;
|
||||
RTC_NO_UNIQUE_ADDRESS SequenceChecker sequence_checker_;
|
||||
};
|
||||
|
||||
} // namespace webrtc
|
||||
|
|
|
@ -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<CheckQpTask> 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_;
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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_);
|
||||
|
|
|
@ -273,6 +273,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",
|
||||
|
|
|
@ -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<RecordableEncodedFrame>* 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.
|
||||
|
|
|
@ -75,6 +75,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",
|
||||
|
@ -479,6 +480,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" ]
|
||||
}
|
||||
|
@ -582,6 +584,7 @@ rtc_library("weak_ptr") {
|
|||
":refcount",
|
||||
"../api:scoped_refptr",
|
||||
"synchronization:sequence_checker",
|
||||
"system:no_unique_address",
|
||||
]
|
||||
}
|
||||
|
||||
|
@ -830,6 +833,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:to_queued_task",
|
||||
|
|
|
@ -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<Buffer*> queue_ RTC_GUARDED_BY(sequence_checker_);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 {
|
||||
|
||||
|
@ -179,7 +180,7 @@ class OperationsChain final : public RefCountedObject<RefCountInterface> {
|
|||
std::function<void()> 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.
|
||||
|
|
|
@ -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 = [
|
||||
|
|
35
rtc_base/system/no_unique_address.h
Normal file
35
rtc_base/system/no_unique_address.h
Normal file
|
@ -0,0 +1,35 @@
|
|||
/*
|
||||
* 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.
|
||||
#if (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_
|
|
@ -38,6 +38,7 @@ rtc_library("pending_task_safety_flag") {
|
|||
"..:thread_checker",
|
||||
"../../api:scoped_refptr",
|
||||
"../synchronization:sequence_checker",
|
||||
"../system:no_unique_address",
|
||||
]
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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_;
|
||||
};
|
||||
|
||||
|
|
|
@ -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" ]
|
||||
|
|
|
@ -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_);
|
||||
|
|
|
@ -130,6 +130,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",
|
||||
|
@ -255,6 +256,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",
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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<uint32_t> encoder_target_bitrate_bps_
|
||||
RTC_GUARDED_BY(&sequence_checker_);
|
||||
const BalancedDegradationSettings balanced_settings_;
|
||||
|
|
|
@ -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<EncoderSettings> encoder_settings_
|
||||
RTC_GUARDED_BY(&sequence_checker_);
|
||||
absl::optional<uint32_t> encoder_target_bitrate_bps_
|
||||
|
|
|
@ -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<ProcessingUsage> 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_);
|
||||
|
||||
|
|
|
@ -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<CallStatsObserver*> 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.
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#include <memory>
|
||||
|
||||
#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_;
|
||||
|
||||
|
|
|
@ -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<UlpfecReceiver> 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_);
|
||||
|
||||
|
|
|
@ -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<UlpfecReceiver> 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_);
|
||||
|
||||
|
|
|
@ -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<FrameTransformerInterface> frame_transformer_
|
||||
RTC_GUARDED_BY(network_sequence_checker_);
|
||||
|
|
|
@ -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_;
|
||||
|
||||
|
|
|
@ -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_;
|
||||
|
||||
|
|
|
@ -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<VideoFrame>* const sink_;
|
||||
rtc::VideoSourceInterface<VideoFrame>* source_
|
||||
|
|
|
@ -41,6 +41,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"
|
||||
|
@ -274,7 +275,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_);
|
||||
|
|
Loading…
Reference in a new issue