Remove dependency on VideoReceiveStream::Config from ReceiveStatisticsProxy
Bug: none
Change-Id: Ib8238ed6b099c558733496b13bdf37e6b5a2021c
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/235362
Reviewed-by: Niels Moller <nisse@webrtc.org>
Commit-Queue: Tommi <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35218}
diff --git a/video/receive_statistics_proxy.cc b/video/receive_statistics_proxy.cc
index 422f148..1384ae7 100644
--- a/video/receive_statistics_proxy.cc
+++ b/video/receive_statistics_proxy.cc
@@ -80,11 +80,9 @@
} // namespace
-ReceiveStatisticsProxy::ReceiveStatisticsProxy(
- const VideoReceiveStream::Config* config,
- Clock* clock)
+ReceiveStatisticsProxy::ReceiveStatisticsProxy(uint32_t remote_ssrc,
+ Clock* clock)
: clock_(clock),
- config_(*config),
start_ms_(clock->TimeInMilliseconds()),
enable_decode_time_histograms_(
!field_trial::IsEnabled("WebRTC-DecodeTimeHistogramsKillSwitch")),
@@ -120,7 +118,7 @@
timing_frame_info_counter_(kMovingMaxWindowMs) {
decode_thread_.Detach();
network_thread_.Detach();
- stats_.ssrc = config_.rtp.remote_ssrc;
+ stats_.ssrc = remote_ssrc;
}
void ReceiveStatisticsProxy::UpdateHistograms(
diff --git a/video/receive_statistics_proxy.h b/video/receive_statistics_proxy.h
index 1e5189d..0115417 100644
--- a/video/receive_statistics_proxy.h
+++ b/video/receive_statistics_proxy.h
@@ -42,8 +42,11 @@
public RtcpPacketTypeCounterObserver,
public CallStatsObserver {
public:
- ReceiveStatisticsProxy(const VideoReceiveStream::Config* config,
- Clock* clock);
+ // TODO(tommi): Remove when downstream callers have been fixed.
+ // DEPRECATED ctor.
+ ReceiveStatisticsProxy(const VideoReceiveStream::Config* config, Clock* clock)
+ : ReceiveStatisticsProxy(config->rtp.remote_ssrc, clock) {}
+ ReceiveStatisticsProxy(uint32_t remote_ssrc, Clock* clock);
~ReceiveStatisticsProxy() = default;
VideoReceiveStream::Stats GetStats() const;
@@ -139,14 +142,6 @@
int64_t now_ms) const RTC_EXCLUSIVE_LOCKS_REQUIRED(mutex_);
Clock* const clock_;
- // Ownership of this object lies with the owner of the ReceiveStatisticsProxy
- // instance. Lifetime is guaranteed to outlive `this`.
- // TODO(tommi): In practice the config_ reference is only used for accessing
- // config_.rtp.ulpfec.ulpfec_payload_type. Instead of holding a pointer back,
- // we could just store the value of ulpfec_payload_type and change the
- // ReceiveStatisticsProxy() ctor to accept a const& of Config (since we'll
- // then no longer store a pointer to the object).
- const VideoReceiveStream::Config& config_;
const int64_t start_ms_;
const bool enable_decode_time_histograms_;
diff --git a/video/receive_statistics_proxy_unittest.cc b/video/receive_statistics_proxy_unittest.cc
index fab8fd3..97fcdd6 100644
--- a/video/receive_statistics_proxy_unittest.cc
+++ b/video/receive_statistics_proxy_unittest.cc
@@ -45,7 +45,8 @@
protected:
virtual void SetUp() {
metrics::Reset();
- statistics_proxy_.reset(new ReceiveStatisticsProxy(&config_, &fake_clock_));
+ statistics_proxy_.reset(
+ new ReceiveStatisticsProxy(config_.rtp.remote_ssrc, &fake_clock_));
}
VideoReceiveStream::Config GetTestConfig() {
diff --git a/video/video_receive_stream.cc b/video/video_receive_stream.cc
index 6823a1e..34a8b15 100644
--- a/video/video_receive_stream.cc
+++ b/video/video_receive_stream.cc
@@ -171,7 +171,7 @@
clock_(clock),
call_stats_(call_stats),
source_tracker_(clock_),
- stats_proxy_(&config_, clock_),
+ stats_proxy_(config_.rtp.remote_ssrc, clock_),
rtp_receive_statistics_(ReceiveStatistics::Create(clock_)),
timing_(timing),
video_receiver_(clock_, timing_.get()),