Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(70)

Side by Side Diff: webrtc/audio/audio_send_stream_unittest.cc

Issue 2752233002: Split CongestionController into send- and receive-side classes. (Closed)
Patch Set: Added method ReceiveSideCongestionController::OnBitrateChanged. Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 public: 67 public:
68 MOCK_CONST_METHOD0(AudioLevelFullRange, int16_t()); 68 MOCK_CONST_METHOD0(AudioLevelFullRange, int16_t());
69 }; 69 };
70 70
71 struct ConfigHelper { 71 struct ConfigHelper {
72 explicit ConfigHelper(bool audio_bwe_enabled) 72 explicit ConfigHelper(bool audio_bwe_enabled)
73 : simulated_clock_(123456), 73 : simulated_clock_(123456),
74 stream_config_(nullptr), 74 stream_config_(nullptr),
75 congestion_controller_(&simulated_clock_, 75 congestion_controller_(&simulated_clock_,
76 &bitrate_observer_, 76 &bitrate_observer_,
77 nullptr,
78 &event_log_, 77 &event_log_,
79 &packet_router_), 78 &packet_router_),
80 bitrate_allocator_(&limit_observer_), 79 bitrate_allocator_(&limit_observer_),
81 worker_queue_("ConfigHelper_worker_queue") { 80 worker_queue_("ConfigHelper_worker_queue") {
82 using testing::Invoke; 81 using testing::Invoke;
83 82
84 EXPECT_CALL(voice_engine_, 83 EXPECT_CALL(voice_engine_,
85 RegisterVoiceEngineObserver(_)).WillOnce(Return(0)); 84 RegisterVoiceEngineObserver(_)).WillOnce(Return(0));
86 EXPECT_CALL(voice_engine_, 85 EXPECT_CALL(voice_engine_,
87 DeRegisterVoiceEngineObserver()).WillOnce(Return(0)); 86 DeRegisterVoiceEngineObserver()).WillOnce(Return(0));
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 // calls from the default ctor behavior. 118 // calls from the default ctor behavior.
120 stream_config_.send_codec_spec.codec_inst = kIsacCodec; 119 stream_config_.send_codec_spec.codec_inst = kIsacCodec;
121 stream_config_.min_bitrate_bps = 10000; 120 stream_config_.min_bitrate_bps = 10000;
122 stream_config_.max_bitrate_bps = 65000; 121 stream_config_.max_bitrate_bps = 65000;
123 } 122 }
124 123
125 AudioSendStream::Config& config() { return stream_config_; } 124 AudioSendStream::Config& config() { return stream_config_; }
126 rtc::scoped_refptr<AudioState> audio_state() { return audio_state_; } 125 rtc::scoped_refptr<AudioState> audio_state() { return audio_state_; }
127 MockVoEChannelProxy* channel_proxy() { return channel_proxy_; } 126 MockVoEChannelProxy* channel_proxy() { return channel_proxy_; }
128 PacketRouter* packet_router() { return &packet_router_; } 127 PacketRouter* packet_router() { return &packet_router_; }
129 CongestionController* congestion_controller() { 128 SendSideCongestionController* congestion_controller() {
130 return &congestion_controller_; 129 return &congestion_controller_;
131 } 130 }
132 BitrateAllocator* bitrate_allocator() { return &bitrate_allocator_; } 131 BitrateAllocator* bitrate_allocator() { return &bitrate_allocator_; }
133 rtc::TaskQueue* worker_queue() { return &worker_queue_; } 132 rtc::TaskQueue* worker_queue() { return &worker_queue_; }
134 RtcEventLog* event_log() { return &event_log_; } 133 RtcEventLog* event_log() { return &event_log_; }
135 MockVoiceEngine* voice_engine() { return &voice_engine_; } 134 MockVoiceEngine* voice_engine() { return &voice_engine_; }
136 135
137 void SetupDefaultChannelProxy(bool audio_bwe_enabled) { 136 void SetupDefaultChannelProxy(bool audio_bwe_enabled) {
138 using testing::StrEq; 137 using testing::StrEq;
139 channel_proxy_ = new testing::StrictMock<MockVoEChannelProxy>(); 138 channel_proxy_ = new testing::StrictMock<MockVoEChannelProxy>();
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 SimulatedClock simulated_clock_; 241 SimulatedClock simulated_clock_;
243 testing::StrictMock<MockVoiceEngine> voice_engine_; 242 testing::StrictMock<MockVoiceEngine> voice_engine_;
244 rtc::scoped_refptr<AudioState> audio_state_; 243 rtc::scoped_refptr<AudioState> audio_state_;
245 AudioSendStream::Config stream_config_; 244 AudioSendStream::Config stream_config_;
246 testing::StrictMock<MockVoEChannelProxy>* channel_proxy_ = nullptr; 245 testing::StrictMock<MockVoEChannelProxy>* channel_proxy_ = nullptr;
247 testing::NiceMock<MockCongestionObserver> bitrate_observer_; 246 testing::NiceMock<MockCongestionObserver> bitrate_observer_;
248 MockAudioProcessing audio_processing_; 247 MockAudioProcessing audio_processing_;
249 MockTransmitMixer transmit_mixer_; 248 MockTransmitMixer transmit_mixer_;
250 AudioProcessing::AudioProcessingStatistics audio_processing_stats_; 249 AudioProcessing::AudioProcessingStatistics audio_processing_stats_;
251 PacketRouter packet_router_; 250 PacketRouter packet_router_;
252 CongestionController congestion_controller_; 251 SendSideCongestionController congestion_controller_;
253 MockRtcEventLog event_log_; 252 MockRtcEventLog event_log_;
254 MockRtcpRttStats rtcp_rtt_stats_; 253 MockRtcpRttStats rtcp_rtt_stats_;
255 testing::NiceMock<MockLimitObserver> limit_observer_; 254 testing::NiceMock<MockLimitObserver> limit_observer_;
256 BitrateAllocator bitrate_allocator_; 255 BitrateAllocator bitrate_allocator_;
257 // |worker_queue| is defined last to ensure all pending tasks are cancelled 256 // |worker_queue| is defined last to ensure all pending tasks are cancelled
258 // and deleted before any other members. 257 // and deleted before any other members.
259 rtc::TaskQueue worker_queue_; 258 rtc::TaskQueue worker_queue_;
260 }; 259 };
261 } // namespace 260 } // namespace
262 261
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
465 internal::AudioSendStream send_stream( 464 internal::AudioSendStream send_stream(
466 helper.config(), helper.audio_state(), helper.worker_queue(), 465 helper.config(), helper.audio_state(), helper.worker_queue(),
467 helper.packet_router(), helper.congestion_controller(), 466 helper.packet_router(), helper.congestion_controller(),
468 helper.bitrate_allocator(), helper.event_log(), helper.rtcp_rtt_stats()); 467 helper.bitrate_allocator(), helper.event_log(), helper.rtcp_rtt_stats());
469 EXPECT_CALL(*helper.channel_proxy(), SetBitrate(_, 5000)); 468 EXPECT_CALL(*helper.channel_proxy(), SetBitrate(_, 5000));
470 send_stream.OnBitrateUpdated(50000, 0.0, 50, 5000); 469 send_stream.OnBitrateUpdated(50000, 0.0, 50, 5000);
471 } 470 }
472 471
473 } // namespace test 472 } // namespace test
474 } // namespace webrtc 473 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698