From 9b0b1e006354abdaf5a0674f06a98ebf2c3042f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20M=C3=B6ller?= Date: Fri, 22 Mar 2019 13:56:46 +0100 Subject: [PATCH] Delete unused method VCMReceiveStatisticsCallback::OnReceiveRatesUpdated MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Only interesting call deleted in cl https://codereview.webrtc.org/2704183002. Move call to QualitySample (used for bad call detection) to OnRenderedFrame Bug: webrtc:7408 Change-Id: I0e9ae2ed62fe19a282377cb840e38bd2aae8f3e6 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/128768 Reviewed-by: Erik Språng Reviewed-by: Philip Eliasson Commit-Queue: Niels Moller Cr-Commit-Position: refs/heads/master@{#27243} --- modules/video_coding/frame_buffer2_unittest.cc | 2 -- modules/video_coding/include/video_coding_defines.h | 1 - modules/video_coding/video_receiver.cc | 3 --- video/receive_statistics_proxy.cc | 13 +------------ video/receive_statistics_proxy.h | 2 -- video/receive_statistics_proxy_unittest.cc | 10 ++++++---- video/video_stream_decoder.cc | 5 ----- video/video_stream_decoder.h | 1 - 8 files changed, 7 insertions(+), 30 deletions(-) diff --git a/modules/video_coding/frame_buffer2_unittest.cc b/modules/video_coding/frame_buffer2_unittest.cc index 7dc8cb29ed..53482699d3 100644 --- a/modules/video_coding/frame_buffer2_unittest.cc +++ b/modules/video_coding/frame_buffer2_unittest.cc @@ -95,8 +95,6 @@ class FrameObjectFake : public EncodedFrame { class VCMReceiveStatisticsCallbackMock : public VCMReceiveStatisticsCallback { public: - MOCK_METHOD2(OnReceiveRatesUpdated, - void(uint32_t bitRate, uint32_t frameRate)); MOCK_METHOD3(OnCompleteFrame, void(bool is_keyframe, size_t size_bytes, diff --git a/modules/video_coding/include/video_coding_defines.h b/modules/video_coding/include/video_coding_defines.h index dc9060c5c1..81ec68d2b6 100644 --- a/modules/video_coding/include/video_coding_defines.h +++ b/modules/video_coding/include/video_coding_defines.h @@ -81,7 +81,6 @@ class VCMReceiveCallback { // rate. class VCMReceiveStatisticsCallback { public: - virtual void OnReceiveRatesUpdated(uint32_t bitRate, uint32_t frameRate) = 0; virtual void OnCompleteFrame(bool is_keyframe, size_t size_bytes, VideoContentType content_type) = 0; diff --git a/modules/video_coding/video_receiver.cc b/modules/video_coding/video_receiver.cc index db9ceb8784..1f3fac3e70 100644 --- a/modules/video_coding/video_receiver.cc +++ b/modules/video_coding/video_receiver.cc @@ -79,9 +79,6 @@ void VideoReceiver::Process() { // ReceiveStatisticsProxy::QualitySample. if (_receiveStatsTimer.TimeUntilProcess() == 0) { _receiveStatsTimer.Processed(); - if (_receiveStatsCallback != nullptr) { - _receiveStatsCallback->OnReceiveRatesUpdated(0, 0); - } } // Key frame requests diff --git a/video/receive_statistics_proxy.cc b/video/receive_statistics_proxy.cc index b3f0710695..4927b99766 100644 --- a/video/receive_statistics_proxy.cc +++ b/video/receive_statistics_proxy.cc @@ -488,8 +488,6 @@ void ReceiveStatisticsProxy::UpdateHistograms() { } void ReceiveStatisticsProxy::QualitySample() { - RTC_DCHECK_RUN_ON(&network_thread_); - int64_t now = clock_->TimeInMilliseconds(); if (last_sample_time_ + kMinSampleLengthMs > now) return; @@ -607,13 +605,6 @@ void ReceiveStatisticsProxy::OnDecoderImplementationName( rtc::CritScope lock(&crit_); stats_.decoder_implementation_name = implementation_name; } -void ReceiveStatisticsProxy::OnIncomingRate(unsigned int framerate, - unsigned int bitrate_bps) { - RTC_DCHECK_RUN_ON(&network_thread_); - rtc::CritScope lock(&crit_); - if (stats_.rtp_stats.first_packet_time_ms != -1) - QualitySample(); -} void ReceiveStatisticsProxy::OnFrameBufferTimingsUpdated( int decode_ms, @@ -808,6 +799,7 @@ void ReceiveStatisticsProxy::OnRenderedFrame(const VideoFrame& frame) { content_specific_stats->e2e_delay_counter.Add(delay_ms); } } + QualitySample(); } void ReceiveStatisticsProxy::OnSyncOffsetUpdated(int64_t sync_offset_ms, @@ -825,9 +817,6 @@ void ReceiveStatisticsProxy::OnSyncOffsetUpdated(int64_t sync_offset_ms, freq_offset_counter_.Add(offset_khz); } -void ReceiveStatisticsProxy::OnReceiveRatesUpdated(uint32_t bitRate, - uint32_t frameRate) {} - void ReceiveStatisticsProxy::OnCompleteFrame(bool is_keyframe, size_t size_bytes, VideoContentType content_type) { diff --git a/video/receive_statistics_proxy.h b/video/receive_statistics_proxy.h index 723dc27101..8d54f49453 100644 --- a/video/receive_statistics_proxy.h +++ b/video/receive_statistics_proxy.h @@ -56,7 +56,6 @@ class ReceiveStatisticsProxy : public VCMReceiveStatisticsCallback, void OnRenderedFrame(const VideoFrame& frame); void OnIncomingPayloadType(int payload_type); void OnDecoderImplementationName(const char* implementation_name); - void OnIncomingRate(unsigned int framerate, unsigned int bitrate_bps); void OnPreDecode(VideoCodecType codec_type, int qp); @@ -66,7 +65,6 @@ class ReceiveStatisticsProxy : public VCMReceiveStatisticsCallback, void OnStreamInactive(); // Overrides VCMReceiveStatisticsCallback. - void OnReceiveRatesUpdated(uint32_t bitRate, uint32_t frameRate) override; void OnFrameCountsUpdated(const FrameCounts& frame_counts) override; void OnDiscardedPacketsUpdated(int discarded_packets) override; void OnCompleteFrame(bool is_keyframe, diff --git a/video/receive_statistics_proxy_unittest.cc b/video/receive_statistics_proxy_unittest.cc index 41a279d91e..9af5db43f0 100644 --- a/video/receive_statistics_proxy_unittest.cc +++ b/video/receive_statistics_proxy_unittest.cc @@ -565,16 +565,18 @@ TEST_F(ReceiveStatisticsProxyTest, BadCallHistogramsAreUpdated) { // then 10 certainly bad states. There has to be 10 certain states before // any histograms are recorded. const int kNumBadSamples = 17; + // We only count one sample per second. + const int kBadFameIntervalMs = 1100; StreamDataCounters counters; counters.first_packet_time_ms = fake_clock_.TimeInMilliseconds(); statistics_proxy_->DataCountersUpdated(counters, config_.rtp.remote_ssrc); + webrtc::VideoFrame frame = CreateFrame(kWidth, kHeight); + for (int i = 0; i < kNumBadSamples; ++i) { - // Since OnRenderedFrame is never called the fps in each sample will be 0, - // i.e. bad - fake_clock_.AdvanceTimeMilliseconds(1000); - statistics_proxy_->OnIncomingRate(0, 0); + fake_clock_.AdvanceTimeMilliseconds(kBadFameIntervalMs); + statistics_proxy_->OnRenderedFrame(frame); } // Histograms are updated when the statistics_proxy_ is deleted. statistics_proxy_.reset(); diff --git a/video/video_stream_decoder.cc b/video/video_stream_decoder.cc index fad7da8f22..69c10ed84c 100644 --- a/video/video_stream_decoder.cc +++ b/video/video_stream_decoder.cc @@ -86,11 +86,6 @@ void VideoStreamDecoder::OnDecoderImplementationName( receive_stats_callback_->OnDecoderImplementationName(implementation_name); } -void VideoStreamDecoder::OnReceiveRatesUpdated(uint32_t bit_rate, - uint32_t frame_rate) { - receive_stats_callback_->OnIncomingRate(frame_rate, bit_rate); -} - void VideoStreamDecoder::OnDiscardedPacketsUpdated(int discarded_packets) { receive_stats_callback_->OnDiscardedPacketsUpdated(discarded_packets); } diff --git a/video/video_stream_decoder.h b/video/video_stream_decoder.h index b0294070d2..efaa8cc95c 100644 --- a/video/video_stream_decoder.h +++ b/video/video_stream_decoder.h @@ -53,7 +53,6 @@ class VideoStreamDecoder : public VCMReceiveCallback, void OnDecoderImplementationName(const char* implementation_name) override; // Implements VCMReceiveStatisticsCallback. - void OnReceiveRatesUpdated(uint32_t bit_rate, uint32_t frame_rate) override; void OnDiscardedPacketsUpdated(int discarded_packets) override; void OnFrameCountsUpdated(const FrameCounts& frame_counts) override; void OnCompleteFrame(bool is_keyframe,