From fb1fa44d704e9f1dbec7408773c1b0d1a2398e02 Mon Sep 17 00:00:00 2001 From: "elad.alon" Date: Mon, 6 Mar 2017 03:48:14 -0800 Subject: [PATCH] Remove MockRemoteBitrateObserver (unused) BUG=None Review-Url: https://codereview.webrtc.org/2731523002 Cr-Commit-Position: refs/heads/master@{#17060} --- webrtc/audio/audio_send_stream_unittest.cc | 4 +- .../modules/remote_bitrate_estimator/BUILD.gn | 1 - .../mock/mock_remote_bitrate_estimator.h | 44 ------------------- .../remote_bitrate_estimator_single_stream.cc | 4 +- .../remote_bitrate_estimator_single_stream.h | 4 +- 5 files changed, 5 insertions(+), 52 deletions(-) delete mode 100644 webrtc/modules/remote_bitrate_estimator/include/mock/mock_remote_bitrate_estimator.h diff --git a/webrtc/audio/audio_send_stream_unittest.cc b/webrtc/audio/audio_send_stream_unittest.cc index b1a2401c6b..1a838d891b 100644 --- a/webrtc/audio/audio_send_stream_unittest.cc +++ b/webrtc/audio/audio_send_stream_unittest.cc @@ -21,7 +21,6 @@ #include "webrtc/modules/congestion_controller/include/congestion_controller.h" #include "webrtc/modules/congestion_controller/include/mock/mock_congestion_controller.h" #include "webrtc/modules/pacing/paced_sender.h" -#include "webrtc/modules/remote_bitrate_estimator/include/mock/mock_remote_bitrate_estimator.h" #include "webrtc/modules/rtp_rtcp/mocks/mock_rtcp_rtt_stats.h" #include "webrtc/test/gtest.h" #include "webrtc/test/mock_voe_channel_proxy.h" @@ -75,7 +74,7 @@ struct ConfigHelper { stream_config_(nullptr), congestion_controller_(&simulated_clock_, &bitrate_observer_, - &remote_bitrate_observer_, + nullptr, &event_log_, &packet_router_), bitrate_allocator_(&limit_observer_), @@ -248,7 +247,6 @@ struct ConfigHelper { AudioSendStream::Config stream_config_; testing::StrictMock* channel_proxy_ = nullptr; testing::NiceMock bitrate_observer_; - testing::NiceMock remote_bitrate_observer_; MockAudioProcessing audio_processing_; MockTransmitMixer transmit_mixer_; AudioProcessing::AudioProcessingStatistics audio_processing_stats_; diff --git a/webrtc/modules/remote_bitrate_estimator/BUILD.gn b/webrtc/modules/remote_bitrate_estimator/BUILD.gn index adfa60ca56..f4c338a70d 100644 --- a/webrtc/modules/remote_bitrate_estimator/BUILD.gn +++ b/webrtc/modules/remote_bitrate_estimator/BUILD.gn @@ -146,7 +146,6 @@ if (rtc_include_tests) { testonly = true sources = [ "aimd_rate_control_unittest.cc", - "include/mock/mock_remote_bitrate_estimator.h", "include/mock/mock_remote_bitrate_observer.h", "inter_arrival_unittest.cc", "overuse_detector_unittest.cc", diff --git a/webrtc/modules/remote_bitrate_estimator/include/mock/mock_remote_bitrate_estimator.h b/webrtc/modules/remote_bitrate_estimator/include/mock/mock_remote_bitrate_estimator.h deleted file mode 100644 index 8ef645b131..0000000000 --- a/webrtc/modules/remote_bitrate_estimator/include/mock/mock_remote_bitrate_estimator.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_INCLUDE_MOCK_MOCK_REMOTE_BITRATE_ESTIMATOR_H_ -#define WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_INCLUDE_MOCK_MOCK_REMOTE_BITRATE_ESTIMATOR_H_ - -#include - -#include "webrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimator.h" -#include "webrtc/test/gmock.h" - -namespace webrtc { - -class MockRemoteBitrateObserver : public RemoteBitrateObserver { - public: - MOCK_METHOD2(OnReceiveBitrateChanged, - void(const std::vector& ssrcs, uint32_t bitrate)); -}; - -class MockRemoteBitrateEstimator : public RemoteBitrateEstimator { - public: - MOCK_METHOD3(IncomingPacket, void(int64_t, size_t, const RTPHeader&)); - MOCK_METHOD1(RemoveStream, void(uint32_t)); - MOCK_CONST_METHOD2(LatestEstimate, bool(std::vector*, uint32_t*)); - - // From CallStatsObserver; - MOCK_METHOD2(OnRttUpdate, void(int64_t, int64_t)); - - // From Module. - MOCK_METHOD0(TimeUntilNextProcess, int64_t()); - MOCK_METHOD0(Process, void()); - MOCK_METHOD1(SetMinBitrate, void(int)); -}; - -} // namespace webrtc - -#endif // WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_INCLUDE_MOCK_MOCK_REMOTE_BITRATE_ESTIMATOR_H_ diff --git a/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_single_stream.cc b/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_single_stream.cc index 094bf0d65b..7b4cc2b7fd 100644 --- a/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_single_stream.cc +++ b/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_single_stream.cc @@ -57,7 +57,6 @@ RemoteBitrateEstimatorSingleStream::RemoteBitrateEstimatorSingleStream( last_process_time_(-1), process_interval_ms_(kProcessIntervalMs), uma_recorded_(false) { - assert(observer_); LOG(LS_INFO) << "RemoteBitrateEstimatorSingleStream: Instantiating."; } @@ -201,7 +200,8 @@ void RemoteBitrateEstimatorSingleStream::UpdateEstimate(int64_t now_ms) { RTC_DCHECK_GT(process_interval_ms_, 0); std::vector ssrcs; GetSsrcs(&ssrcs); - observer_->OnReceiveBitrateChanged(ssrcs, target_bitrate); + if (observer_) + observer_->OnReceiveBitrateChanged(ssrcs, target_bitrate); } } diff --git a/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_single_stream.h b/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_single_stream.h index 31d796225a..b893f56ed1 100644 --- a/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_single_stream.h +++ b/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_single_stream.h @@ -56,12 +56,12 @@ class RemoteBitrateEstimatorSingleStream : public RemoteBitrateEstimator { // otherwise creates it. AimdRateControl* GetRemoteRate() EXCLUSIVE_LOCKS_REQUIRED(crit_sect_.get()); - Clock* clock_; + Clock* const clock_; SsrcOveruseEstimatorMap overuse_detectors_ GUARDED_BY(crit_sect_.get()); RateStatistics incoming_bitrate_ GUARDED_BY(crit_sect_.get()); uint32_t last_valid_incoming_bitrate_ GUARDED_BY(crit_sect_.get()); std::unique_ptr remote_rate_ GUARDED_BY(crit_sect_.get()); - RemoteBitrateObserver* observer_ GUARDED_BY(crit_sect_.get()); + RemoteBitrateObserver* const observer_ GUARDED_BY(crit_sect_.get()); std::unique_ptr crit_sect_; int64_t last_process_time_; int64_t process_interval_ms_ GUARDED_BY(crit_sect_.get());