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}
This commit is contained in:
Tommi 2021-10-15 16:29:25 +02:00 committed by WebRTC LUCI CQ
parent 15a2159a35
commit ad22572986
4 changed files with 11 additions and 17 deletions

View File

@ -80,11 +80,9 @@ std::string UmaSuffixForContentType(VideoContentType content_type) {
} // namespace } // namespace
ReceiveStatisticsProxy::ReceiveStatisticsProxy( ReceiveStatisticsProxy::ReceiveStatisticsProxy(uint32_t remote_ssrc,
const VideoReceiveStream::Config* config, Clock* clock)
Clock* clock)
: clock_(clock), : clock_(clock),
config_(*config),
start_ms_(clock->TimeInMilliseconds()), start_ms_(clock->TimeInMilliseconds()),
enable_decode_time_histograms_( enable_decode_time_histograms_(
!field_trial::IsEnabled("WebRTC-DecodeTimeHistogramsKillSwitch")), !field_trial::IsEnabled("WebRTC-DecodeTimeHistogramsKillSwitch")),
@ -120,7 +118,7 @@ ReceiveStatisticsProxy::ReceiveStatisticsProxy(
timing_frame_info_counter_(kMovingMaxWindowMs) { timing_frame_info_counter_(kMovingMaxWindowMs) {
decode_thread_.Detach(); decode_thread_.Detach();
network_thread_.Detach(); network_thread_.Detach();
stats_.ssrc = config_.rtp.remote_ssrc; stats_.ssrc = remote_ssrc;
} }
void ReceiveStatisticsProxy::UpdateHistograms( void ReceiveStatisticsProxy::UpdateHistograms(

View File

@ -42,8 +42,11 @@ class ReceiveStatisticsProxy : public VCMReceiveStatisticsCallback,
public RtcpPacketTypeCounterObserver, public RtcpPacketTypeCounterObserver,
public CallStatsObserver { public CallStatsObserver {
public: public:
ReceiveStatisticsProxy(const VideoReceiveStream::Config* config, // TODO(tommi): Remove when downstream callers have been fixed.
Clock* clock); // DEPRECATED ctor.
ReceiveStatisticsProxy(const VideoReceiveStream::Config* config, Clock* clock)
: ReceiveStatisticsProxy(config->rtp.remote_ssrc, clock) {}
ReceiveStatisticsProxy(uint32_t remote_ssrc, Clock* clock);
~ReceiveStatisticsProxy() = default; ~ReceiveStatisticsProxy() = default;
VideoReceiveStream::Stats GetStats() const; VideoReceiveStream::Stats GetStats() const;
@ -139,14 +142,6 @@ class ReceiveStatisticsProxy : public VCMReceiveStatisticsCallback,
int64_t now_ms) const RTC_EXCLUSIVE_LOCKS_REQUIRED(mutex_); int64_t now_ms) const RTC_EXCLUSIVE_LOCKS_REQUIRED(mutex_);
Clock* const clock_; 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 int64_t start_ms_;
const bool enable_decode_time_histograms_; const bool enable_decode_time_histograms_;

View File

@ -45,7 +45,8 @@ class ReceiveStatisticsProxyTest : public ::testing::Test {
protected: protected:
virtual void SetUp() { virtual void SetUp() {
metrics::Reset(); metrics::Reset();
statistics_proxy_.reset(new ReceiveStatisticsProxy(&config_, &fake_clock_)); statistics_proxy_.reset(
new ReceiveStatisticsProxy(config_.rtp.remote_ssrc, &fake_clock_));
} }
VideoReceiveStream::Config GetTestConfig() { VideoReceiveStream::Config GetTestConfig() {

View File

@ -171,7 +171,7 @@ VideoReceiveStream::VideoReceiveStream(
clock_(clock), clock_(clock),
call_stats_(call_stats), call_stats_(call_stats),
source_tracker_(clock_), source_tracker_(clock_),
stats_proxy_(&config_, clock_), stats_proxy_(config_.rtp.remote_ssrc, clock_),
rtp_receive_statistics_(ReceiveStatistics::Create(clock_)), rtp_receive_statistics_(ReceiveStatistics::Create(clock_)),
timing_(timing), timing_(timing),
video_receiver_(clock_, timing_.get()), video_receiver_(clock_, timing_.get()),