Bluetooth: ISO: Introduce bt_iso_chan_send_ts
The bt_iso_chan_send function could take an optional timestamp by using 0 as an indicator. The issue with this approach was that a timestamp value of 0 is valid, and could cause potential issue with syncing streams in a group. To fully support transmitting with and without timestamp, bt_iso_chan_send_ts has been introduced, which is the only function of the two (bt_iso_chan_send being the other) that supports timestamps. A new function, rather than adding a boolean to the existing, was chosen as it simplifies the individual functions as well as making it more explicit what the function does. Since the bt_iso_chan_send function is used by LE audio, both the BAP and CAP send functions have similarly been updated. Likewise, all tests and samples have been updated to use the updated function(s), and BT_ISO_TIMESTAMP_NONE has been removed. Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
This commit is contained in:
parent
5db338c035
commit
3e634268d6
32 changed files with 203 additions and 113 deletions
|
@ -198,7 +198,7 @@ static void send_data(struct broadcast_source_stream *source_stream)
|
|||
net_buf_add_mem(buf, send_pcm_data, preset_active.qos.sdu);
|
||||
#endif /* defined(CONFIG_LIBLC3) */
|
||||
|
||||
ret = bt_bap_stream_send(stream, buf, source_stream->seq_num++, BT_ISO_TIMESTAMP_NONE);
|
||||
ret = bt_bap_stream_send(stream, buf, source_stream->seq_num++);
|
||||
if (ret < 0) {
|
||||
/* This will end broadcasting on this stream. */
|
||||
printk("Unable to broadcast data on %p: %d\n", stream, ret);
|
||||
|
|
|
@ -64,7 +64,7 @@ static void iso_timer_timeout(struct k_work *work)
|
|||
|
||||
net_buf_add_mem(buf, buf_data, len_to_send);
|
||||
|
||||
ret = bt_iso_chan_send(&iso_chan, buf, seq_num++, BT_ISO_TIMESTAMP_NONE);
|
||||
ret = bt_iso_chan_send(&iso_chan, buf, seq_num++);
|
||||
|
||||
if (ret < 0) {
|
||||
printk("Failed to send ISO data (%d)\n", ret);
|
||||
|
|
|
@ -159,9 +159,7 @@ static void audio_timer_timeout(struct k_work *work)
|
|||
|
||||
net_buf_add_mem(buf, buf_data, len_to_send);
|
||||
|
||||
ret = bt_bap_stream_send(stream, buf,
|
||||
get_and_incr_seq_num(stream),
|
||||
BT_ISO_TIMESTAMP_NONE);
|
||||
ret = bt_bap_stream_send(stream, buf, get_and_incr_seq_num(stream));
|
||||
if (ret < 0) {
|
||||
printk("Failed to send audio data on streams[%zu] (%p): (%d)\n",
|
||||
i, stream, ret);
|
||||
|
|
|
@ -171,8 +171,7 @@ int main(void)
|
|||
net_buf_reserve(buf, BT_ISO_CHAN_SEND_RESERVE);
|
||||
sys_put_le32(iso_send_count, iso_data);
|
||||
net_buf_add_mem(buf, iso_data, sizeof(iso_data));
|
||||
ret = bt_iso_chan_send(&bis_iso_chan[chan], buf,
|
||||
seq_num, BT_ISO_TIMESTAMP_NONE);
|
||||
ret = bt_iso_chan_send(&bis_iso_chan[chan], buf, seq_num);
|
||||
if (ret < 0) {
|
||||
printk("Unable to broadcast data on channel %u"
|
||||
" : %d", chan, ret);
|
||||
|
|
|
@ -593,8 +593,7 @@ static void iso_timer_timeout(struct k_work *work)
|
|||
|
||||
net_buf_reserve(buf, BT_ISO_CHAN_SEND_RESERVE);
|
||||
net_buf_add_mem(buf, iso_data, iso_tx_qos.sdu);
|
||||
ret = bt_iso_chan_send(&bis_iso_chans[i], buf, seq_num,
|
||||
BT_ISO_TIMESTAMP_NONE);
|
||||
ret = bt_iso_chan_send(&bis_iso_chans[i], buf, seq_num);
|
||||
if (ret < 0) {
|
||||
LOG_ERR("Unable to broadcast data: %d", ret);
|
||||
net_buf_unref(buf);
|
||||
|
|
|
@ -207,8 +207,7 @@ static void iso_send(struct bt_iso_chan *chan)
|
|||
net_buf_reserve(buf, BT_ISO_CHAN_SEND_RESERVE);
|
||||
net_buf_add_mem(buf, iso_data, iso_tx_qos.sdu);
|
||||
|
||||
ret = bt_iso_chan_send(chan, buf, chan_work->seq_num++,
|
||||
BT_ISO_TIMESTAMP_NONE);
|
||||
ret = bt_iso_chan_send(chan, buf, chan_work->seq_num++);
|
||||
if (ret < 0) {
|
||||
LOG_ERR("Unable to send data: %d", ret);
|
||||
net_buf_unref(buf);
|
||||
|
|
|
@ -104,7 +104,7 @@ static void broadcast_sent_cb(struct bt_bap_stream *stream)
|
|||
|
||||
net_buf_reserve(buf, BT_ISO_CHAN_SEND_RESERVE);
|
||||
net_buf_add_mem(buf, mock_data, broadcast_preset_48_2_1.qos.sdu);
|
||||
ret = bt_bap_stream_send(stream, buf, seq_num++, BT_ISO_TIMESTAMP_NONE);
|
||||
ret = bt_bap_stream_send(stream, buf, seq_num++);
|
||||
if (ret < 0) {
|
||||
/* This will end broadcasting on this stream. */
|
||||
net_buf_unref(buf);
|
||||
|
|
|
@ -93,7 +93,7 @@ static void broadcast_sent_cb(struct bt_bap_stream *stream)
|
|||
|
||||
net_buf_reserve(buf, BT_ISO_CHAN_SEND_RESERVE);
|
||||
net_buf_add_mem(buf, mock_data, broadcast_preset_48_2_1.qos.sdu);
|
||||
ret = bt_bap_stream_send(stream, buf, seq_num++, BT_ISO_TIMESTAMP_NONE);
|
||||
ret = bt_bap_stream_send(stream, buf, seq_num++);
|
||||
if (ret < 0) {
|
||||
/* This will end broadcasting on this stream. */
|
||||
net_buf_unref(buf);
|
||||
|
|
|
@ -387,7 +387,7 @@ static void audio_timer_timeout(struct k_work *work)
|
|||
net_buf_add_mem(buf, buf_data, len_to_send);
|
||||
buf_to_send = buf;
|
||||
|
||||
ret = bt_bap_stream_send(stream, buf_to_send, 0, BT_ISO_TIMESTAMP_NONE);
|
||||
ret = bt_bap_stream_send(stream, buf_to_send, 0);
|
||||
if (ret < 0) {
|
||||
printk("Failed to send audio data on streams: (%d)\n", ret);
|
||||
net_buf_unref(buf_to_send);
|
||||
|
|
|
@ -206,9 +206,7 @@ static void lc3_audio_timer_timeout(struct k_work *work)
|
|||
buf_to_send = net_buf_clone(buf, K_FOREVER);
|
||||
}
|
||||
|
||||
ret = bt_bap_stream_send(stream, buf_to_send,
|
||||
get_and_incr_seq_num(stream),
|
||||
BT_ISO_TIMESTAMP_NONE);
|
||||
ret = bt_bap_stream_send(stream, buf_to_send, get_and_incr_seq_num(stream));
|
||||
if (ret < 0) {
|
||||
printk(" Failed to send LC3 audio data on streams[%zu] (%d)\n",
|
||||
i, ret);
|
||||
|
@ -337,9 +335,7 @@ static void audio_timer_timeout(struct k_work *work)
|
|||
buf_to_send = net_buf_clone(buf, K_FOREVER);
|
||||
}
|
||||
|
||||
ret = bt_bap_stream_send(stream, buf_to_send,
|
||||
get_and_incr_seq_num(stream),
|
||||
BT_ISO_TIMESTAMP_NONE);
|
||||
ret = bt_bap_stream_send(stream, buf_to_send, get_and_incr_seq_num(stream));
|
||||
if (ret < 0) {
|
||||
printk("Failed to send audio data on streams[%zu]: (%d)\n",
|
||||
i, ret);
|
||||
|
|
|
@ -218,9 +218,7 @@ static void audio_timer_timeout(struct k_work *work)
|
|||
|
||||
net_buf_add_mem(buf, buf_data, ++source_streams[i].len_to_send);
|
||||
|
||||
ret = bt_bap_stream_send(stream, buf,
|
||||
get_and_incr_seq_num(stream),
|
||||
BT_ISO_TIMESTAMP_NONE);
|
||||
ret = bt_bap_stream_send(stream, buf, get_and_incr_seq_num(stream));
|
||||
if (ret < 0) {
|
||||
printk("Failed to send audio data on streams[%zu] (%p): (%d)\n",
|
||||
i, stream, ret);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue