bluez5: bap: no need to check for mtu, kernel fragments as needed

It's not necessary for ISO SDU to fit into the adapter MTU, as kernel
will fragment the packet as needed.

Remove MTU checks.
This commit is contained in:
Pauli Virtanen 2024-04-01 15:19:36 +03:00
parent d02cec53c6
commit b9ac79e99a

View file

@ -29,7 +29,6 @@ struct impl {
lc3_encoder_t enc[LC3_MAX_CHANNELS];
lc3_decoder_t dec[LC3_MAX_CHANNELS];
int mtu;
int samplerate;
int channels;
int frame_dus;
@ -466,7 +465,10 @@ static bool select_config(bap_lc3_t *conf, const struct pac_data *pac, struct sp
}
/*
* Select supported rate + frame length combination
* Select supported rate + frame length combination.
*
* Frame length is not limited by ISO MTU, as kernel will fragment
* and reassemble SDUs as needed.
*/
if (pac->sink && pac->duplex) {
/* 16KHz input is mandatory in BAP v1.0.1 Table 3.5, so prefer
@ -920,7 +922,6 @@ static void *codec_init(const struct media_codec *codec, uint32_t flags,
goto error;
}
this->mtu = mtu;
this->samplerate = config_info.info.raw.rate;
this->channels = config_info.info.raw.channels;
this->framelen = conf.framelen;
@ -940,13 +941,6 @@ static void *codec_init(const struct media_codec *codec, uint32_t flags,
spa_log_info(log, "LC3 rate:%d frame_duration:%d channels:%d framelen:%d nblks:%d",
this->samplerate, this->frame_dus, this->channels, this->framelen, conf.n_blks);
if (this->framelen * this->channels * conf.n_blks > this->mtu) {
spa_log_error(log, "too big LC3 frame length %u*%u*%u > %u",
this->framelen, this->channels, conf.n_blks, this->mtu);
res = -EINVAL;
goto error;
}
res = lc3_frame_samples(this->frame_dus, this->samplerate);
if (res < 0) {
spa_log_error(log, "invalid LC3 frame samples");
@ -1054,7 +1048,6 @@ static int codec_encode(void *data,
processed += this->codesize;
spa_assert(size <= this->mtu);
*need_flush = NEED_FLUSH_ALL;
return processed;