Fixing config for Audio BWE.
The unit was kbps but the one default use of it is in bps. The inconsistency should be fixed.
BUG=webrtc:6670
Review-Url: https://codereview.webrtc.org/2247213005
Cr-Commit-Position: refs/heads/master@{#14955}
diff --git a/webrtc/api/call/audio_send_stream.cc b/webrtc/api/call/audio_send_stream.cc
index 52c30f0..3ce35e7 100644
--- a/webrtc/api/call/audio_send_stream.cc
+++ b/webrtc/api/call/audio_send_stream.cc
@@ -41,8 +41,8 @@
ss << "{rtp: " << rtp.ToString();
ss << ", send_transport: " << (send_transport ? "(Transport)" : "nullptr");
ss << ", voe_channel_id: " << voe_channel_id;
- ss << ", min_bitrate_kbps: " << min_bitrate_kbps;
- ss << ", max_bitrate_kbps: " << max_bitrate_kbps;
+ ss << ", min_bitrate_bps: " << min_bitrate_bps;
+ ss << ", max_bitrate_bps: " << max_bitrate_bps;
ss << ", send_codec_spec: " << send_codec_spec.ToString();
ss << '}';
return ss.str();
diff --git a/webrtc/api/call/audio_send_stream.h b/webrtc/api/call/audio_send_stream.h
index 78ab8ec..658c9de 100644
--- a/webrtc/api/call/audio_send_stream.h
+++ b/webrtc/api/call/audio_send_stream.h
@@ -90,8 +90,8 @@
// Bitrate limits used for variable audio bitrate streams. Set both to -1 to
// disable audio bitrate adaptation.
// Note: This is still an experimental feature and not ready for real usage.
- int min_bitrate_kbps = -1;
- int max_bitrate_kbps = -1;
+ int min_bitrate_bps = -1;
+ int max_bitrate_bps = -1;
// Defines whether to turn on audio network adaptor, and defines its config
// string.
diff --git a/webrtc/audio/audio_send_stream.cc b/webrtc/audio/audio_send_stream.cc
index ad6366b..7e8e426 100644
--- a/webrtc/audio/audio_send_stream.cc
+++ b/webrtc/audio/audio_send_stream.cc
@@ -101,12 +101,12 @@
void AudioSendStream::Start() {
RTC_DCHECK(thread_checker_.CalledOnValidThread());
- if (config_.min_bitrate_kbps != -1 && config_.max_bitrate_kbps != -1) {
- RTC_DCHECK_GE(config_.max_bitrate_kbps, config_.min_bitrate_kbps);
+ if (config_.min_bitrate_bps != -1 && config_.max_bitrate_bps != -1) {
+ RTC_DCHECK_GE(config_.max_bitrate_bps, config_.min_bitrate_bps);
rtc::Event thread_sync_event(false /* manual_reset */, false);
worker_queue_->PostTask([this, &thread_sync_event] {
- bitrate_allocator_->AddObserver(this, config_.min_bitrate_kbps * 1000,
- config_.max_bitrate_kbps * 1000, 0, true);
+ bitrate_allocator_->AddObserver(this, config_.min_bitrate_bps,
+ config_.max_bitrate_bps, 0, true);
thread_sync_event.Set();
});
thread_sync_event.Wait(rtc::Event::kForever);
@@ -249,10 +249,10 @@
uint8_t fraction_loss,
int64_t rtt) {
RTC_DCHECK_GE(bitrate_bps,
- static_cast<uint32_t>(config_.min_bitrate_kbps * 1000));
+ static_cast<uint32_t>(config_.min_bitrate_bps));
// The bitrate allocator might allocate an higher than max configured bitrate
// if there is room, to allow for, as example, extra FEC. Ignore that for now.
- const uint32_t max_bitrate_bps = config_.max_bitrate_kbps * 1000;
+ const uint32_t max_bitrate_bps = config_.max_bitrate_bps;
if (bitrate_bps > max_bitrate_bps)
bitrate_bps = max_bitrate_bps;
diff --git a/webrtc/audio/audio_send_stream_unittest.cc b/webrtc/audio/audio_send_stream_unittest.cc
index f310d00..bd7ffb7 100644
--- a/webrtc/audio/audio_send_stream_unittest.cc
+++ b/webrtc/audio/audio_send_stream_unittest.cc
@@ -215,8 +215,8 @@
config.rtp.ssrc = kSsrc;
config.rtp.c_name = kCName;
config.voe_channel_id = kChannelId;
- config.min_bitrate_kbps = 12;
- config.max_bitrate_kbps = 34;
+ config.min_bitrate_bps = 12000;
+ config.max_bitrate_bps = 34000;
config.send_codec_spec.nack_enabled = true;
config.send_codec_spec.transport_cc_enabled = false;
config.send_codec_spec.enable_codec_fec = true;
@@ -233,7 +233,7 @@
"{rtp: {ssrc: 1234, extensions: [{uri: "
"urn:ietf:params:rtp-hdrext:ssrc-audio-level, id: 2}], nack: "
"{rtp_history_ms: 0}, c_name: foo_name}, send_transport: nullptr, "
- "voe_channel_id: 1, min_bitrate_kbps: 12, max_bitrate_kbps: 34, "
+ "voe_channel_id: 1, min_bitrate_bps: 12000, max_bitrate_bps: 34000, "
"send_codec_spec: {nack_enabled: true, transport_cc_enabled: false, "
"enable_codec_fec: true, enable_opus_dtx: false, opus_max_playback_rate: "
"32000, cng_payload_type: 42, cng_plfreq: 56, min_ptime: 20, max_ptime: "
diff --git a/webrtc/call/rampup_tests.cc b/webrtc/call/rampup_tests.cc
index df64f41..3cdcc99 100644
--- a/webrtc/call/rampup_tests.cc
+++ b/webrtc/call/rampup_tests.cc
@@ -212,8 +212,8 @@
send_config->rtp.ssrc = audio_ssrcs_[0];
send_config->rtp.extensions.clear();
- send_config->min_bitrate_kbps = 6;
- send_config->max_bitrate_kbps = 60;
+ send_config->min_bitrate_bps = 6000;
+ send_config->max_bitrate_bps = 60000;
bool transport_cc = false;
if (extension_type_ == RtpExtension::kAbsSendTimeUri) {
diff --git a/webrtc/media/engine/webrtcvoiceengine.cc b/webrtc/media/engine/webrtcvoiceengine.cc
index 99369a2..6f24ef8 100644
--- a/webrtc/media/engine/webrtcvoiceengine.cc
+++ b/webrtc/media/engine/webrtcvoiceengine.cc
@@ -83,16 +83,16 @@
// 64-128 kb/s for FB stereo music.
// The current implementation applies the following values to mono signals,
// and multiplies them by 2 for stereo.
-const int kOpusBitrateNb = 12000;
-const int kOpusBitrateWb = 20000;
-const int kOpusBitrateFb = 32000;
+const int kOpusBitrateNbBps = 12000;
+const int kOpusBitrateWbBps = 20000;
+const int kOpusBitrateFbBps = 32000;
// Opus bitrate should be in the range between 6000 and 510000.
-const int kOpusMinBitrate = 6000;
-const int kOpusMaxBitrate = 510000;
+const int kOpusMinBitrateBps = 6000;
+const int kOpusMaxBitrateBps = 510000;
// iSAC bitrate should be <= 56000.
-const int kIsacMaxBitrate = 56000;
+const int kIsacMaxBitrateBps = 56000;
// Default audio dscp value.
// See http://tools.ietf.org/html/rfc2474 for details.
@@ -222,18 +222,19 @@
}
if (bitrate <= 0) {
if (max_playback_rate <= 8000) {
- bitrate = kOpusBitrateNb;
+ bitrate = kOpusBitrateNbBps;
} else if (max_playback_rate <= 16000) {
- bitrate = kOpusBitrateWb;
+ bitrate = kOpusBitrateWbBps;
} else {
- bitrate = kOpusBitrateFb;
+ bitrate = kOpusBitrateFbBps;
}
if (IsCodecFeatureEnabled(codec, kCodecParamStereo)) {
bitrate *= 2;
}
- } else if (bitrate < kOpusMinBitrate || bitrate > kOpusMaxBitrate) {
- bitrate = (bitrate < kOpusMinBitrate) ? kOpusMinBitrate : kOpusMaxBitrate;
+ } else if (bitrate < kOpusMinBitrateBps || bitrate > kOpusMaxBitrateBps) {
+ bitrate = (bitrate < kOpusMinBitrateBps) ? kOpusMinBitrateBps
+ : kOpusMaxBitrateBps;
std::string rate_source =
use_param ? "Codec parameter \"maxaveragebitrate\"" :
"Supplied Opus bitrate";
@@ -478,9 +479,9 @@
};
const WebRtcVoiceCodecs::CodecPref WebRtcVoiceCodecs::kCodecPrefs[11] = {
- {kOpusCodecName, 48000, 2, 111, true, {10, 20, 40, 60}, kOpusMaxBitrate},
- {kIsacCodecName, 16000, 1, 103, true, {30, 60}, kIsacMaxBitrate},
- {kIsacCodecName, 32000, 1, 104, true, {30}, kIsacMaxBitrate},
+ {kOpusCodecName, 48000, 2, 111, true, {10, 20, 40, 60}, kOpusMaxBitrateBps},
+ {kIsacCodecName, 16000, 1, 103, true, {30, 60}, kIsacMaxBitrateBps},
+ {kIsacCodecName, 32000, 1, 104, true, {30}, kIsacMaxBitrateBps},
// G722 should be advertised as 8000 Hz because of the RFC "bug".
{kG722CodecName, 8000, 1, 9, false, {10, 20, 30, 40, 50, 60}},
{kIlbcCodecName, 8000, 1, 102, false, {20, 30, 40, 60}},
@@ -489,8 +490,7 @@
{kCnCodecName, 32000, 1, 106, false, {}},
{kCnCodecName, 16000, 1, 105, false, {}},
{kCnCodecName, 8000, 1, 13, false, {}},
- {kDtmfCodecName, 8000, 1, 126, false, {}}
-};
+ {kDtmfCodecName, 8000, 1, 126, false, {}}};
rtc::Optional<int> ComputeSendBitrate(int max_send_bitrate_bps,
int rtp_max_bitrate_bps,
@@ -1392,8 +1392,8 @@
"Enabled") {
// TODO(mflodman): Keep testing this and set proper values.
// Note: This is an early experiment currently only supported by Opus.
- config_.min_bitrate_kbps = kOpusMinBitrate;
- config_.max_bitrate_kbps = kOpusBitrateFb;
+ config_.min_bitrate_bps = kOpusMinBitrateBps;
+ config_.max_bitrate_bps = kOpusBitrateFbBps;
}
stream_ = call_->CreateAudioSendStream(config_);
RTC_CHECK(stream_);
diff --git a/webrtc/video/video_quality_test.cc b/webrtc/video/video_quality_test.cc
index c773e43..c80647d 100644
--- a/webrtc/video/video_quality_test.cc
+++ b/webrtc/video/video_quality_test.cc
@@ -46,8 +46,8 @@
constexpr int kPayloadTypeVP9 = 124;
constexpr size_t kMaxComparisons = 10;
constexpr char kSyncGroup[] = "av_sync";
-constexpr int kOpusMinBitrate = 6000;
-constexpr int kOpusBitrateFb = 32000;
+constexpr int kOpusMinBitrateBps = 6000;
+constexpr int kOpusBitrateFbBps = 32000;
struct VoiceEngineState {
VoiceEngineState()
@@ -1264,8 +1264,8 @@
audio_send_config_.rtp.extensions.push_back(
webrtc::RtpExtension(webrtc::RtpExtension::kTransportSequenceNumberUri,
test::kTransportSequenceNumberExtensionId));
- audio_send_config_.min_bitrate_kbps = kOpusMinBitrate / 1000;
- audio_send_config_.max_bitrate_kbps = kOpusBitrateFb / 1000;
+ audio_send_config_.min_bitrate_bps = kOpusMinBitrateBps;
+ audio_send_config_.max_bitrate_bps = kOpusBitrateFbBps;
}
audio_send_config_.send_codec_spec.codec_inst =
CodecInst{120, "OPUS", 48000, 960, 2, 64000};