Make PeerConnection::session_id_ const and readable from any thread.
Going forward, we'll need to read this value from other threads than signaling, so I've moved the initialization into the constructor. Bug: none Change-Id: I56b00d38c86788cbab9a2055719074ea48f4750f Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/213185 Reviewed-by: Niels Moller <nisse@webrtc.org> Commit-Queue: Tommi <tommi@webrtc.org> Cr-Commit-Position: refs/heads/master@{#33613}
This commit is contained in:
committed by
Commit Bot
parent
b620e2d3ec
commit
97a387d7f3
@ -468,6 +468,11 @@ PeerConnection::PeerConnection(
|
||||
tls_cert_verifier_(std::move(dependencies.tls_cert_verifier)),
|
||||
call_(std::move(call)),
|
||||
call_ptr_(call_.get()),
|
||||
// RFC 3264: The numeric value of the session id and version in the
|
||||
// o line MUST be representable with a "64 bit signed integer".
|
||||
// Due to this constraint session id |session_id_| is max limited to
|
||||
// LLONG_MAX.
|
||||
session_id_(rtc::ToString(rtc::CreateRandomId64() & LLONG_MAX)),
|
||||
dtls_enabled_(dtls_enabled),
|
||||
data_channel_controller_(this),
|
||||
message_handler_(signaling_thread()),
|
||||
@ -560,12 +565,6 @@ RTCError PeerConnection::Initialize(
|
||||
NoteUsageEvent(UsageEvent::TURN_SERVER_ADDED);
|
||||
}
|
||||
|
||||
// RFC 3264: The numeric value of the session id and version in the
|
||||
// o line MUST be representable with a "64 bit signed integer".
|
||||
// Due to this constraint session id |session_id_| is max limited to
|
||||
// LLONG_MAX.
|
||||
session_id_ = rtc::ToString(rtc::CreateRandomId64() & LLONG_MAX);
|
||||
|
||||
if (configuration.enable_rtp_data_channel) {
|
||||
// Enable creation of RTP data channels if the kEnableRtpDataChannels is
|
||||
// set. It takes precendence over the disable_sctp_data_channels
|
||||
|
||||
@ -271,7 +271,6 @@ class PeerConnection : public PeerConnectionInternal,
|
||||
rtc::Thread* worker_thread() const final { return context_->worker_thread(); }
|
||||
|
||||
std::string session_id() const override {
|
||||
RTC_DCHECK_RUN_ON(signaling_thread());
|
||||
return session_id_;
|
||||
}
|
||||
|
||||
@ -670,7 +669,7 @@ class PeerConnection : public PeerConnectionInternal,
|
||||
rtc::scoped_refptr<RTCStatsCollector> stats_collector_
|
||||
RTC_GUARDED_BY(signaling_thread());
|
||||
|
||||
std::string session_id_ RTC_GUARDED_BY(signaling_thread());
|
||||
const std::string session_id_;
|
||||
|
||||
std::unique_ptr<JsepTransportController>
|
||||
transport_controller_; // TODO(bugs.webrtc.org/9987): Accessed on both
|
||||
|
||||
Reference in New Issue
Block a user