diff --git a/pc/peer_connection.cc b/pc/peer_connection.cc index 2e206bfa11..a571a53645 100644 --- a/pc/peer_connection.cc +++ b/pc/peer_connection.cc @@ -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 diff --git a/pc/peer_connection.h b/pc/peer_connection.h index 58424dbac0..aa46feb4aa 100644 --- a/pc/peer_connection.h +++ b/pc/peer_connection.h @@ -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 stats_collector_ RTC_GUARDED_BY(signaling_thread()); - std::string session_id_ RTC_GUARDED_BY(signaling_thread()); + const std::string session_id_; std::unique_ptr transport_controller_; // TODO(bugs.webrtc.org/9987): Accessed on both