summaryrefslogtreecommitdiff
path: root/modules/opus
diff options
context:
space:
mode:
authorAlfred E. Heggestad <alfred.heggestad@gmail.com>2018-01-05 15:57:37 +0100
committerAlfred E. Heggestad <alfred.heggestad@gmail.com>2018-01-05 15:57:37 +0100
commit51111f4747355c0f15e62c5626a47d94fc92ccba (patch)
tree15ac77dfe1a4e20b1e02f97c1aed64fe7ce9c192 /modules/opus
parent4b4920f542554755b3fc7af5fddbfef801bd8d2e (diff)
audio: add function to set encoder bitrate
- auenc API updated with bitrate in bits/s - new command to set encoder bitrate: /aubitrate 128000
Diffstat (limited to 'modules/opus')
-rw-r--r--modules/opus/encode.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/modules/opus/encode.c b/modules/opus/encode.c
index 7ee1ca2..6723ac8 100644
--- a/modules/opus/encode.c
+++ b/modules/opus/encode.c
@@ -134,6 +134,10 @@ int opus_encode_update(struct auenc_state **aesp, const struct aucodec *ac,
fch = prm.stereo ? OPUS_AUTO : 1;
vbr = prm.cbr ? 0 : 1;
+ /* override local bitrate */
+ if (param && param->bitrate)
+ prm.bitrate = param->bitrate;
+
(void)opus_encoder_ctl(aes->enc,
OPUS_SET_MAX_BANDWIDTH(srate2bw(prm.srate)));
(void)opus_encoder_ctl(aes->enc, OPUS_SET_BITRATE(prm.bitrate));