From cc4e5a89b4742a8c7f3b7612857653dbb874dbd2 Mon Sep 17 00:00:00 2001 From: Pauli Virtanen Date: Sun, 23 Oct 2022 16:50:03 +0300 Subject: [PATCH] bluez5: fix BAP codec sink flag usage MEDIA_CODEC_FLAG_SINK means the local endpoint is sink. Have this the same way for BAP, no need to invert it. --- spa/plugins/bluez5/bap-codec-lc3.c | 2 +- spa/plugins/bluez5/media-sink.c | 5 +---- spa/plugins/bluez5/media-source.c | 5 +---- 3 files changed, 3 insertions(+), 9 deletions(-) diff --git a/spa/plugins/bluez5/bap-codec-lc3.c b/spa/plugins/bluez5/bap-codec-lc3.c index fdecb0203..7a7b3a6a6 100644 --- a/spa/plugins/bluez5/bap-codec-lc3.c +++ b/spa/plugins/bluez5/bap-codec-lc3.c @@ -605,7 +605,7 @@ static void *codec_init(const struct media_codec *codec, uint32_t flags, } this->codesize = this->samples * this->channels * sizeof(int32_t); - if (flags & MEDIA_CODEC_FLAG_SINK) { + 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) { diff --git a/spa/plugins/bluez5/media-sink.c b/spa/plugins/bluez5/media-sink.c index 7e6e3c437..7b4a2c791 100644 --- a/spa/plugins/bluez5/media-sink.c +++ b/spa/plugins/bluez5/media-sink.c @@ -930,10 +930,7 @@ 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; + flags = this->is_duplex ? MEDIA_CODEC_FLAG_SINK : 0; this->codec_data = this->codec->init(this->codec, flags, diff --git a/spa/plugins/bluez5/media-source.c b/spa/plugins/bluez5/media-source.c index 62344ed8d..7d183fd60 100644 --- a/spa/plugins/bluez5/media-source.c +++ b/spa/plugins/bluez5/media-source.c @@ -636,10 +636,7 @@ 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; + flags = this->is_duplex ? 0 : MEDIA_CODEC_FLAG_SINK; this->codec_data = this->codec->init(this->codec, flags,