mbox series

[BlueZ,v2,0/6] Add support for BAP broadcast sink

Message ID 20230712122135.7734-1-claudia.rosu@nxp.com
Headers show
Series Add support for BAP broadcast sink | expand

Message

Claudia Draghicescu July 12, 2023, 12:21 p.m. UTC
This series of patches adds support for BAP broadcast sink.
It consists in registering a sink endpoint using the Sink PAC UUID,
discovering of broadcast advertisers that announce the
Broadcast Audio Announcement service, synchronizes to the Periodic
advertisements of the source and synchronizes to the BIG advertised
in the PA train.
To retrieve the BASE info advertised in the PA train, the patch
Bluetooth: ISO: Add support for periodic adv reports processing
was used.

This feature was tested using bluetoothctl with the following commands:

[bluetooth]# endpoint.register 00002bc9-0000-1000-8000-00805f9b34fb 0x06
[/local/endpoint/ep0] Auto Accept (yes/no): y
[/local/endpoint/ep0] Max Transports (auto/value): a
[/local/endpoint/ep0] unicast/broadcast (u/b): b
[/local/endpoint/ep0] BIG (auto/value): a
[/local/endpoint/ep0] BIS (auto/value): a

[bluetooth]# scan on

[bluetooth]# endpoint.config /org/bluez/hci0/pac_bcast0
/local/endpoint/ep0 16_2_1 <source_address>

Claudia Draghicescu (6):
  client/player: Add broadcast sink endpoint registration and
    configuration.
  client/main: Add broadcast source discovery
  media: Add support for a broadcast sink media endpoint
  transport: Update transport properties for a broadcast stream
  btio: Add support for getsockopt(BT_ISO_BASE)
  bap: Add gdbus interface for BAP broadcast sink, create
    synchronization with source and create BAP broadcast sink stream

 btio/btio.c                |  13 +-
 client/main.c              |  57 +++++-
 client/player.c            | 187 +++++++++++++++++++-
 client/player.h            |   3 +
 profiles/audio/bap.c       | 347 ++++++++++++++++++++++++++++++++++---
 profiles/audio/media.c     |  35 +++-
 profiles/audio/media.h     |   2 +-
 profiles/audio/transport.c | 244 +++++++++++++++++++++++++-
 src/shared/bap.c           |  50 +++++-
 src/shared/bap.h           |   4 +-
 10 files changed, 888 insertions(+), 54 deletions(-)


base-commit: 838e1578072900d1f98dfb31cc538940d2fad876

Comments

Luiz Augusto von Dentz July 12, 2023, 5:45 p.m. UTC | #1
Hi Claudia,

On Wed, Jul 12, 2023 at 5:46 AM Claudia Draghicescu
<claudia.rosu@nxp.com> wrote:
>
> This series of patches adds support for BAP broadcast sink.
> It consists in registering a sink endpoint using the Sink PAC UUID,
> discovering of broadcast advertisers that announce the
> Broadcast Audio Announcement service, synchronizes to the Periodic
> advertisements of the source and synchronizes to the BIG advertised
> in the PA train.
> To retrieve the BASE info advertised in the PA train, the patch
> Bluetooth: ISO: Add support for periodic adv reports processing
> was used.
>
> This feature was tested using bluetoothctl with the following commands:
>
> [bluetooth]# endpoint.register 00002bc9-0000-1000-8000-00805f9b34fb 0x06
> [/local/endpoint/ep0] Auto Accept (yes/no): y
> [/local/endpoint/ep0] Max Transports (auto/value): a
> [/local/endpoint/ep0] unicast/broadcast (u/b): b
> [/local/endpoint/ep0] BIG (auto/value): a
> [/local/endpoint/ep0] BIS (auto/value): a

Ive thought we would be using BAA UUID instead to follow the same
setup as the broadcaster role.

> [bluetooth]# scan on

Then while scanning if we find an announcement it should create a
remote endpoint under the device object path, just as in case of
unicast, which can later be used with endpoint.config.

> [bluetooth]# endpoint.config /org/bluez/hci0/pac_bcast0
> /local/endpoint/ep0 16_2_1 <source_address>

Here then one would replace /org/bluez/hci0/pac_bcast0 with the one
found during the scanning, so the difference with broadcaster becomes
the source endpoint, if you pass the adapter it is for broadcaster
role or in case it is a remote endpoint the it is for listener role so
the commands would work similarly in all directions

