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

Side by Side Diff: webrtc/call/call.cc

Issue 2834663003: Allow mocking SendSideCongestionController for Call tests. (Closed)
Patch Set: rebase Created 3 years, 7 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
« no previous file with comments | « webrtc/call/call.h ('k') | webrtc/call/call_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2013 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
11 #include <string.h> 11 #include <string.h>
12 #include <algorithm> 12 #include <algorithm>
13 #include <map> 13 #include <map>
14 #include <memory> 14 #include <memory>
15 #include <set> 15 #include <set>
16 #include <utility> 16 #include <utility>
17 #include <vector> 17 #include <vector>
18 18
19 #include "webrtc/audio/audio_receive_stream.h" 19 #include "webrtc/audio/audio_receive_stream.h"
20 #include "webrtc/audio/audio_send_stream.h" 20 #include "webrtc/audio/audio_send_stream.h"
21 #include "webrtc/audio/audio_state.h" 21 #include "webrtc/audio/audio_state.h"
22 #include "webrtc/audio/scoped_voe_interface.h" 22 #include "webrtc/audio/scoped_voe_interface.h"
23 #include "webrtc/base/basictypes.h" 23 #include "webrtc/base/basictypes.h"
24 #include "webrtc/base/checks.h" 24 #include "webrtc/base/checks.h"
25 #include "webrtc/base/constructormagic.h" 25 #include "webrtc/base/constructormagic.h"
26 #include "webrtc/base/location.h" 26 #include "webrtc/base/location.h"
27 #include "webrtc/base/logging.h" 27 #include "webrtc/base/logging.h"
28 #include "webrtc/base/optional.h" 28 #include "webrtc/base/optional.h"
29 #include "webrtc/base/ptr_util.h"
29 #include "webrtc/base/task_queue.h" 30 #include "webrtc/base/task_queue.h"
30 #include "webrtc/base/thread_annotations.h" 31 #include "webrtc/base/thread_annotations.h"
31 #include "webrtc/base/thread_checker.h" 32 #include "webrtc/base/thread_checker.h"
32 #include "webrtc/base/trace_event.h" 33 #include "webrtc/base/trace_event.h"
33 #include "webrtc/call/bitrate_allocator.h" 34 #include "webrtc/call/bitrate_allocator.h"
34 #include "webrtc/call/call.h" 35 #include "webrtc/call/call.h"
35 #include "webrtc/call/flexfec_receive_stream_impl.h" 36 #include "webrtc/call/flexfec_receive_stream_impl.h"
36 #include "webrtc/call/rtp_transport_controller_send.h" 37 #include "webrtc/call/rtp_transport_controller_send.h"
37 #include "webrtc/config.h" 38 #include "webrtc/config.h"
38 #include "webrtc/logging/rtc_event_log/rtc_event_log.h" 39 #include "webrtc/logging/rtc_event_log/rtc_event_log.h"
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 91
91 namespace internal { 92 namespace internal {
92 93
93 class Call : public webrtc::Call, 94 class Call : public webrtc::Call,
94 public PacketReceiver, 95 public PacketReceiver,
95 public RecoveredPacketReceiver, 96 public RecoveredPacketReceiver,
96 public SendSideCongestionController::Observer, 97 public SendSideCongestionController::Observer,
97 public BitrateAllocator::LimitObserver { 98 public BitrateAllocator::LimitObserver {
98 public: 99 public:
99 Call(const Call::Config& config, 100 Call(const Call::Config& config,
100 std::unique_ptr<RtpTransportControllerSend> transport_send); 101 std::unique_ptr<RtpTransportControllerSendInterface> transport_send);
101 virtual ~Call(); 102 virtual ~Call();
102 103
103 // Implements webrtc::Call. 104 // Implements webrtc::Call.
104 PacketReceiver* Receiver() override; 105 PacketReceiver* Receiver() override;
105 106
106 webrtc::AudioSendStream* CreateAudioSendStream( 107 webrtc::AudioSendStream* CreateAudioSendStream(
107 const webrtc::AudioSendStream::Config& config) override; 108 const webrtc::AudioSendStream::Config& config) override;
108 void DestroyAudioSendStream(webrtc::AudioSendStream* send_stream) override; 109 void DestroyAudioSendStream(webrtc::AudioSendStream* send_stream) override;
109 110
110 webrtc::AudioReceiveStream* CreateAudioReceiveStream( 111 webrtc::AudioReceiveStream* CreateAudioReceiveStream(
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 ss << "send_bw_bps: " << send_bandwidth_bps << ", "; 292 ss << "send_bw_bps: " << send_bandwidth_bps << ", ";
292 ss << "recv_bw_bps: " << recv_bandwidth_bps << ", "; 293 ss << "recv_bw_bps: " << recv_bandwidth_bps << ", ";
293 ss << "max_pad_bps: " << max_padding_bitrate_bps << ", "; 294 ss << "max_pad_bps: " << max_padding_bitrate_bps << ", ";
294 ss << "pacer_delay_ms: " << pacer_delay_ms << ", "; 295 ss << "pacer_delay_ms: " << pacer_delay_ms << ", ";
295 ss << "rtt_ms: " << rtt_ms; 296 ss << "rtt_ms: " << rtt_ms;
296 ss << '}'; 297 ss << '}';
297 return ss.str(); 298 return ss.str();
298 } 299 }
299 300
300 Call* Call::Create(const Call::Config& config) { 301 Call* Call::Create(const Call::Config& config) {
301 return new internal::Call( 302 return new internal::Call(config,
302 config, std::unique_ptr<RtpTransportControllerSend>( 303 rtc::MakeUnique<RtpTransportControllerSend>(
303 new RtpTransportControllerSend(Clock::GetRealTimeClock(), 304 Clock::GetRealTimeClock(), config.event_log));
304 config.event_log))); 305 }
306
307 Call* Call::Create(
308 const Call::Config& config,
309 std::unique_ptr<RtpTransportControllerSendInterface> transport_send) {
310 return new internal::Call(config, std::move(transport_send));
305 } 311 }
306 312
307 namespace internal { 313 namespace internal {
308 314
309 Call::Call(const Call::Config& config, 315 Call::Call(const Call::Config& config,
310 std::unique_ptr<RtpTransportControllerSend> transport_send) 316 std::unique_ptr<RtpTransportControllerSendInterface> transport_send)
311 : clock_(Clock::GetRealTimeClock()), 317 : clock_(Clock::GetRealTimeClock()),
312 num_cpu_cores_(CpuInfo::DetectNumberOfCores()), 318 num_cpu_cores_(CpuInfo::DetectNumberOfCores()),
313 module_process_thread_(ProcessThread::Create("ModuleProcessThread")), 319 module_process_thread_(ProcessThread::Create("ModuleProcessThread")),
314 pacer_thread_(ProcessThread::Create("PacerThread")), 320 pacer_thread_(ProcessThread::Create("PacerThread")),
315 call_stats_(new CallStats(clock_)), 321 call_stats_(new CallStats(clock_)),
316 bitrate_allocator_(new BitrateAllocator(this)), 322 bitrate_allocator_(new BitrateAllocator(this)),
317 config_(config), 323 config_(config),
318 audio_network_state_(kNetworkDown), 324 audio_network_state_(kNetworkDown),
319 video_network_state_(kNetworkDown), 325 video_network_state_(kNetworkDown),
320 receive_crit_(RWLockWrapper::CreateRWLock()), 326 receive_crit_(RWLockWrapper::CreateRWLock()),
(...skipping 14 matching lines...) Expand all
335 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); 341 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread());
336 RTC_DCHECK(config.event_log != nullptr); 342 RTC_DCHECK(config.event_log != nullptr);
337 RTC_DCHECK_GE(config.bitrate_config.min_bitrate_bps, 0); 343 RTC_DCHECK_GE(config.bitrate_config.min_bitrate_bps, 0);
338 RTC_DCHECK_GE(config.bitrate_config.start_bitrate_bps, 344 RTC_DCHECK_GE(config.bitrate_config.start_bitrate_bps,
339 config.bitrate_config.min_bitrate_bps); 345 config.bitrate_config.min_bitrate_bps);
340 if (config.bitrate_config.max_bitrate_bps != -1) { 346 if (config.bitrate_config.max_bitrate_bps != -1) {
341 RTC_DCHECK_GE(config.bitrate_config.max_bitrate_bps, 347 RTC_DCHECK_GE(config.bitrate_config.max_bitrate_bps,
342 config.bitrate_config.start_bitrate_bps); 348 config.bitrate_config.start_bitrate_bps);
343 } 349 }
344 Trace::CreateTrace(); 350 Trace::CreateTrace();
345 transport_send->RegisterNetworkObserver(this); 351 transport_send->send_side_cc()->RegisterNetworkObserver(this);
346 transport_send_ = std::move(transport_send); 352 transport_send_ = std::move(transport_send);
347 transport_send_->send_side_cc()->SignalNetworkState(kNetworkDown); 353 transport_send_->send_side_cc()->SignalNetworkState(kNetworkDown);
348 transport_send_->send_side_cc()->SetBweBitrates( 354 transport_send_->send_side_cc()->SetBweBitrates(
349 config_.bitrate_config.min_bitrate_bps, 355 config_.bitrate_config.min_bitrate_bps,
350 config_.bitrate_config.start_bitrate_bps, 356 config_.bitrate_config.start_bitrate_bps,
351 config_.bitrate_config.max_bitrate_bps); 357 config_.bitrate_config.max_bitrate_bps);
352 call_stats_->RegisterStatsObserver(&receive_side_cc_); 358 call_stats_->RegisterStatsObserver(&receive_side_cc_);
353 call_stats_->RegisterStatsObserver(transport_send_->send_side_cc()); 359 call_stats_->RegisterStatsObserver(transport_send_->send_side_cc());
354 360
355 module_process_thread_->Start(); 361 module_process_thread_->Start();
(...skipping 926 matching lines...) Expand 10 before | Expand all | Expand 10 after
1282 (use_send_side_bwe && header.extension.hasTransportSequenceNumber)) { 1288 (use_send_side_bwe && header.extension.hasTransportSequenceNumber)) {
1283 receive_side_cc_.OnReceivedPacket( 1289 receive_side_cc_.OnReceivedPacket(
1284 packet.arrival_time_ms(), packet.payload_size() + packet.padding_size(), 1290 packet.arrival_time_ms(), packet.payload_size() + packet.padding_size(),
1285 header); 1291 header);
1286 } 1292 }
1287 } 1293 }
1288 1294
1289 } // namespace internal 1295 } // namespace internal
1290 1296
1291 } // namespace webrtc 1297 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/call/call.h ('k') | webrtc/call/call_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698