Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FEAT(client, ui): Allow for max bitrate in client #5994

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 28 additions & 7 deletions src/mumble/AudioConfigDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,19 @@

#include <QSignalBlocker>

#include <cmath>

const QString AudioOutputDialog::name = QLatin1String("AudioOutputWidget");
const QString AudioInputDialog::name = QLatin1String("AudioInputWidget");

constexpr int bitrateToLog(int bitrate) {
return std::log10(static_cast< float >(bitrate)) * 100;
}

constexpr int logToBitrate(int log) {
return std::pow(10, static_cast< float >(log) / 100);
}


static ConfigWidget *AudioInputDialogNew(Settings &st) {
return new AudioInputDialog(st);
Expand Down Expand Up @@ -146,7 +156,7 @@ void AudioInputDialog::load(const Settings &r) {
loadCheckBox(qcbPushWindow, r.bShowPTTButtonWindow);
loadCheckBox(qcbPushClick, r.bTxAudioCue);
loadCheckBox(qcbMuteCue, r.bTxMuteCue);
loadSlider(qsQuality, r.iQuality);
loadSlider(qsQuality, bitrateToLog(r.iQuality));
loadCheckBox(qcbAllowLowDelay, r.bAllowLowDelay);
if (r.iSpeexNoiseCancelStrength != 0) {
loadSlider(qsSpeexNoiseSupStrength, -r.iSpeexNoiseCancelStrength);
Expand Down Expand Up @@ -236,7 +246,7 @@ void AudioInputDialog::verifyMicrophonePermission() {
}

void AudioInputDialog::save() const {
s.iQuality = qsQuality->value();
s.iQuality = qsbQuality->value() * 1000;
s.bAllowLowDelay = qcbAllowLowDelay->isChecked();
s.iSpeexNoiseCancelStrength = (qsSpeexNoiseSupStrength->value() == 14) ? 0 : -qsSpeexNoiseSupStrength->value();

Expand Down Expand Up @@ -312,8 +322,21 @@ void AudioInputDialog::on_qsTransmitHold_valueChanged(int v) {
qlTransmitHold->setText(tr("%1 s").arg(val, 0, 'f', 2));
}

void AudioInputDialog::on_qsQuality_valueChanged(int v) {
qlQuality->setText(tr("%1 kb/s").arg(static_cast< float >(v) / 1000.0f, 0, 'f', 1));
void AudioInputDialog::on_qsQuality_valueChanged(int logValue) {
QSignalBlocker blocker(qsbQuality);

// Note: qsQuality is in b/s whereas qsbQuality is in kb/s
qsbQuality->setValue(static_cast< float >(logToBitrate(logValue)) / 1000);

updateBitrate();
}

void AudioInputDialog::on_qsbQuality_valueChanged(double bitrate) {
QSignalBlocker blocker(qsQuality);

// Note: qsQuality is in b/s whereas qsbQuality is in kb/s
qsQuality->setValue(bitrateToLog(bitrate * 1000));

updateBitrate();
}

Expand All @@ -338,7 +361,7 @@ void AudioInputDialog::on_qsAmp_valueChanged(int v) {
void AudioInputDialog::updateBitrate() {
if (!qsQuality || !qsFrames || !qlBitrate)
return;
int q = qsQuality->value();
int q = qsbQuality->value() * 1000;
int p = qsFrames->value();

int audiorate, overhead, posrate;
Expand Down Expand Up @@ -379,8 +402,6 @@ void AudioInputDialog::updateBitrate() {
.arg(posrate / 1000.0, 0, 'f', 1);

qlBitrate->setText(v);

qsQuality->setMinimum(8000);
}

void AudioInputDialog::on_qcbPushClick_clicked(bool b) {
Expand Down
1 change: 1 addition & 0 deletions src/mumble/AudioConfigDialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ public slots:
void on_qsTransmitHold_valueChanged(int v);
void on_qsFrames_valueChanged(int v);
void on_qsQuality_valueChanged(int v);
void on_qsbQuality_valueChanged(double v);
void on_qsAmp_valueChanged(int v);
void on_qsDoublePush_valueChanged(int v);
void on_qsPTTHold_valueChanged(int v);
Expand Down
139 changes: 71 additions & 68 deletions src/mumble/AudioInput.ui
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>588</width>
<height>953</height>
<width>592</width>
<height>961</height>
</rect>
</property>
<property name="windowTitle">
Expand Down Expand Up @@ -447,44 +447,33 @@
<property name="title">
<string>Compression</string>
</property>
<layout class="QGridLayout">
<item row="1" column="0">
<widget class="QLabel" name="qliFrames">
<property name="text">
<string>Audio per packet</string>
</property>
<property name="buddy">
<cstring>qsFrames</cstring>
<layout class="QGridLayout" rowstretch="0,0,0,0" columnstretch="0,0,0,0">
<item row="3" column="0" colspan="4">
<widget class="QLabel" name="qlBitrate">
<property name="font">
<font>
<italic>true</italic>
</font>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QSlider" name="qsFrames">
<property name="toolTip">
<string>How many audio frames to send per packet</string>
<string>Maximum bandwidth used for sending audio</string>
</property>
<property name="whatsThis">
<string>&lt;b&gt;This selects how many audio frames should be put in one packet.&lt;/b&gt;&lt;br /&gt;Increasing this will increase the latency of your voice, but will also reduce bandwidth requirements.</string>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>4</number>
<string>&lt;b&gt;This shows peak outgoing bandwidth used.&lt;/b&gt;&lt;br /&gt;This shows the peak amount of bandwidth sent out from your machine. Audio bitrate is the maximum bitrate (as we use VBR) for the audio data alone. Position is the bitrate used for positional information. Overhead is our framing and the IP packet headers (IP and UDP is 75% of this overhead).</string>
</property>
<property name="pageStep">
<number>2</number>
<property name="text">
<string/>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QLabel" name="qlQuality">
<item row="1" column="3">
<widget class="QLabel" name="qlFrames">
<property name="minimumSize">
<size>
<width>30</width>
<width>40</width>
<height>0</height>
</size>
</property>
Expand All @@ -493,16 +482,16 @@
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QLabel" name="qlFrames">
<property name="minimumSize">
<size>
<width>40</width>
<height>0</height>
</size>
<item row="2" column="0" colspan="2">
<widget class="QCheckBox" name="qcbAllowLowDelay">
<property name="toolTip">
<string>Enable Opus' low-delay mode when the quality is set to &lt;b&gt;64 kb/s&lt;/b&gt; or higher. </string>
</property>
<property name="whatsThis">
<string>If checked, Mumble will enable Opus' low-delay mode when the quality is set to &lt;b&gt;64 kbit/s&lt;/b&gt; or higher. Low-delay mode decreases latency by &lt;b&gt;~15 milliseconds&lt;/b&gt; in the round trip. This mode may require an higher bitrate to preserve the same quality, in comparison with the music and VOIP modes.</string>
</property>
<property name="text">
<string/>
<string>Allow low delay mode</string>
</property>
</widget>
</item>
Expand All @@ -515,66 +504,80 @@
<string>&lt;b&gt;This sets the quality of compression.&lt;/b&gt;&lt;br /&gt;This determines how much bandwidth Mumble is allowed to use for outgoing audio.</string>
</property>
<property name="minimum">
<number>8000</number>
<number>390</number>
</property>
<property name="maximum">
<number>192000</number>
<number>571</number>
</property>
<property name="singleStep">
<number>1000</number>
<number>1</number>
</property>
<property name="pageStep">
<number>5000</number>
<number>20</number>
</property>
<property name="value">
<number>32000</number>
<number>390</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="3" column="0" colspan="3">
<widget class="QLabel" name="qlBitrate">
<property name="font">
<font>
<italic>true</italic>
</font>
</property>
<property name="toolTip">
<string>Maximum bandwidth used for sending audio</string>
</property>
<property name="whatsThis">
<string>&lt;b&gt;This shows peak outgoing bandwidth used.&lt;/b&gt;&lt;br /&gt;This shows the peak amount of bandwidth sent out from your machine. Audio bitrate is the maximum bitrate (as we use VBR) for the audio data alone. Position is the bitrate used for positional information. Overhead is our framing and the IP packet headers (IP and UDP is 75% of this overhead).</string>
</property>
<item row="0" column="0">
<widget class="QLabel" name="qliQuality">
<property name="text">
<string/>
<string>&amp;Quality</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
<property name="buddy">
<cstring>qsQuality</cstring>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="qliQuality">
<item row="1" column="0">
<widget class="QLabel" name="qliFrames">
<property name="text">
<string>&amp;Quality</string>
<string>Audio per packet</string>
</property>
<property name="buddy">
<cstring>qsQuality</cstring>
<cstring>qsFrames</cstring>
</property>
</widget>
</item>
<item row="2" column="0" colspan="2">
<widget class="QCheckBox" name="qcbAllowLowDelay">
<item row="1" column="1">
<widget class="QSlider" name="qsFrames">
<property name="toolTip">
<string>Enable Opus' low-delay mode when the quality is set to &lt;b&gt;64 kb/s&lt;/b&gt; or higher. </string>
<string>How many audio frames to send per packet</string>
</property>
<property name="whatsThis">
<string>If checked, Mumble will enable Opus' low-delay mode when the quality is set to &lt;b&gt;64 kbit/s&lt;/b&gt; or higher. Low-delay mode decreases latency by &lt;b&gt;~15 milliseconds&lt;/b&gt; in the round trip. This mode may require an higher bitrate to preserve the same quality, in comparison with the music and VOIP modes.</string>
<string>&lt;b&gt;This selects how many audio frames should be put in one packet.&lt;/b&gt;&lt;br /&gt;Increasing this will increase the latency of your voice, but will also reduce bandwidth requirements.</string>
</property>
<property name="text">
<string>Allow low delay mode</string>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>4</number>
</property>
<property name="pageStep">
<number>2</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QDoubleSpinBox" name="qsbQuality">
<property name="suffix">
<string> kb/s</string>
</property>
<property name="decimals">
<number>1</number>
</property>
<property name="minimum">
<double>8.000000000000000</double>
</property>
<property name="maximum">
<double>510.000000000000000</double>
</property>
</widget>
</item>
Expand Down
8 changes: 4 additions & 4 deletions src/mumble/mumble_ar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1032,6 +1032,10 @@ This value allows you to set the maximum number of users allowed in the channel.
<source>Pre&amp;view</source>
<translation type="unfinished"></translation>
</message>
<message>
<source> kb/s</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>AudioInputDialog</name>
Expand Down Expand Up @@ -1063,10 +1067,6 @@ This value allows you to set the maximum number of users allowed in the channel.
<source>%1 s</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>%1 kb/s</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>-%1 dB</source>
<translation type="unfinished"></translation>
Expand Down
8 changes: 4 additions & 4 deletions src/mumble/mumble_bg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1033,6 +1033,10 @@ This value allows you to set the maximum number of users allowed in the channel.
<source>Pre&amp;view</source>
<translation type="unfinished"></translation>
</message>
<message>
<source> kb/s</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>AudioInputDialog</name>
Expand Down Expand Up @@ -1064,10 +1068,6 @@ This value allows you to set the maximum number of users allowed in the channel.
<source>%1 s</source>
<translation>%1 с</translation>
</message>
<message>
<source>%1 kb/s</source>
<translation>%1 кб/с</translation>
</message>
<message>
<source>-%1 dB</source>
<translation>-%1 дБ</translation>
Expand Down
8 changes: 4 additions & 4 deletions src/mumble/mumble_br.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1032,6 +1032,10 @@ This value allows you to set the maximum number of users allowed in the channel.
<source>Pre&amp;view</source>
<translation type="unfinished"></translation>
</message>
<message>
<source> kb/s</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>AudioInputDialog</name>
Expand Down Expand Up @@ -1063,10 +1067,6 @@ This value allows you to set the maximum number of users allowed in the channel.
<source>%1 s</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>%1 kb/s</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>-%1 dB</source>
<translation type="unfinished"></translation>
Expand Down
8 changes: 4 additions & 4 deletions src/mumble/mumble_ca.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1040,6 +1040,10 @@ Aquest valor us permet establir el nombre màxim d&apos;usuaris permesos al cana
<source>Pre&amp;view</source>
<translation>Pre&amp;visualitza</translation>
</message>
<message>
<source> kb/s</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>AudioInputDialog</name>
Expand Down Expand Up @@ -1071,10 +1075,6 @@ Aquest valor us permet establir el nombre màxim d&apos;usuaris permesos al cana
<source>%1 s</source>
<translation>%1 s</translation>
</message>
<message>
<source>%1 kb/s</source>
<translation>%1 kb/s</translation>
</message>
<message>
<source>-%1 dB</source>
<translation>-%1 dB</translation>
Expand Down
Loading