> Claudia Draghicescu (6):
>   client/player: Add broadcast sink endpoint registration and
>     configuration.
>   client/main: Add broadcast source discovery
>   media: Add support for a broadcast sink media endpoint
>   transport: Update transport properties for a broadcast stream
>   btio: Add support for getsockopt(BT_ISO_BASE)
>   bap: Add gdbus interface for BAP broadcast sink, create
>     synchronization with source and create BAP broadcast sink stream
>
>  btio/btio.c                |  13 +-
>  client/main.c              |  57 +++++-
>  client/player.c            | 187 +++++++++++++++++++-
>  client/player.h            |   3 +
>  profiles/audio/bap.c       | 347 ++++++++++++++++++++++++++++++++++---
>  profiles/audio/media.c     |  35 +++-
>  profiles/audio/media.h     |   2 +-
>  profiles/audio/transport.c | 244 +++++++++++++++++++++++++-
>  src/shared/bap.c           |  50 +++++-
>  src/shared/bap.h           |   4 +-
>  10 files changed, 888 insertions(+), 54 deletions(-)
>
>
> base-commit: 838e1578072900d1f98dfb31cc538940d2fad876
> --
> 2.34.1
>
Luiz Augusto von Dentz July 13, 2023, 7 p.m. UTC | #2
Hi Claudia,

On Wed, Jul 12, 2023 at 10:45 AM Luiz Augusto von Dentz
<luiz.dentz@gmail.com> wrote:
>
> Hi Claudia,
>
> On Wed, Jul 12, 2023 at 5:46 AM Claudia Draghicescu
> <claudia.rosu@nxp.com> wrote:
> >
> > This series of patches adds support for BAP broadcast sink.
> > It consists in registering a sink endpoint using the Sink PAC UUID,
> > discovering of broadcast advertisers that announce the
> > Broadcast Audio Announcement service, synchronizes to the Periodic
> > advertisements of the source and synchronizes to the BIG advertised
> > in the PA train.
> > To retrieve the BASE info advertised in the PA train, the patch
> > Bluetooth: ISO: Add support for periodic adv reports processing
> > was used.
> >
> > This feature was tested using bluetoothctl with the following commands:
> >
> > [bluetooth]# endpoint.register 00002bc9-0000-1000-8000-00805f9b34fb 0x06
> > [/local/endpoint/ep0] Auto Accept (yes/no): y
> > [/local/endpoint/ep0] Max Transports (auto/value): a
> > [/local/endpoint/ep0] unicast/broadcast (u/b): b
> > [/local/endpoint/ep0] BIG (auto/value): a
> > [/local/endpoint/ep0] BIS (auto/value): a
>
> Ive thought we would be using BAA UUID instead to follow the same
> setup as the broadcaster role.
>
> > [bluetooth]# scan on
>
> Then while scanning if we find an announcement it should create a
> remote endpoint under the device object path, just as in case of
> unicast, which can later be used with endpoint.config.

I had a few more thoughts about how to enumerate the remote broadcast
endpoints, we may want to introduce a driver for BAA UUID so when a
device is found with BAA as part of the advertised UUID would get
probed and the driver can take care of creating the MediaEndpoint
objects based of the advertised data, probably each BIS should have a
endpoint,

> > [bluetooth]# endpoint.config /org/bluez/hci0/pac_bcast0
> > /local/endpoint/ep0 16_2_1 <source_address>
>
> Here then one would replace /org/bluez/hci0/pac_bcast0 with the one
> found during the scanning, so the difference with broadcaster becomes
> the source endpoint, if you pass the adapter it is for broadcaster
> role or in case it is a remote endpoint the it is for listener role so
> the commands would work similarly in all directions
>
> > Claudia Draghicescu (6):
> >   client/player: Add broadcast sink endpoint registration and
> >     configuration.
> >   client/main: Add broadcast source discovery
> >   media: Add support for a broadcast sink media endpoint
> >   transport: Update transport properties for a broadcast stream
> >   btio: Add support for getsockopt(BT_ISO_BASE)
> >   bap: Add gdbus interface for BAP broadcast sink, create
> >     synchronization with source and create BAP broadcast sink stream
> >
> >  btio/btio.c                |  13 +-
> >  client/main.c              |  57 +++++-
> >  client/player.c            | 187 +++++++++++++++++++-
> >  client/player.h            |   3 +
> >  profiles/audio/bap.c       | 347 ++++++++++++++++++++++++++++++++++---
> >  profiles/audio/media.c     |  35 +++-
> >  profiles/audio/media.h     |   2 +-
> >  profiles/audio/transport.c | 244 +++++++++++++++++++++++++-
> >  src/shared/bap.c           |  50 +++++-
> >  src/shared/bap.h           |   4 +-
> >  10 files changed, 888 insertions(+), 54 deletions(-)
> >
> >
> > base-commit: 838e1578072900d1f98dfb31cc538940d2fad876
> > --
> > 2.34.1
> >
>
>
> --
> Luiz Augusto von Dentz
Silviu Florian Barbulescu July 24, 2023, 3:26 p.m. UTC | #3
Hi Luiz, 

