bluez5: bap: determine SDU interval from codec frame duration

BlueZ API as BAP Server gives us the ISO interval, instead of the SDU
interval, in the MediaTransport.QoS.Interval property.  They are not
necessarily the same. What we need is the SDU interval.

The SDU interval is the interval between packets the encoder outputs, so
it is determined by the codec configuration, and for LC3 is equal to the
frame duration.

Add codec method get_interval() that returns the correct interval, and
use it in iso-io.
This commit is contained in:
Pauli Virtanen 2024-04-01 17:26:35 +03:00
parent b9ac79e99a
commit 5ae0dfb239
5 changed files with 47 additions and 16 deletions

View file

@ -26,7 +26,7 @@
#define SPA_TYPE_INTERFACE_Bluez5CodecMedia SPA_TYPE_INFO_INTERFACE_BASE "Bluez5:Codec:Media:Private"
#define SPA_VERSION_BLUEZ5_CODEC_MEDIA 7
#define SPA_VERSION_BLUEZ5_CODEC_MEDIA 8
struct spa_bluez5_codec_a2dp {
struct spa_interface iface;
@ -81,8 +81,6 @@ struct media_codec {
const struct media_codec *duplex_codec; /**< Codec for non-standard A2DP duplex channel */
struct spa_log *log;
/** If fill_caps is NULL, no endpoint is registered (for sharing with another codec). */
int (*fill_caps) (const struct media_codec *codec, uint32_t flags,
uint8_t caps[A2DP_MAX_CAPS_SIZE]);
@ -126,6 +124,16 @@ struct media_codec {
/** Number of bytes needed for encoding */
int (*get_block_size) (void *data);
/**
* Duration of the next packet in nanoseconds.
*
* For BAP this shall be constant and equal to the SDU interval.
*
* \param data Codec data from init()
* \return Duration in nanoseconds.
*/
uint64_t (*get_interval) (void *data);
int (*abr_process) (void *data, size_t unsent);
/**