@@ -649,46 +649,51 @@ static bool pa_decode_base(struct bt_data *data, void *user_data)
649
649
const struct bt_bap_base * base = bt_bap_base_get_base_from_ad (data );
650
650
struct bt_bap_broadcast_sink_cb * listener ;
651
651
int base_size ;
652
- int ret ;
653
652
654
653
/* Base is NULL if the data does not contain a valid BASE */
655
654
if (base == NULL ) {
656
655
return true;
657
656
}
658
657
659
- if (atomic_test_bit (sink -> flags , BT_BAP_BROADCAST_SINK_FLAG_BIGINFO_RECEIVED )) {
660
- ret = base_get_bis_count (base );
661
-
662
- if (ret < 0 ) {
663
- LOG_DBG ("Invalid BASE: %d" , ret );
664
- return false;
665
- } else if (ret != sink -> biginfo_num_bis ) {
666
- LOG_DBG ("BASE contains different amount of BIS (%u) than reported by "
667
- "BIGInfo (%u)" ,
668
- ret , sink -> biginfo_num_bis );
669
- return false;
670
- }
671
- }
672
-
673
658
/* We provide the BASE without the service data UUID */
674
659
base_size = bt_bap_base_get_size (base );
660
+ if (base_size != sink -> base_size || memcmp (base , sink -> base , base_size ) != 0 ) {
661
+ /* New BASE, parse */
662
+
663
+ if (atomic_test_bit (sink -> flags , BT_BAP_BROADCAST_SINK_FLAG_BIGINFO_RECEIVED )) {
664
+ int ret ;
675
665
676
- /* Store newest BASE info until we are BIG synced */
677
- if (sink -> big == NULL ) {
678
- sink -> qos_cfg .pd = bt_bap_base_get_pres_delay (base );
666
+ ret = base_get_bis_count (base );
679
667
680
- sink -> subgroup_count = 0 ;
681
- sink -> valid_indexes_bitfield = 0 ;
682
- bt_bap_base_foreach_subgroup (base , base_decode_subgroup_cb , sink );
668
+ if (ret < 0 ) {
669
+ LOG_DBG ("Invalid BASE: %d" , ret );
670
+ return false;
671
+ } else if (ret != sink -> biginfo_num_bis ) {
672
+ LOG_DBG ("BASE contains different amount of BIS (%u) than reported "
673
+ "by BIGInfo (%u)" ,
674
+ ret , sink -> biginfo_num_bis );
675
+ return false;
676
+ }
677
+ }
683
678
684
- LOG_DBG ("Updating BASE for sink %p with %d subgroups\n" , sink ,
685
- sink -> subgroup_count );
679
+ /* Store newest BASE info until we are BIG synced */
680
+ if (sink -> big == NULL ) {
681
+ sink -> qos_cfg .pd = bt_bap_base_get_pres_delay (base );
686
682
687
- memcpy (sink -> base , base , base_size );
688
- }
683
+ sink -> subgroup_count = 0 ;
684
+ sink -> valid_indexes_bitfield = 0 ;
685
+ bt_bap_base_foreach_subgroup (base , base_decode_subgroup_cb , sink );
689
686
690
- if (atomic_test_bit (sink -> flags , BT_BAP_BROADCAST_SINK_FLAG_SRC_ID_VALID )) {
691
- update_recv_state_base (sink , base );
687
+ LOG_DBG ("Updating BASE for sink %p with %d subgroups\n" , sink ,
688
+ sink -> subgroup_count );
689
+
690
+ memcpy (sink -> base , base , base_size );
691
+ sink -> base_size = base_size ;
692
+ }
693
+
694
+ if (atomic_test_bit (sink -> flags , BT_BAP_BROADCAST_SINK_FLAG_SRC_ID_VALID )) {
695
+ update_recv_state_base (sink , base );
696
+ }
692
697
}
693
698
694
699
SYS_SLIST_FOR_EACH_CONTAINER (& sink_cbs , listener , _node ) {
@@ -726,6 +731,7 @@ static void pa_term_cb(struct bt_le_per_adv_sync *sync,
726
731
727
732
if (sink != NULL ) {
728
733
sink -> pa_sync = NULL ;
734
+ sink -> base_size = 0U ;
729
735
}
730
736
}
731
737
0 commit comments