>Hi Claudia,
>
>On Wed, Jul 12, 2023 at 10:45 AM Luiz Augusto von Dentz <luiz.dentz@gmail.com> wrote:
>>
>> Hi Claudia,
>>
>> On Wed, Jul 12, 2023 at 5:46 AM Claudia Draghicescu 
>> <claudia.rosu@nxp.com> wrote:
>> >
>> > This series of patches adds support for BAP broadcast sink.
>> > It consists in registering a sink endpoint using the Sink PAC UUID, 
>> > discovering of broadcast advertisers that announce the Broadcast 
>> > Audio Announcement service, synchronizes to the Periodic 
>> > advertisements of the source and synchronizes to the BIG advertised 
>> > in the PA train.
>> > To retrieve the BASE info advertised in the PA train, the patch
>> > Bluetooth: ISO: Add support for periodic adv reports processing was 
>> > used.
>> >
>> > This feature was tested using bluetoothctl with the following commands:
>> >
>> > [bluetooth]# endpoint.register 00002bc9-0000-1000-8000-00805f9b34fb 
>> > 0x06 [/local/endpoint/ep0] Auto Accept (yes/no): y 
>> > [/local/endpoint/ep0] Max Transports (auto/value): a 
>> > [/local/endpoint/ep0] unicast/broadcast (u/b): b 
>> > [/local/endpoint/ep0] BIG (auto/value): a [/local/endpoint/ep0] BIS 
>> > (auto/value): a
>>
>> Ive thought we would be using BAA UUID instead to follow the same 
>> setup as the broadcaster role.

We think adding a new UUID for the broadcast sink (0x1851) along with the
UUID for the broadcast source (0x1852) is the best choice because we need
to differentiate the endpoint and transport in other applications like PipeWire.
This follows the same procedure as for bap unicast where PAC_SOURCE_UUID
and PAC_SINK_UUID are used to differentiate between BAP unicast source and sink
endpoints and transports.

>>
>> > [bluetooth]# scan on
>>
>> Then while scanning if we find an announcement it should create a 
>> remote endpoint under the device object path, just as in case of 
>> unicast, which can later be used with endpoint.config.
>
>I had a few more thoughts about how to enumerate the remote broadcast endpoints, we may want to introduce a driver for BAA UUID so when a device is found with BAA as part of the advertised 
>UUID would get probed and the driver can take care of creating the MediaEndpoint objects based of the advertised data, probably each BIS should have a endpoint,
>
>> > [bluetooth]# endpoint.config /org/bluez/hci0/pac_bcast0
>> > /local/endpoint/ep0 16_2_1 <source_address>
>>
>> Here then one would replace /org/bluez/hci0/pac_bcast0 with the one 
>> found during the scanning, so the difference with broadcaster becomes 
>> the source endpoint, if you pass the adapter it is for broadcaster 
>> role or in case it is a remote endpoint the it is for listener role so 
>> the commands would work similarly in all directions
>>
>> > Claudia Draghicescu (6):
>> >   client/player: Add broadcast sink endpoint registration and
>> >     configuration.
>> >   client/main: Add broadcast source discovery
>> >   media: Add support for a broadcast sink media endpoint
>> >   transport: Update transport properties for a broadcast stream
>> >   btio: Add support for getsockopt(BT_ISO_BASE)
>> >   bap: Add gdbus interface for BAP broadcast sink, create
>> >     synchronization with source and create BAP broadcast sink stream
>> >
>> >  btio/btio.c                |  13 +-
>> >  client/main.c              |  57 +++++-
>> >  client/player.c            | 187 +++++++++++++++++++-
>> >  client/player.h            |   3 +
>> >  profiles/audio/bap.c       | 347 ++++++++++++++++++++++++++++++++++---
>> >  profiles/audio/media.c     |  35 +++-
>> >  profiles/audio/media.h     |   2 +-
>> >  profiles/audio/transport.c | 244 +++++++++++++++++++++++++-
>> >  src/shared/bap.c           |  50 +++++-
>> >  src/shared/bap.h           |   4 +-
>> >  10 files changed, 888 insertions(+), 54 deletions(-)
>> >
>> >
>> > base-commit: 838e1578072900d1f98dfb31cc538940d2fad876
>> > --
>> > 2.34.1
>> >
>>
>>
>> --
>> Luiz Augusto von Dentz
>
>
>
>--
>Luiz Augusto von Dentz
Luiz Augusto von Dentz July 24, 2023, 5:06 p.m. UTC | #4
Hi Silviu,

