diff --git a/spa/plugins/bluez5/a2dp-codec-opus.c b/spa/plugins/bluez5/a2dp-codec-opus.c index efcc10023..21ede7d34 100644 --- a/spa/plugins/bluez5/a2dp-codec-opus.c +++ b/spa/plugins/bluez5/a2dp-codec-opus.c @@ -497,7 +497,7 @@ static int get_mapping(const struct media_codec *codec, const a2dp_opus_05_direc bool use_surround_encoder, uint8_t *streams_ret, uint8_t *coupled_streams_ret, const uint8_t **surround_mapping, uint32_t *positions) { - const uint8_t channels = conf->channels; + const uint32_t channels = conf->channels; const uint32_t location = OPUS_05_GET_LOCATION(*conf); const uint8_t coupled_streams = conf->coupled_streams; const uint8_t *permutation = NULL; @@ -561,7 +561,7 @@ static int codec_fill_caps(const struct media_codec *codec, uint32_t flags, a2dp_opus_05_t a2dp_opus_05 = { .info = codec->vendor, .main = { - .channels = SPA_AUDIO_MAX_CHANNELS, + .channels = SPA_MIN(255u, SPA_AUDIO_MAX_CHANNELS), .frame_duration = (OPUS_05_FRAME_DURATION_25 | OPUS_05_FRAME_DURATION_50 | OPUS_05_FRAME_DURATION_100 | @@ -571,7 +571,7 @@ static int codec_fill_caps(const struct media_codec *codec, uint32_t flags, OPUS_05_INIT_BITRATE(0) }, .bidi = { - .channels = SPA_AUDIO_MAX_CHANNELS, + .channels = SPA_MIN(255u, SPA_AUDIO_MAX_CHANNELS), .frame_duration = (OPUS_05_FRAME_DURATION_25 | OPUS_05_FRAME_DURATION_50 | OPUS_05_FRAME_DURATION_100 | diff --git a/spa/plugins/bluez5/bap-codec-lc3.c b/spa/plugins/bluez5/bap-codec-lc3.c index 144b8a0fd..818f4ee36 100644 --- a/spa/plugins/bluez5/bap-codec-lc3.c +++ b/spa/plugins/bluez5/bap-codec-lc3.c @@ -903,7 +903,7 @@ static int codec_caps_preference_cmp(const struct media_codec *codec, uint32_t f static uint8_t channels_to_positions(uint32_t channels, uint32_t *position) { - uint8_t n_channels = get_channel_count(channels); + uint32_t n_channels = get_channel_count(channels); uint8_t n_positions = 0; spa_assert(n_channels <= SPA_AUDIO_MAX_CHANNELS);