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

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

Issue 2658233002: Wire up audio packet loss to BWE. (Closed)
Patch Set: Only register BandwidthObserver when needed BWE is negotiated. Created 3 years, 10 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/audio/audio_send_stream.h ('k') | webrtc/audio/audio_send_stream_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) 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
11 #include "webrtc/audio/audio_send_stream.h" 11 #include "webrtc/audio/audio_send_stream.h"
12 12
13 #include <string> 13 #include <string>
14 14
15 #include "webrtc/audio/audio_state.h" 15 #include "webrtc/audio/audio_state.h"
16 #include "webrtc/audio/conversion.h" 16 #include "webrtc/audio/conversion.h"
17 #include "webrtc/audio/scoped_voe_interface.h" 17 #include "webrtc/audio/scoped_voe_interface.h"
18 #include "webrtc/base/checks.h" 18 #include "webrtc/base/checks.h"
19 #include "webrtc/base/event.h" 19 #include "webrtc/base/event.h"
20 #include "webrtc/base/logging.h" 20 #include "webrtc/base/logging.h"
21 #include "webrtc/base/task_queue.h" 21 #include "webrtc/base/task_queue.h"
22 #include "webrtc/modules/bitrate_controller/include/bitrate_controller.h"
22 #include "webrtc/modules/congestion_controller/include/congestion_controller.h" 23 #include "webrtc/modules/congestion_controller/include/congestion_controller.h"
23 #include "webrtc/modules/pacing/paced_sender.h" 24 #include "webrtc/modules/pacing/paced_sender.h"
24 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" 25 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h"
25 #include "webrtc/voice_engine/channel_proxy.h" 26 #include "webrtc/voice_engine/channel_proxy.h"
26 #include "webrtc/voice_engine/include/voe_base.h" 27 #include "webrtc/voice_engine/include/voe_base.h"
27 #include "webrtc/voice_engine/include/voe_volume_control.h" 28 #include "webrtc/voice_engine/include/voe_volume_control.h"
28 #include "webrtc/voice_engine/voice_engine_impl.h" 29 #include "webrtc/voice_engine/voice_engine_impl.h"
29 30
30 namespace webrtc { 31 namespace webrtc {
31 32
(...skipping 23 matching lines...) Expand all
55 congestion_controller_(congestion_controller) { 56 congestion_controller_(congestion_controller) {
56 LOG(LS_INFO) << "AudioSendStream: " << config_.ToString(); 57 LOG(LS_INFO) << "AudioSendStream: " << config_.ToString();
57 RTC_DCHECK_NE(config_.voe_channel_id, -1); 58 RTC_DCHECK_NE(config_.voe_channel_id, -1);
58 RTC_DCHECK(audio_state_.get()); 59 RTC_DCHECK(audio_state_.get());
59 RTC_DCHECK(congestion_controller); 60 RTC_DCHECK(congestion_controller);
60 61
61 VoiceEngineImpl* voe_impl = static_cast<VoiceEngineImpl*>(voice_engine()); 62 VoiceEngineImpl* voe_impl = static_cast<VoiceEngineImpl*>(voice_engine());
62 channel_proxy_ = voe_impl->GetChannelProxy(config_.voe_channel_id); 63 channel_proxy_ = voe_impl->GetChannelProxy(config_.voe_channel_id);
63 channel_proxy_->SetRtcEventLog(event_log); 64 channel_proxy_->SetRtcEventLog(event_log);
64 channel_proxy_->SetRtcpRttStats(rtcp_rtt_stats); 65 channel_proxy_->SetRtcpRttStats(rtcp_rtt_stats);
65 channel_proxy_->RegisterSenderCongestionControlObjects(
66 congestion_controller->pacer(),
67 congestion_controller->GetTransportFeedbackObserver(), packet_router);
68 channel_proxy_->SetRTCPStatus(true); 66 channel_proxy_->SetRTCPStatus(true);
69 channel_proxy_->SetLocalSSRC(config.rtp.ssrc); 67 channel_proxy_->SetLocalSSRC(config.rtp.ssrc);
70 channel_proxy_->SetRTCP_CNAME(config.rtp.c_name); 68 channel_proxy_->SetRTCP_CNAME(config.rtp.c_name);
71 // TODO(solenberg): Config NACK history window (which is a packet count), 69 // TODO(solenberg): Config NACK history window (which is a packet count),
72 // using the actual packet size for the configured codec. 70 // using the actual packet size for the configured codec.
73 channel_proxy_->SetNACKStatus(config_.rtp.nack.rtp_history_ms != 0, 71 channel_proxy_->SetNACKStatus(config_.rtp.nack.rtp_history_ms != 0,
74 config_.rtp.nack.rtp_history_ms / 20); 72 config_.rtp.nack.rtp_history_ms / 20);
75 73
76 channel_proxy_->RegisterExternalTransport(config.send_transport); 74 channel_proxy_->RegisterExternalTransport(config.send_transport);
77 75
78 for (const auto& extension : config.rtp.extensions) { 76 for (const auto& extension : config.rtp.extensions) {
79 if (extension.uri == RtpExtension::kAudioLevelUri) { 77 if (extension.uri == RtpExtension::kAudioLevelUri) {
80 channel_proxy_->SetSendAudioLevelIndicationStatus(true, extension.id); 78 channel_proxy_->SetSendAudioLevelIndicationStatus(true, extension.id);
81 } else if (extension.uri == RtpExtension::kTransportSequenceNumberUri) { 79 } else if (extension.uri == RtpExtension::kTransportSequenceNumberUri) {
82 channel_proxy_->EnableSendTransportSequenceNumber(extension.id); 80 channel_proxy_->EnableSendTransportSequenceNumber(extension.id);
83 congestion_controller->EnablePeriodicAlrProbing(true); 81 congestion_controller->EnablePeriodicAlrProbing(true);
82 bandwidth_observer_.reset(congestion_controller->GetBitrateController()
83 ->CreateRtcpBandwidthObserver());
84 } else { 84 } else {
85 RTC_NOTREACHED() << "Registering unsupported RTP extension."; 85 RTC_NOTREACHED() << "Registering unsupported RTP extension.";
86 } 86 }
87 } 87 }
88 channel_proxy_->RegisterSenderCongestionControlObjects(
89 congestion_controller->pacer(),
90 congestion_controller->GetTransportFeedbackObserver(), packet_router,
91 bandwidth_observer_.get());
88 if (!SetupSendCodec()) { 92 if (!SetupSendCodec()) {
89 LOG(LS_ERROR) << "Failed to set up send codec state."; 93 LOG(LS_ERROR) << "Failed to set up send codec state.";
90 } 94 }
91 } 95 }
92 96
93 AudioSendStream::~AudioSendStream() { 97 AudioSendStream::~AudioSendStream() {
94 RTC_DCHECK(thread_checker_.CalledOnValidThread()); 98 RTC_DCHECK(thread_checker_.CalledOnValidThread());
95 LOG(LS_INFO) << "~AudioSendStream: " << config_.ToString(); 99 LOG(LS_INFO) << "~AudioSendStream: " << config_.ToString();
96 channel_proxy_->DeRegisterExternalTransport(); 100 channel_proxy_->DeRegisterExternalTransport();
97 channel_proxy_->ResetCongestionControlObjects(); 101 channel_proxy_->ResetCongestionControlObjects();
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 LOG(LS_WARNING) << "SetVADStatus() failed."; 379 LOG(LS_WARNING) << "SetVADStatus() failed.";
376 return false; 380 return false;
377 } 381 }
378 } 382 }
379 } 383 }
380 return true; 384 return true;
381 } 385 }
382 386
383 } // namespace internal 387 } // namespace internal
384 } // namespace webrtc 388 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/audio/audio_send_stream.h ('k') | webrtc/audio/audio_send_stream_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698