On Mon, Jul 24, 2023 at 8:26 AM Silviu Florian Barbulescu
<silviu.barbulescu@nxp.com> wrote:
>
> Hi Luiz,
>
> >Hi Claudia,
> >
> >On Wed, Jul 12, 2023 at 10:45 AM Luiz Augusto von Dentz <luiz.dentz@gmail.com> wrote:
> >>
> >> Hi Claudia,
> >>
> >> On Wed, Jul 12, 2023 at 5:46 AM Claudia Draghicescu
> >> <claudia.rosu@nxp.com> wrote:
> >> >
> >> > This series of patches adds support for BAP broadcast sink.
> >> > It consists in registering a sink endpoint using the Sink PAC UUID,
> >> > discovering of broadcast advertisers that announce the Broadcast
> >> > Audio Announcement service, synchronizes to the Periodic
> >> > advertisements of the source and synchronizes to the BIG advertised
> >> > in the PA train.
> >> > To retrieve the BASE info advertised in the PA train, the patch
> >> > Bluetooth: ISO: Add support for periodic adv reports processing was
> >> > used.
> >> >
> >> > This feature was tested using bluetoothctl with the following commands:
> >> >
> >> > [bluetooth]# endpoint.register 00002bc9-0000-1000-8000-00805f9b34fb
> >> > 0x06 [/local/endpoint/ep0] Auto Accept (yes/no): y
> >> > [/local/endpoint/ep0] Max Transports (auto/value): a
> >> > [/local/endpoint/ep0] unicast/broadcast (u/b): b
> >> > [/local/endpoint/ep0] BIG (auto/value): a [/local/endpoint/ep0] BIS
> >> > (auto/value): a
> >>
> >> Ive thought we would be using BAA UUID instead to follow the same
> >> setup as the broadcaster role.
>
> We think adding a new UUID for the broadcast sink (0x1851) along with the
> UUID for the broadcast source (0x1852) is the best choice because we need
> to differentiate the endpoint and transport in other applications like PipeWire.
> This follows the same procedure as for bap unicast where PAC_SOURCE_UUID
> and PAC_SINK_UUID are used to differentiate between BAP unicast source and sink
> endpoints and transports.

Sure,  I wasn't aware there was a broadcast sink UUID, anyway the
point is to have a similar flow for both Broadcast and Unicast.

> >>
> >> > [bluetooth]# scan on
> >>
> >> Then while scanning if we find an announcement it should create a
> >> remote endpoint under the device object path, just as in case of
> >> unicast, which can later be used with endpoint.config.
> >
> >I had a few more thoughts about how to enumerate the remote broadcast endpoints, we may want to introduce a driver for BAA UUID so when a device is found with BAA as part of the advertised
> >UUID would get probed and the driver can take care of creating the MediaEndpoint objects based of the advertised data, probably each BIS should have a endpoint,
> >
> >> > [bluetooth]# endpoint.config /org/bluez/hci0/pac_bcast0
> >> > /local/endpoint/ep0 16_2_1 <source_address>
> >>
> >> Here then one would replace /org/bluez/hci0/pac_bcast0 with the one
> >> found during the scanning, so the difference with broadcaster becomes
> >> the source endpoint, if you pass the adapter it is for broadcaster
> >> role or in case it is a remote endpoint the it is for listener role so
> >> the commands would work similarly in all directions
> >>
> >> > Claudia Draghicescu (6):
> >> >   client/player: Add broadcast sink endpoint registration and
> >> >     configuration.
> >> >   client/main: Add broadcast source discovery
> >> >   media: Add support for a broadcast sink media endpoint
> >> >   transport: Update transport properties for a broadcast stream
> >> >   btio: Add support for getsockopt(BT_ISO_BASE)
> >> >   bap: Add gdbus interface for BAP broadcast sink, create
> >> >     synchronization with source and create BAP broadcast sink stream
> >> >
> >> >  btio/btio.c                |  13 +-
> >> >  client/main.c              |  57 +++++-
> >> >  client/player.c            | 187 +++++++++++++++++++-
> >> >  client/player.h            |   3 +
> >> >  profiles/audio/bap.c       | 347 ++++++++++++++++++++++++++++++++++---
> >> >  profiles/audio/media.c     |  35 +++-
> >> >  profiles/audio/media.h     |   2 +-
> >> >  profiles/audio/transport.c | 244 +++++++++++++++++++++++++-
> >> >  src/shared/bap.c           |  50 +++++-
> >> >  src/shared/bap.h           |   4 +-
> >> >  10 files changed, 888 insertions(+), 54 deletions(-)
> >> >
> >> >
> >> > base-commit: 838e1578072900d1f98dfb31cc538940d2fad876
> >> > --
> >> > 2.34.1
> >> >
> >>
> >>
> >> --
> >> Luiz Augusto von Dentz
> >
> >
> >
> >--
> >Luiz Augusto von Dentz