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

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

Issue 2516983004: Move ownership of PacketRouter from CongestionController to Call. (Closed)
Patch Set: Created 4 years, 1 month 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_receive_stream.h ('k') | webrtc/audio/audio_receive_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_receive_stream.h" 11 #include "webrtc/audio/audio_receive_stream.h"
12 12
13 #include <string> 13 #include <string>
14 #include <utility> 14 #include <utility>
15 15
16 #include "webrtc/api/call/audio_sink.h" 16 #include "webrtc/api/call/audio_sink.h"
17 #include "webrtc/audio/audio_send_stream.h" 17 #include "webrtc/audio/audio_send_stream.h"
18 #include "webrtc/audio/audio_state.h" 18 #include "webrtc/audio/audio_state.h"
19 #include "webrtc/audio/conversion.h" 19 #include "webrtc/audio/conversion.h"
20 #include "webrtc/base/checks.h" 20 #include "webrtc/base/checks.h"
21 #include "webrtc/base/logging.h" 21 #include "webrtc/base/logging.h"
22 #include "webrtc/base/timeutils.h" 22 #include "webrtc/base/timeutils.h"
23 #include "webrtc/modules/congestion_controller/include/congestion_controller.h"
24 #include "webrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimat or.h" 23 #include "webrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimat or.h"
25 #include "webrtc/voice_engine/channel_proxy.h" 24 #include "webrtc/voice_engine/channel_proxy.h"
26 #include "webrtc/voice_engine/include/voe_base.h" 25 #include "webrtc/voice_engine/include/voe_base.h"
27 #include "webrtc/voice_engine/include/voe_codec.h" 26 #include "webrtc/voice_engine/include/voe_codec.h"
28 #include "webrtc/voice_engine/include/voe_neteq_stats.h" 27 #include "webrtc/voice_engine/include/voe_neteq_stats.h"
29 #include "webrtc/voice_engine/include/voe_rtp_rtcp.h" 28 #include "webrtc/voice_engine/include/voe_rtp_rtcp.h"
30 #include "webrtc/voice_engine/include/voe_video_sync.h" 29 #include "webrtc/voice_engine/include/voe_video_sync.h"
31 #include "webrtc/voice_engine/include/voe_volume_control.h" 30 #include "webrtc/voice_engine/include/voe_volume_control.h"
32 #include "webrtc/voice_engine/voice_engine_impl.h" 31 #include "webrtc/voice_engine/voice_engine_impl.h"
33 32
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 ss << ", voe_channel_id: " << voe_channel_id; 72 ss << ", voe_channel_id: " << voe_channel_id;
74 if (!sync_group.empty()) { 73 if (!sync_group.empty()) {
75 ss << ", sync_group: " << sync_group; 74 ss << ", sync_group: " << sync_group;
76 } 75 }
77 ss << '}'; 76 ss << '}';
78 return ss.str(); 77 return ss.str();
79 } 78 }
80 79
81 namespace internal { 80 namespace internal {
82 AudioReceiveStream::AudioReceiveStream( 81 AudioReceiveStream::AudioReceiveStream(
83 CongestionController* congestion_controller, 82 PacketRouter* packet_router,
83 RemoteBitrateEstimator* remote_bitrate_estimator,
84 const webrtc::AudioReceiveStream::Config& config, 84 const webrtc::AudioReceiveStream::Config& config,
85 const rtc::scoped_refptr<webrtc::AudioState>& audio_state, 85 const rtc::scoped_refptr<webrtc::AudioState>& audio_state,
86 webrtc::RtcEventLog* event_log) 86 webrtc::RtcEventLog* event_log)
87 : config_(config), 87 : config_(config),
88 audio_state_(audio_state), 88 audio_state_(audio_state),
89 rtp_header_parser_(RtpHeaderParser::Create()) { 89 rtp_header_parser_(RtpHeaderParser::Create()) {
90 LOG(LS_INFO) << "AudioReceiveStream: " << config_.ToString(); 90 LOG(LS_INFO) << "AudioReceiveStream: " << config_.ToString();
91 RTC_DCHECK_NE(config_.voe_channel_id, -1); 91 RTC_DCHECK_NE(config_.voe_channel_id, -1);
92 RTC_DCHECK(audio_state_.get()); 92 RTC_DCHECK(audio_state_.get());
93 RTC_DCHECK(congestion_controller); 93 RTC_DCHECK(packet_router);
the sun 2016/11/21 13:55:31 Can we DCHECK(remote_bitrate_estimator) too?
nisse-webrtc 2016/11/21 14:07:36 Not sure if that's appropriate, it's used only if
the sun 2016/11/21 15:36:11 If we can avoid having to handle the null case, th
nisse-webrtc 2016/11/23 08:11:44 In this cl, the call site looks like this: Audi
94 RTC_DCHECK(rtp_header_parser_); 94 RTC_DCHECK(rtp_header_parser_);
95 95
96 VoiceEngineImpl* voe_impl = static_cast<VoiceEngineImpl*>(voice_engine()); 96 VoiceEngineImpl* voe_impl = static_cast<VoiceEngineImpl*>(voice_engine());
97 channel_proxy_ = voe_impl->GetChannelProxy(config_.voe_channel_id); 97 channel_proxy_ = voe_impl->GetChannelProxy(config_.voe_channel_id);
98 channel_proxy_->SetRtcEventLog(event_log); 98 channel_proxy_->SetRtcEventLog(event_log);
99 channel_proxy_->SetLocalSSRC(config.rtp.local_ssrc); 99 channel_proxy_->SetLocalSSRC(config.rtp.local_ssrc);
100 // TODO(solenberg): Config NACK history window (which is a packet count), 100 // TODO(solenberg): Config NACK history window (which is a packet count),
101 // using the actual packet size for the configured codec. 101 // using the actual packet size for the configured codec.
102 channel_proxy_->SetNACKStatus(config_.rtp.nack.rtp_history_ms != 0, 102 channel_proxy_->SetNACKStatus(config_.rtp.nack.rtp_history_ms != 0,
103 config_.rtp.nack.rtp_history_ms / 20); 103 config_.rtp.nack.rtp_history_ms / 20);
(...skipping 18 matching lines...) Expand all
122 } else if (extension.uri == RtpExtension::kTransportSequenceNumberUri) { 122 } else if (extension.uri == RtpExtension::kTransportSequenceNumberUri) {
123 channel_proxy_->EnableReceiveTransportSequenceNumber(extension.id); 123 channel_proxy_->EnableReceiveTransportSequenceNumber(extension.id);
124 bool registered = rtp_header_parser_->RegisterRtpHeaderExtension( 124 bool registered = rtp_header_parser_->RegisterRtpHeaderExtension(
125 kRtpExtensionTransportSequenceNumber, extension.id); 125 kRtpExtensionTransportSequenceNumber, extension.id);
126 RTC_DCHECK(registered); 126 RTC_DCHECK(registered);
127 } else { 127 } else {
128 RTC_NOTREACHED() << "Unsupported RTP extension."; 128 RTC_NOTREACHED() << "Unsupported RTP extension.";
129 } 129 }
130 } 130 }
131 // Configure bandwidth estimation. 131 // Configure bandwidth estimation.
132 channel_proxy_->RegisterReceiverCongestionControlObjects( 132 channel_proxy_->RegisterReceiverCongestionControlObjects(packet_router);
133 congestion_controller->packet_router());
134 if (UseSendSideBwe(config)) { 133 if (UseSendSideBwe(config)) {
135 remote_bitrate_estimator_ = 134 remote_bitrate_estimator_ = remote_bitrate_estimator;
nisse-webrtc 2016/11/21 14:07:36 A DCHECK(remote_bitrate_estimator) might make more
the sun 2016/11/21 15:36:11 If Call might be giving us a null in this situatio
nisse-webrtc 2016/11/23 08:11:44 Currently we never get null. Motivation for a DCHE
136 congestion_controller->GetRemoteBitrateEstimator(true);
137 } 135 }
138 } 136 }
139 137
140 AudioReceiveStream::~AudioReceiveStream() { 138 AudioReceiveStream::~AudioReceiveStream() {
141 RTC_DCHECK(thread_checker_.CalledOnValidThread()); 139 RTC_DCHECK(thread_checker_.CalledOnValidThread());
142 LOG(LS_INFO) << "~AudioReceiveStream: " << config_.ToString(); 140 LOG(LS_INFO) << "~AudioReceiveStream: " << config_.ToString();
143 Stop(); 141 Stop();
144 channel_proxy_->DisassociateSendChannel(); 142 channel_proxy_->DisassociateSendChannel();
145 channel_proxy_->DeRegisterExternalTransport(); 143 channel_proxy_->DeRegisterExternalTransport();
146 channel_proxy_->ResetCongestionControlObjects(); 144 channel_proxy_->ResetCongestionControlObjects();
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 296
299 VoiceEngine* AudioReceiveStream::voice_engine() const { 297 VoiceEngine* AudioReceiveStream::voice_engine() const {
300 internal::AudioState* audio_state = 298 internal::AudioState* audio_state =
301 static_cast<internal::AudioState*>(audio_state_.get()); 299 static_cast<internal::AudioState*>(audio_state_.get());
302 VoiceEngine* voice_engine = audio_state->voice_engine(); 300 VoiceEngine* voice_engine = audio_state->voice_engine();
303 RTC_DCHECK(voice_engine); 301 RTC_DCHECK(voice_engine);
304 return voice_engine; 302 return voice_engine;
305 } 303 }
306 } // namespace internal 304 } // namespace internal
307 } // namespace webrtc 305 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/audio/audio_receive_stream.h ('k') | webrtc/audio/audio_receive_stream_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698