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

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

Issue 2654503005: Make sure min and max bitrate is always set for audio. (Closed)
Patch Set: Created 3 years, 11 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 1437 matching lines...) Expand 10 before | Expand all | Expand 10 after
1448 1448
1449 void RecreateAudioSendStream() { 1449 void RecreateAudioSendStream() {
1450 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); 1450 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
1451 if (stream_) { 1451 if (stream_) {
1452 call_->DestroyAudioSendStream(stream_); 1452 call_->DestroyAudioSendStream(stream_);
1453 stream_ = nullptr; 1453 stream_ = nullptr;
1454 } 1454 }
1455 RTC_DCHECK(!stream_); 1455 RTC_DCHECK(!stream_);
1456 if (webrtc::field_trial::FindFullName("WebRTC-Audio-SendSideBwe") == 1456 if (webrtc::field_trial::FindFullName("WebRTC-Audio-SendSideBwe") ==
1457 "Enabled") { 1457 "Enabled") {
1458 config_.min_bitrate_bps = kOpusMinBitrateBps;
1459 config_.max_bitrate_bps = kOpusBitrateFbBps;
1458 // TODO(mflodman): Keep testing this and set proper values. 1460 // TODO(mflodman): Keep testing this and set proper values.
1459 // Note: This is an early experiment currently only supported by Opus. 1461 // Note: This is an early experiment currently only supported by Opus.
1460 if (webrtc::field_trial::FindFullName( 1462 if (webrtc::field_trial::FindFullName(
1461 "WebRTC-SendSideBwe-WithOverhead") == "Enabled") { 1463 "WebRTC-SendSideBwe-WithOverhead") == "Enabled") {
1462 auto packet_sizes_ms = WebRtcVoiceCodecs::GetPacketSizesMs( 1464 auto packet_sizes_ms = WebRtcVoiceCodecs::GetPacketSizesMs(
1463 config_.send_codec_spec.codec_inst); 1465 config_.send_codec_spec.codec_inst);
1464 if (!packet_sizes_ms.empty()) { 1466 if (!packet_sizes_ms.empty()) {
1465 int max_packet_size_ms = 1467 int max_packet_size_ms =
1466 *std::max_element(packet_sizes_ms.begin(), packet_sizes_ms.end()); 1468 *std::max_element(packet_sizes_ms.begin(), packet_sizes_ms.end());
1467 int min_packet_size_ms = 1469 int min_packet_size_ms =
(...skipping 12 matching lines...) Expand all
1480 1482
1481 int min_overhead_bps = 1483 int min_overhead_bps =
1482 kOverheadPerPacket * 8 * 1000 / max_packet_size_ms; 1484 kOverheadPerPacket * 8 * 1000 / max_packet_size_ms;
1483 1485
1484 int max_overhead_bps = 1486 int max_overhead_bps =
1485 kOverheadPerPacket * 8 * 1000 / min_packet_size_ms; 1487 kOverheadPerPacket * 8 * 1000 / min_packet_size_ms;
1486 1488
1487 config_.min_bitrate_bps = kOpusMinBitrateBps + min_overhead_bps; 1489 config_.min_bitrate_bps = kOpusMinBitrateBps + min_overhead_bps;
1488 config_.max_bitrate_bps = kOpusBitrateFbBps + max_overhead_bps; 1490 config_.max_bitrate_bps = kOpusBitrateFbBps + max_overhead_bps;
1489 } 1491 }
1490 } else {
1491 config_.min_bitrate_bps = kOpusMinBitrateBps;
minyue-webrtc 2017/01/24 14:22:00 Then it should be outside if(webrtc::field_trial::
stefan-webrtc 2017/01/24 14:48:03 I don't follow, I moved it from the else branch to
1492 config_.max_bitrate_bps = kOpusBitrateFbBps;
1493 } 1492 }
1494 } 1493 }
1495 stream_ = call_->CreateAudioSendStream(config_); 1494 stream_ = call_->CreateAudioSendStream(config_);
1496 RTC_CHECK(stream_); 1495 RTC_CHECK(stream_);
1497 UpdateSendState(); 1496 UpdateSendState();
1498 } 1497 }
1499 1498
1500 rtc::ThreadChecker worker_thread_checker_; 1499 rtc::ThreadChecker worker_thread_checker_;
1501 rtc::RaceChecker audio_capture_race_checker_; 1500 rtc::RaceChecker audio_capture_race_checker_;
1502 webrtc::AudioTransport* const voe_audio_transport_ = nullptr; 1501 webrtc::AudioTransport* const voe_audio_transport_ = nullptr;
(...skipping 1202 matching lines...) Expand 10 before | Expand all | Expand 10 after
2705 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); 2704 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
2706 const auto it = send_streams_.find(ssrc); 2705 const auto it = send_streams_.find(ssrc);
2707 if (it != send_streams_.end()) { 2706 if (it != send_streams_.end()) {
2708 return it->second->channel(); 2707 return it->second->channel();
2709 } 2708 }
2710 return -1; 2709 return -1;
2711 } 2710 }
2712 } // namespace cricket 2711 } // namespace cricket
2713 2712
2714 #endif // HAVE_WEBRTC_VOICE 2713 #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