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

Side by Side Diff: webrtc/media/engine/webrtcvoiceengine.cc

Issue 2410903002: Set min and max rate on caller and on callee side. (Closed)
Patch Set: Created 4 years, 2 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 | « no previous file | no next file » | 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) 2004 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2004 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 1151 matching lines...) Expand 10 before | Expand all | Expand 10 after
1162 config_.rtp.extensions = extensions; 1162 config_.rtp.extensions = extensions;
1163 RecreateAudioSendStream(send_codec_spec); 1163 RecreateAudioSendStream(send_codec_spec);
1164 } 1164 }
1165 1165
1166 ~WebRtcAudioSendStream() override { 1166 ~WebRtcAudioSendStream() override {
1167 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); 1167 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
1168 ClearSource(); 1168 ClearSource();
1169 call_->DestroyAudioSendStream(stream_); 1169 call_->DestroyAudioSendStream(stream_);
1170 } 1170 }
1171 1171
1172 void RecreateAudioSendStream(const SendCodecSpec& send_codec_spec) { 1172 void RecreateAudioSendStream(const SendCodecSpec& send_codec_spec) {
the sun 2016/10/11 15:22:15 Thread check should happen before mutating interna
michaelt 2016/10/11 15:27:48 Acknowledged.
1173 config_.rtp.nack.rtp_history_ms =
1174 send_codec_spec.nack_enabled ? kNackRtpHistoryMs : 0;
1175 RecreateAudioSendStream();
1176 }
1177
1178 void RecreateAudioSendStream(
1179 const std::vector<webrtc::RtpExtension>& extensions) {
1180 config_.rtp.extensions = extensions;
1181 RecreateAudioSendStream();
1182 }
1183
1184 void RecreateAudioSendStream() {
the sun 2016/10/11 15:22:15 This is an internal utility - make it private. The
michaelt 2016/10/11 15:27:48 Acknowledged.
1173 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); 1185 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
1174 if (stream_) { 1186 if (stream_) {
1175 call_->DestroyAudioSendStream(stream_); 1187 call_->DestroyAudioSendStream(stream_);
1176 stream_ = nullptr; 1188 stream_ = nullptr;
1177 } 1189 }
1178 config_.rtp.nack.rtp_history_ms =
1179 send_codec_spec.nack_enabled ? kNackRtpHistoryMs : 0;
1180 RTC_DCHECK(!stream_); 1190 RTC_DCHECK(!stream_);
1181 stream_ = call_->CreateAudioSendStream(config_);
1182 RTC_CHECK(stream_);
1183 UpdateSendState();
1184 }
1185
1186 void RecreateAudioSendStream(
1187 const std::vector<webrtc::RtpExtension>& extensions) {
1188 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
1189 if (stream_) {
1190 call_->DestroyAudioSendStream(stream_);
1191 stream_ = nullptr;
1192 }
1193 config_.rtp.extensions = extensions;
1194 if (webrtc::field_trial::FindFullName("WebRTC-AdaptAudioBitrate") == 1191 if (webrtc::field_trial::FindFullName("WebRTC-AdaptAudioBitrate") ==
1195 "Enabled") { 1192 "Enabled") {
1196 // TODO(mflodman): Keep testing this and set proper values. 1193 // TODO(mflodman): Keep testing this and set proper values.
1197 // Note: This is an early experiment currently only supported by Opus. 1194 // Note: This is an early experiment currently only supported by Opus.
1198 config_.min_bitrate_kbps = kOpusMinBitrate; 1195 config_.min_bitrate_kbps = kOpusMinBitrate;
1199 config_.max_bitrate_kbps = kOpusBitrateFb; 1196 config_.max_bitrate_kbps = kOpusBitrateFb;
1200 } 1197 }
1201
1202 RTC_DCHECK(!stream_);
1203 stream_ = call_->CreateAudioSendStream(config_); 1198 stream_ = call_->CreateAudioSendStream(config_);
1204 RTC_CHECK(stream_); 1199 RTC_CHECK(stream_);
1205 UpdateSendState(); 1200 UpdateSendState();
1206 } 1201 }
1207 1202
1208 bool SendTelephoneEvent(int payload_type, int event, int duration_ms) { 1203 bool SendTelephoneEvent(int payload_type, int event, int duration_ms) {
1209 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); 1204 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
1210 RTC_DCHECK(stream_); 1205 RTC_DCHECK(stream_);
1211 return stream_->SendTelephoneEvent(payload_type, event, duration_ms); 1206 return stream_->SendTelephoneEvent(payload_type, event, duration_ms);
1212 } 1207 }
(...skipping 1451 matching lines...) Expand 10 before | Expand all | Expand 10 after
2664 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); 2659 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
2665 const auto it = send_streams_.find(ssrc); 2660 const auto it = send_streams_.find(ssrc);
2666 if (it != send_streams_.end()) { 2661 if (it != send_streams_.end()) {
2667 return it->second->channel(); 2662 return it->second->channel();
2668 } 2663 }
2669 return -1; 2664 return -1;
2670 } 2665 }
2671 } // namespace cricket 2666 } // namespace cricket
2672 2667
2673 #endif // HAVE_WEBRTC_VOICE 2668 #endif // HAVE_WEBRTC_VOICE
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698