Add thread safety annotation for PeerConnection::event_log_
Plus all the annotations that are necessary to make things compile again. Bug: webrtc:9987 Change-Id: I68a51bfa3342c6d66d67276d5979144af34692c9 Reviewed-on: https://webrtc-review.googlesource.com/c/123046 Reviewed-by: Steve Anton <steveanton@webrtc.org> Commit-Queue: Karl Wiberg <kwiberg@webrtc.org> Cr-Commit-Position: refs/heads/master@{#26716}
This commit is contained in:
parent
744310fcea
commit
b03ab7107c
@ -833,6 +833,7 @@ PeerConnection::PeerConnection(PeerConnectionFactory* factory,
|
||||
std::unique_ptr<Call> call)
|
||||
: factory_(factory),
|
||||
event_log_(std::move(event_log)),
|
||||
event_log_ptr_(event_log_.get()),
|
||||
rtcp_cname_(GenerateRtcpCname()),
|
||||
local_streams_(StreamCollection::Create()),
|
||||
remote_streams_(StreamCollection::Create()),
|
||||
@ -872,6 +873,7 @@ PeerConnection::~PeerConnection() {
|
||||
[this] { port_allocator_.reset(); });
|
||||
// call_ and event_log_ must be destroyed on the worker thread.
|
||||
worker_thread()->Invoke<void>(RTC_FROM_HERE, [this] {
|
||||
RTC_DCHECK_RUN_ON(worker_thread());
|
||||
call_.reset();
|
||||
// The event log must outlive call (and any other object that uses it).
|
||||
event_log_.reset();
|
||||
@ -981,7 +983,7 @@ bool PeerConnection::Initialize(
|
||||
? *configuration.crypto_options
|
||||
: options.crypto_options;
|
||||
config.transport_observer = this;
|
||||
config.event_log = event_log_.get();
|
||||
config.event_log = event_log_ptr_;
|
||||
#if defined(ENABLE_EXTERNAL_AUTH)
|
||||
config.enable_external_auth = true;
|
||||
#endif
|
||||
@ -3696,6 +3698,7 @@ void PeerConnection::Close() {
|
||||
port_allocator_.get()));
|
||||
|
||||
worker_thread()->Invoke<void>(RTC_FROM_HERE, [this] {
|
||||
RTC_DCHECK_RUN_ON(worker_thread());
|
||||
call_.reset();
|
||||
// The event log must outlive call (and any other object that uses it).
|
||||
event_log_.reset();
|
||||
@ -5271,6 +5274,7 @@ cricket::ChannelManager* PeerConnection::channel_manager() const {
|
||||
bool PeerConnection::StartRtcEventLog_w(
|
||||
std::unique_ptr<RtcEventLogOutput> output,
|
||||
int64_t output_period_ms) {
|
||||
RTC_DCHECK_RUN_ON(worker_thread());
|
||||
if (!event_log_) {
|
||||
return false;
|
||||
}
|
||||
@ -5278,6 +5282,7 @@ bool PeerConnection::StartRtcEventLog_w(
|
||||
}
|
||||
|
||||
void PeerConnection::StopRtcEventLog_w() {
|
||||
RTC_DCHECK_RUN_ON(worker_thread());
|
||||
if (event_log_) {
|
||||
event_log_->StopLogging();
|
||||
}
|
||||
|
||||
@ -1033,7 +1033,11 @@ class PeerConnection : public PeerConnectionInternal,
|
||||
nullptr;
|
||||
|
||||
// The EventLog needs to outlive |call_| (and any other object that uses it).
|
||||
std::unique_ptr<RtcEventLog> event_log_;
|
||||
std::unique_ptr<RtcEventLog> event_log_ RTC_GUARDED_BY(worker_thread());
|
||||
|
||||
// Points to the same thing as `event_log_`. Since it's const, we may read the
|
||||
// pointer (but not touch the object) from any thread.
|
||||
RtcEventLog* const event_log_ptr_ RTC_PT_GUARDED_BY(worker_thread());
|
||||
|
||||
SignalingState signaling_state_ = kStable;
|
||||
IceConnectionState ice_connection_state_ = kIceConnectionNew;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user