mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
bluez5: Init BAP LC3 coder/decoder depending on direction
For LE Audio, sink and source have their own media transport endpoint. Media sink or source only needs the coder or decoder respectively.
This commit is contained in:
parent
28b4fbecfb
commit
d4b639419a
3 changed files with 28 additions and 12 deletions
|
|
@ -586,17 +586,21 @@ static void *codec_init(const struct media_codec *codec, uint32_t flags,
|
|||
}
|
||||
this->codesize = this->samples * this->channels * sizeof(int32_t);
|
||||
|
||||
for (ich = 0; ich < this->channels; ich++) {
|
||||
this->enc[ich] = lc3_setup_encoder(this->frame_dus, this->samplerate, 0, calloc(1, lc3_encoder_size(this->frame_dus, this->samplerate)));
|
||||
if (this->enc[ich] == NULL) {
|
||||
res = -EINVAL;
|
||||
goto error;
|
||||
if (flags & MEDIA_CODEC_FLAG_SINK) {
|
||||
for (ich = 0; ich < this->channels; ich++) {
|
||||
this->enc[ich] = lc3_setup_encoder(this->frame_dus, this->samplerate, 0, calloc(1, lc3_encoder_size(this->frame_dus, this->samplerate)));
|
||||
if (this->enc[ich] == NULL) {
|
||||
res = -EINVAL;
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
|
||||
this->dec[ich] = lc3_setup_decoder(this->frame_dus, this->samplerate, 0, calloc(1, lc3_decoder_size(this->frame_dus, this->samplerate)));
|
||||
if (this->dec[ich] == NULL) {
|
||||
res = -EINVAL;
|
||||
goto error;
|
||||
} else {
|
||||
for (ich = 0; ich < this->channels; ich++) {
|
||||
this->dec[ich] = lc3_setup_decoder(this->frame_dus, this->samplerate, 0, calloc(1, lc3_decoder_size(this->frame_dus, this->samplerate)));
|
||||
if (this->dec[ich] == NULL) {
|
||||
res = -EINVAL;
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -931,6 +931,7 @@ static int do_start(struct impl *this)
|
|||
struct port *port;
|
||||
socklen_t len;
|
||||
uint8_t *conf;
|
||||
uint32_t flags;
|
||||
|
||||
if (this->started)
|
||||
return 0;
|
||||
|
|
@ -952,8 +953,13 @@ static int do_start(struct impl *this)
|
|||
spa_log_debug(this->log, "Transport configuration:");
|
||||
spa_log_hexdump(this->log, SPA_LOG_LEVEL_DEBUG, 2, conf, (size_t)size);
|
||||
|
||||
if (this->codec->bap)
|
||||
flags = MEDIA_CODEC_FLAG_SINK;
|
||||
else
|
||||
flags = this->is_duplex ? MEDIA_CODEC_FLAG_SINK : 0;
|
||||
|
||||
this->codec_data = this->codec->init(this->codec,
|
||||
this->is_duplex ? MEDIA_CODEC_FLAG_SINK : 0,
|
||||
flags,
|
||||
this->transport->configuration,
|
||||
this->transport->configuration_len,
|
||||
&port->current_format,
|
||||
|
|
|
|||
|
|
@ -619,6 +619,7 @@ static int transport_start(struct impl *this)
|
|||
{
|
||||
int res, val;
|
||||
struct port *port = &this->port;
|
||||
uint32_t flags;
|
||||
|
||||
if (this->transport_acquired)
|
||||
return 0;
|
||||
|
|
@ -630,8 +631,13 @@ static int transport_start(struct impl *this)
|
|||
|
||||
this->transport_acquired = true;
|
||||
|
||||
if (this->codec->bap)
|
||||
flags = 0;
|
||||
else
|
||||
flags = this->is_duplex ? 0 : MEDIA_CODEC_FLAG_SINK;
|
||||
|
||||
this->codec_data = this->codec->init(this->codec,
|
||||
this->is_duplex ? 0 : MEDIA_CODEC_FLAG_SINK,
|
||||
flags,
|
||||
this->transport->configuration,
|
||||
this->transport->configuration_len,
|
||||
&port->current_format,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue