diff --git a/call/call.cc b/call/call.cc index 00f58d30a0..39fb3cfac9 100644 --- a/call/call.cc +++ b/call/call.cc @@ -1120,6 +1120,9 @@ webrtc::VideoReceiveStream* Call::CreateVideoReceiveStream( EnsureStarted(); + event_log_->Log(std::make_unique( + CreateRtcLogStreamConfig(configuration))); + // TODO(bugs.webrtc.org/11993): Move the registration between `receive_stream` // and `video_receiver_controller_` out of VideoReceiveStream2 construction // and set it up asynchronously on the network thread (the registration and @@ -1133,22 +1136,21 @@ webrtc::VideoReceiveStream* Call::CreateVideoReceiveStream( // thread. receive_stream->RegisterWithTransport(&video_receiver_controller_); - const webrtc::VideoReceiveStream::Config& config = receive_stream->config(); - if (config.rtp.rtx_ssrc) { + const webrtc::VideoReceiveStream::Config::Rtp& rtp = receive_stream->rtp(); + if (rtp.rtx_ssrc) { // We record identical config for the rtx stream as for the main // stream. Since the transport_send_cc negotiation is per payload // type, we may get an incorrect value for the rtx stream, but // that is unlikely to matter in practice. - receive_rtp_config_.emplace(config.rtp.rtx_ssrc, receive_stream); + receive_rtp_config_.emplace(rtp.rtx_ssrc, receive_stream); } - receive_rtp_config_.emplace(config.rtp.remote_ssrc, receive_stream); + receive_rtp_config_.emplace(rtp.remote_ssrc, receive_stream); video_receive_streams_.insert(receive_stream); - ConfigureSync(config.sync_group); + + ConfigureSync(receive_stream->sync_group()); receive_stream->SignalNetworkState(video_network_state_); UpdateAggregateNetworkState(); - event_log_->Log(std::make_unique( - CreateRtcLogStreamConfig(config))); return receive_stream; } @@ -1162,19 +1164,20 @@ void Call::DestroyVideoReceiveStream( // TODO(bugs.webrtc.org/11993): Unregister on the network thread. receive_stream_impl->UnregisterFromTransport(); - const VideoReceiveStream::Config& config = receive_stream_impl->config(); + const webrtc::VideoReceiveStream::Config::Rtp& rtp = + receive_stream_impl->rtp(); // Remove all ssrcs pointing to a receive stream. As RTX retransmits on a // separate SSRC there can be either one or two. - receive_rtp_config_.erase(config.rtp.remote_ssrc); - if (config.rtp.rtx_ssrc) { - receive_rtp_config_.erase(config.rtp.rtx_ssrc); + receive_rtp_config_.erase(rtp.remote_ssrc); + if (rtp.rtx_ssrc) { + receive_rtp_config_.erase(rtp.rtx_ssrc); } video_receive_streams_.erase(receive_stream_impl); - ConfigureSync(config.sync_group); + ConfigureSync(receive_stream_impl->sync_group()); - receive_side_cc_.GetRemoteBitrateEstimator(UseSendSideBwe(config.rtp)) - ->RemoveStream(config.rtp.remote_ssrc); + receive_side_cc_.GetRemoteBitrateEstimator(UseSendSideBwe(rtp)) + ->RemoveStream(rtp.remote_ssrc); UpdateAggregateNetworkState(); delete receive_stream_impl; @@ -1458,7 +1461,7 @@ void Call::ConfigureSync(const std::string& sync_group) { sync_stream_mapping_[sync_group] = sync_audio_stream; size_t num_synced_streams = 0; for (VideoReceiveStream2* video_stream : video_receive_streams_) { - if (video_stream->config().sync_group != sync_group) + if (video_stream->sync_group() != sync_group) continue; ++num_synced_streams; if (num_synced_streams > 1) { diff --git a/video/video_receive_stream2.cc b/video/video_receive_stream2.cc index c605ecaca9..3127069a1c 100644 --- a/video/video_receive_stream2.cc +++ b/video/video_receive_stream2.cc @@ -303,6 +303,16 @@ void VideoReceiveStream2::UnregisterFromTransport() { rtx_receiver_.reset(); } +const VideoReceiveStream2::Config::Rtp& VideoReceiveStream2::rtp() const { + RTC_DCHECK_RUN_ON(&packet_sequence_checker_); + return config_.rtp; +} + +const std::string& VideoReceiveStream2::sync_group() const { + RTC_DCHECK_RUN_ON(&packet_sequence_checker_); + return config_.sync_group; +} + void VideoReceiveStream2::SignalNetworkState(NetworkState state) { RTC_DCHECK_RUN_ON(&worker_sequence_checker_); rtp_video_stream_receiver_.SignalNetworkState(state); diff --git a/video/video_receive_stream2.h b/video/video_receive_stream2.h index 8a1418a487..ace5de2dd4 100644 --- a/video/video_receive_stream2.h +++ b/video/video_receive_stream2.h @@ -12,6 +12,7 @@ #define VIDEO_VIDEO_RECEIVE_STREAM2_H_ #include +#include #include #include "api/sequence_checker.h" @@ -116,7 +117,13 @@ class VideoReceiveStream2 // network thread. void UnregisterFromTransport(); - const Config& config() const { return config_; } + // Convenience getters for parts of the receive stream's config. + // The accessors must be called on the packet delivery thread in accordance + // to documentation for RtpConfig (see receive_stream.h), the returned + // values should not be cached and should just be used within the calling + // context as some values might change. + const Config::Rtp& rtp() const; + const std::string& sync_group() const; void SignalNetworkState(NetworkState state); bool DeliverRtcp(const uint8_t* packet, size_t length);