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

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

Issue 1604563002: Add send-side BWE to WebRtcVoiceEngine under a finch experiment. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Rebase. Created 4 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
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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 } // namespace 47 } // namespace
48 48
49 std::string AudioReceiveStream::Config::Rtp::ToString() const { 49 std::string AudioReceiveStream::Config::Rtp::ToString() const {
50 std::stringstream ss; 50 std::stringstream ss;
51 ss << "{remote_ssrc: " << remote_ssrc; 51 ss << "{remote_ssrc: " << remote_ssrc;
52 ss << ", local_ssrc: " << local_ssrc; 52 ss << ", local_ssrc: " << local_ssrc;
53 ss << ", extensions: ["; 53 ss << ", extensions: [";
54 for (size_t i = 0; i < extensions.size(); ++i) { 54 for (size_t i = 0; i < extensions.size(); ++i) {
55 ss << extensions[i].ToString(); 55 ss << extensions[i].ToString();
56 if (i != extensions.size() - 1) { 56 if (i != extensions.size() - 1) {
57 ss << ", "; 57 ss << ", ";
the sun 2016/02/03 15:49:01 transport_cc is missing from the printout
stefan-webrtc 2016/02/04 09:47:38 Done.
58 } 58 }
59 } 59 }
60 ss << ']'; 60 ss << ']';
61 ss << '}'; 61 ss << '}';
62 return ss.str(); 62 return ss.str();
63 } 63 }
64 64
65 std::string AudioReceiveStream::Config::ToString() const { 65 std::string AudioReceiveStream::Config::ToString() const {
66 std::stringstream ss; 66 std::stringstream ss;
67 ss << "{rtp: " << rtp.ToString(); 67 ss << "{rtp: " << rtp.ToString();
68 ss << ", receive_transport: " 68 ss << ", receive_transport: "
69 << (receive_transport ? "(Transport)" : "nullptr"); 69 << (receive_transport ? "(Transport)" : "nullptr");
70 ss << ", rtcp_send_transport: " 70 ss << ", rtcp_send_transport: "
71 << (rtcp_send_transport ? "(Transport)" : "nullptr"); 71 << (rtcp_send_transport ? "(Transport)" : "nullptr");
72 ss << ", voe_channel_id: " << voe_channel_id; 72 ss << ", voe_channel_id: " << voe_channel_id;
73 if (!sync_group.empty()) { 73 if (!sync_group.empty()) {
74 ss << ", sync_group: " << sync_group; 74 ss << ", sync_group: " << sync_group;
75 } 75 }
76 ss << ", combined_audio_video_bwe: "
77 << (combined_audio_video_bwe ? "true" : "false");
78 ss << '}'; 76 ss << '}';
79 return ss.str(); 77 return ss.str();
80 } 78 }
81 79
82 namespace internal { 80 namespace internal {
83 AudioReceiveStream::AudioReceiveStream( 81 AudioReceiveStream::AudioReceiveStream(
84 CongestionController* congestion_controller, 82 CongestionController* congestion_controller,
85 const webrtc::AudioReceiveStream::Config& config, 83 const webrtc::AudioReceiveStream::Config& config,
86 const rtc::scoped_refptr<webrtc::AudioState>& audio_state) 84 const rtc::scoped_refptr<webrtc::AudioState>& audio_state)
87 : config_(config), 85 : config_(config),
(...skipping 24 matching lines...) Expand all
112 bool registered = rtp_header_parser_->RegisterRtpHeaderExtension( 110 bool registered = rtp_header_parser_->RegisterRtpHeaderExtension(
113 kRtpExtensionTransportSequenceNumber, extension.id); 111 kRtpExtensionTransportSequenceNumber, extension.id);
114 RTC_DCHECK(registered); 112 RTC_DCHECK(registered);
115 } else { 113 } else {
116 RTC_NOTREACHED() << "Unsupported RTP extension."; 114 RTC_NOTREACHED() << "Unsupported RTP extension.";
117 } 115 }
118 } 116 }
119 // Configure bandwidth estimation. 117 // Configure bandwidth estimation.
120 channel_proxy_->RegisterReceiverCongestionControlObjects( 118 channel_proxy_->RegisterReceiverCongestionControlObjects(
121 congestion_controller->packet_router()); 119 congestion_controller->packet_router());
122 if (config.combined_audio_video_bwe) { 120 if (UseSendSideBwe(config)) {
123 if (UseSendSideBwe(config)) { 121 remote_bitrate_estimator_ =
124 remote_bitrate_estimator_ = 122 congestion_controller->GetRemoteBitrateEstimator(true);
125 congestion_controller->GetRemoteBitrateEstimator(true);
126 } else {
127 remote_bitrate_estimator_ =
128 congestion_controller->GetRemoteBitrateEstimator(false);
129 }
130 RTC_DCHECK(remote_bitrate_estimator_);
131 } 123 }
132 } 124 }
133 125
134 AudioReceiveStream::~AudioReceiveStream() { 126 AudioReceiveStream::~AudioReceiveStream() {
135 RTC_DCHECK(thread_checker_.CalledOnValidThread()); 127 RTC_DCHECK(thread_checker_.CalledOnValidThread());
136 LOG(LS_INFO) << "~AudioReceiveStream: " << config_.ToString(); 128 LOG(LS_INFO) << "~AudioReceiveStream: " << config_.ToString();
137 channel_proxy_->ResetCongestionControlObjects(); 129 channel_proxy_->ResetCongestionControlObjects();
138 if (remote_bitrate_estimator_) { 130 if (remote_bitrate_estimator_) {
139 remote_bitrate_estimator_->RemoveStream(config_.rtp.remote_ssrc); 131 remote_bitrate_estimator_->RemoveStream(config_.rtp.remote_ssrc);
140 } 132 }
(...skipping 28 matching lines...) Expand all
169 // RTC_DCHECK(!thread_checker_.CalledOnValidThread()); 161 // RTC_DCHECK(!thread_checker_.CalledOnValidThread());
170 RTPHeader header; 162 RTPHeader header;
171 if (!rtp_header_parser_->Parse(packet, length, &header)) { 163 if (!rtp_header_parser_->Parse(packet, length, &header)) {
172 return false; 164 return false;
173 } 165 }
174 166
175 // Only forward if the parsed header has one of the headers necessary for 167 // Only forward if the parsed header has one of the headers necessary for
176 // bandwidth estimation. RTP timestamps has different rates for audio and 168 // bandwidth estimation. RTP timestamps has different rates for audio and
177 // video and shouldn't be mixed. 169 // video and shouldn't be mixed.
178 if (remote_bitrate_estimator_ && 170 if (remote_bitrate_estimator_ &&
179 (header.extension.hasAbsoluteSendTime || 171 (header.extension.hasAbsoluteSendTime ||
the sun 2016/02/03 15:49:01 you can remove this part of the conditional - remo
stefan-webrtc 2016/02/04 09:47:38 Done.
180 header.extension.hasTransportSequenceNumber)) { 172 header.extension.hasTransportSequenceNumber)) {
181 int64_t arrival_time_ms = TickTime::MillisecondTimestamp(); 173 int64_t arrival_time_ms = TickTime::MillisecondTimestamp();
182 if (packet_time.timestamp >= 0) 174 if (packet_time.timestamp >= 0)
183 arrival_time_ms = (packet_time.timestamp + 500) / 1000; 175 arrival_time_ms = (packet_time.timestamp + 500) / 1000;
184 size_t payload_size = length - header.headerLength; 176 size_t payload_size = length - header.headerLength;
185 remote_bitrate_estimator_->IncomingPacket(arrival_time_ms, payload_size, 177 remote_bitrate_estimator_->IncomingPacket(arrival_time_ms, payload_size,
186 header, false); 178 header, false);
187 } 179 }
188 return true; 180 return true;
189 } 181 }
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 240
249 VoiceEngine* AudioReceiveStream::voice_engine() const { 241 VoiceEngine* AudioReceiveStream::voice_engine() const {
250 internal::AudioState* audio_state = 242 internal::AudioState* audio_state =
251 static_cast<internal::AudioState*>(audio_state_.get()); 243 static_cast<internal::AudioState*>(audio_state_.get());
252 VoiceEngine* voice_engine = audio_state->voice_engine(); 244 VoiceEngine* voice_engine = audio_state->voice_engine();
253 RTC_DCHECK(voice_engine); 245 RTC_DCHECK(voice_engine);
254 return voice_engine; 246 return voice_engine;
255 } 247 }
256 } // namespace internal 248 } // namespace internal
257 } // namespace webrtc 249 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698