Skip to content

Conversation

@Thalley
Copy link
Contributor

@Thalley Thalley commented Feb 6, 2024

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.

Fixes #68293

@Thalley
Copy link
Contributor Author

Thalley commented Feb 6, 2024

For reviewers: The alternative would have been something like

bt_iso_chan_send(struct bt_iso_chan *chan, struct net_buf *buf, uint16_t seq_num,
		 uint32_t ts, bool has_ts)

@Thalley Thalley added the bug The issue is a bug, or the PR is fixing a bug label Feb 6, 2024
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>
@fabiobaltieri fabiobaltieri added this to the v3.7.0 milestone Feb 7, 2024
*/
int bt_iso_chan_send(struct bt_iso_chan *chan, struct net_buf *buf,
uint16_t seq_num, uint32_t ts);
int bt_iso_chan_send_ts(struct bt_iso_chan *chan, struct net_buf *buf, uint16_t seq_num,
Copy link
Contributor

@koffes koffes Feb 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would advise that we consider the naming.
As it stands now, there is a risk that developers will find the vanilla bt_iso_chan_send and not be aware of the huge benefits bt_iso_chan_send_ts has.

Suggest:
bt_iso_chan_send_no_ts or bt_iso_chan_send_ts_none along side bt_iso_chan_send_ts.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I see your point, although it seems weird to mention what is omitted in the function name. This would be similar to having a negated flag - for example the HCI ISO data packet sets a flag if the TS is included. Your suggestion would be similar to setting a flag when it was not included.

I suggest that we keep it as is for 2 reasons:

  1. None of our samples or tests have been using TS, so it's clearly not widely used (and not the default)
  2. Omitting ts from the non-TS version is more aligned with the core spec in terms of setting the flag when it is there

Copy link
Contributor

@koffes koffes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only a comment/question on naming.

@Thalley
Copy link
Contributor Author

Thalley commented Feb 8, 2024

@fabiobaltieri Should this not have the 3.6 milestone? It fixes a bug

@fabiobaltieri fabiobaltieri modified the milestones: v3.7.0, v3.6.0 Feb 8, 2024
@fabiobaltieri
Copy link
Member

@fabiobaltieri Should this not have the 3.6 milestone? It fixes a bug

Yeah probably, IIRC I was batch triaging, read the title "introduce XXXX", sounded like a feature and hit the 3.7 tag -- but it still got your attention so in the end it worked out :-)

Feel free to tag these yourself, I periodically go through approved+untagged and take a guess or ask but if you tag them for us it's going to make everyone's life easier.

@henrikbrixandersen
Copy link
Member

@jhedberg Please review.

@jhedberg
Copy link
Member

@jhedberg Please review.

Approved. I generally don't pay much attention to Bluetooth Audio PRs, since that's @Thalley 's area of responsibility, but I now noticed that this one was assigned to me for some reason.

@Thalley
Copy link
Contributor Author

Thalley commented Feb 12, 2024

@jhedberg Please review.

Approved. I generally don't pay much attention to Bluetooth Audio PRs, since that's @Thalley 's area of responsibility, but I now noticed that this one was assigned to me for some reason.

That is because this is (mainly) ISO, which is under the host directory, and not Audio specific :)

@Thalley Thalley requested a review from koffes February 12, 2024 12:09
@henrikbrixandersen henrikbrixandersen merged commit 3e63426 into zephyrproject-rtos:main Feb 12, 2024
@Thalley Thalley deleted the iso_ts_send_fix branch February 12, 2024 12:15
kartben added a commit to kartben/zephyr that referenced this pull request Dec 4, 2025
Last activity: 18 months ago (review)

Recent activities:
  - review: Review on 'Bluetooth: Audio: Shell: Fix build errors for USB=n'
    zephyrproject-rtos#72733
    (2024-05-16T06:13:15Z)
  - review: Review on 'Bluetooth: ISO: Introduce bt_iso_chan_send_ts'
    zephyrproject-rtos#68611
    (2024-02-07T07:53:39Z)
  - review: Review on 'Bluetooth: BAP: Fix issue with setting invalid iso
  data path'
    zephyrproject-rtos#67835
    (2024-01-22T10:15:03Z)

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: Bluetooth Audio area: Bluetooth Controller area: Bluetooth Host Bluetooth Host (excluding BR/EDR) area: Bluetooth area: Samples Samples bug The issue is a bug, or the PR is fixing a bug Release Notes To be mentioned in the release notes

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

LE Audio: it is not possible to provide SDUs with a timestamp of zero.