mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-12-18 08:56:45 -05:00
bluez5: output silence if no data for some ISO sinks
When a sink contributing to an ISO CIG does not have data, output silence for it, as long as at least one sink in the CIG is running. Only if writes to sockets fail, pause all streams to reset synchronization. This way we write exactly the same number of packets for each CIS at the same time, which probably is the best tested configuration in BT adapters and devices. We also don't then have to pause output if some sinks are not running or miss their timing, as we generate silence on the fly. When using iso-io, have it initialize the codec instance, and have media-sink uses that instance, so that silence and actual audio are encoded with the same codec.
This commit is contained in:
parent
2d1b02b5a2
commit
9d7d3599db
4 changed files with 179 additions and 59 deletions
|
|
@ -9,6 +9,9 @@
|
|||
#include <spa/support/loop.h>
|
||||
#include <spa/support/log.h>
|
||||
#include <spa/node/io.h>
|
||||
#include <spa/param/audio/format.h>
|
||||
|
||||
struct spa_bt_transport;
|
||||
|
||||
/**
|
||||
* ISO I/O.
|
||||
|
|
@ -26,15 +29,19 @@ struct spa_bt_iso_io
|
|||
uint32_t timestamp; /**< Packet timestamp (set by pull callback) */
|
||||
uint8_t buf[4096]; /**< Packet data (set by pull callback) */
|
||||
size_t size; /**< Packet size (set by pull callback) */
|
||||
bool need_resync; /**< Resync requested (set by pull callback) */
|
||||
|
||||
struct spa_audio_info format; /**< Audio format */
|
||||
void *codec_data; /**< Codec data */
|
||||
|
||||
void *user_data;
|
||||
};
|
||||
|
||||
typedef void (*spa_bt_iso_io_pull_t)(struct spa_bt_iso_io *io);
|
||||
|
||||
struct spa_bt_iso_io *spa_bt_iso_io_create(int fd, bool sink, uint8_t cig, uint32_t interval,
|
||||
struct spa_bt_iso_io *spa_bt_iso_io_create(struct spa_bt_transport *t,
|
||||
struct spa_log *log, struct spa_loop *data_loop, struct spa_system *data_system);
|
||||
struct spa_bt_iso_io *spa_bt_iso_io_attach(struct spa_bt_iso_io *io, int fd, bool sink);
|
||||
struct spa_bt_iso_io *spa_bt_iso_io_attach(struct spa_bt_iso_io *io, struct spa_bt_transport *t);
|
||||
void spa_bt_iso_io_destroy(struct spa_bt_iso_io *io);
|
||||
void spa_bt_iso_io_set_cb(struct spa_bt_iso_io *io, spa_bt_iso_io_pull_t pull, void *user_data);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue