Bluetooth: ISO: Add sequence number to ISO data packets

The sequence number is needed in the appliaction layer to detect lost
packets in the ISO stream in cases where the timestamp is not included.
(Sequence number is mandatory to include where timestamp is optional).
The API for the public metadata have been moved to a public header file.

As the size of the ISO meta data exceeds the default 4 octets net_buf
user_data the public ISO metadata have been moved into a seperate array.
The internal metadata is still stored in net_buf user_data.

This also fixed the user_data overflow on 32 bit systems, caused by
writing the ts into user_data on index 4 to 7, which is outside the 4
allocated bytes.

Signed-off-by: Casper Bonde <casper_bonde@bose.com>
This commit is contained in:
Casper Bonde 2021-03-29 10:00:44 +02:00 committed by Carles Cufí
commit 04dfcba792
6 changed files with 33 additions and 13 deletions

View file

@ -138,6 +138,15 @@ struct bt_iso_chan_path {
uint8_t cc[0];
};
/** @brief ISO Meta Data structure for received ISO packets. */
struct bt_iso_recv_info {
/** ISO timestamp - valid only if the Bluetooth controller includes it */
uint32_t ts;
/** ISO Pkt Seq no of the first fragment in the SDU */
uint16_t sn;
};
/** Opaque type representing an Broadcast Isochronous Group (BIG). */
struct bt_iso_big;
@ -271,8 +280,13 @@ struct bt_iso_chan_ops {
*
* @param chan The channel receiving data.
* @param buf Buffer containing incoming data.
* @param info Pointer to the metadata for the buffer. The lifetime of the
* pointer is linked to the lifetime of the net_buf.
* Metadata such as sequence number and timestamp can be
* provided by the bluetooth controller.
*/
void (*recv)(struct bt_iso_chan *chan, struct net_buf *buf);
void (*recv)(struct bt_iso_chan *chan, const struct bt_iso_recv_info *info,
struct net_buf *buf);
};
/** @brief ISO Server structure. */