Skip to content

Commit

Permalink
shared/bap: Fix not reading all instances of PAC Sinks/Sources
Browse files Browse the repository at this point in the history
Both PAC Sink and Source are allowed to have multiple instances:

 - The server wanted to support a smaller maximum transmission unit
 (ATT_MTU, as defined in Volume 3, Part F, Section 3.2.8 in [2]) size.
 Exposing all supported PAC records in a single Sink PAC characteristic
 would require the server to increase its supported Maximum
 Transmission Unit (MTU) size to a value the server considered
 excessive.
 - The server wanted to expose support for proprietary audio
 capabilities (such as vendor-specific audio codecs, as denoted by the
 Codec_ID parameter value) separately from support for
 non-vendor-specific audio capabilities and used separate Sink PAC
 characteristics to expose such support.
 - The server wanted to minimize the amount of data to be transferred,
 when sending notifications to a client that the Sink PAC
 characteristic value changed, by exposing the audio capabilities
 likely to change quicker than others in separate Sink PAC
 characteristics.
  • Loading branch information
Vudentz committed Dec 2, 2022
1 parent 43d71b8 commit b6a6f6a
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/shared/bap.c
Original file line number Diff line number Diff line change
Expand Up @@ -2908,21 +2908,25 @@ static void foreach_pacs_char(struct gatt_db_attribute *attr, void *user_data)
DBG(bap, "Sink PAC found: handle 0x%04x", value_handle);

pacs = bap_get_pacs(bap);
if (!pacs || pacs->sink)
if (!pacs)
return;

pacs->sink = attr;
if (!pacs->sink)
pacs->sink = attr;

bap_read_value(bap, value_handle, read_sink_pac, bap);
}

if (!bt_uuid_cmp(&uuid, &uuid_source)) {
DBG(bap, "Source PAC found: handle 0x%04x", value_handle);

pacs = bap_get_pacs(bap);
if (!pacs || pacs->source)
if (!pacs)
return;

pacs->source = attr;
if (!pacs->source)
pacs->source = attr;

bap_read_value(bap, value_handle, read_source_pac, NULL);
}

Expand Down

0 comments on commit b6a6f6a

Please sign in to comment.