diff --git a/spa/plugins/bluez5/a2dp-codec-aac.c b/spa/plugins/bluez5/a2dp-codec-aac.c index 4820214ee..46a87407b 100644 --- a/spa/plugins/bluez5/a2dp-codec-aac.c +++ b/spa/plugins/bluez5/a2dp-codec-aac.c @@ -610,7 +610,7 @@ static int codec_change_bitrate(struct impl *this, int new_bitrate) if (res != AACENC_OK) return -EINVAL; - return 0; + return this->cur_bitrate; } static int codec_reduce_bitpool(void *data) diff --git a/spa/plugins/bluez5/a2dp-codec-lc3plus.c b/spa/plugins/bluez5/a2dp-codec-lc3plus.c index d8e1d284e..289662442 100644 --- a/spa/plugins/bluez5/a2dp-codec-lc3plus.c +++ b/spa/plugins/bluez5/a2dp-codec-lc3plus.c @@ -747,15 +747,17 @@ static SPA_UNUSED int codec_decode(void *data, static int codec_reduce_bitpool(void *data) { struct impl *this = data; - this->e.next_bitrate = this->bitrate * 3 / 4; - return 0; + this->e.next_bitrate = SPA_CLAMP(this->bitrate * 3 / 4, + BITRATE_MIN * this->channels, BITRATE_MAX * this->channels); + return this->e.next_bitrate; } static int codec_increase_bitpool(void *data) { struct impl *this = data; - this->e.next_bitrate = this->bitrate * 5 / 4; - return 0; + this->e.next_bitrate = SPA_CLAMP(this->bitrate * 5 / 4, + BITRATE_MIN * this->channels, BITRATE_MAX * this->channels); + return this->e.next_bitrate; } const struct media_codec a2dp_codec_lc3plus_hr = {