@@ -370,6 +370,7 @@ ZTEST(suite_server_store, test_pres_dly_not_found)
370370 TEST_UNICAST_GROUP (unicast_group );
371371
372372 TEST_CAP_STREAM (TCS_1_existing , BT_AUDIO_DIR_SINK , 1100 , 0xAAAA );
373+ TCS_1_existing .bap_stream .ep -> state = BT_BAP_EP_STATE_STREAMING ;
373374 TCS_1_existing .bap_stream .ep -> qos_pref .pd_min = 1000 ;
374375 TCS_1_existing .bap_stream .ep -> qos_pref .pref_pd_min = 2000 ;
375376 TCS_1_existing .bap_stream .ep -> qos_pref .pref_pd_max = 3000 ;
@@ -407,6 +408,48 @@ ZTEST(suite_server_store, test_pres_dly_not_found)
407408 srv_store_unlock ();
408409}
409410
411+ ZTEST (suite_server_store , test_pres_dly_ignored )
412+ {
413+
414+ int ret ;
415+
416+ ret = srv_store_lock (K_NO_WAIT );
417+ zassert_equal (ret , 0 );
418+
419+ TEST_UNICAST_GROUP (unicast_group );
420+
421+ TEST_CAP_STREAM (TCS_1_existing , BT_AUDIO_DIR_SINK , 4000 , 0xAAAA );
422+ TCS_1_existing .bap_stream .ep -> state = BT_BAP_EP_STATE_IDLE ;
423+ TCS_1_existing .bap_stream .ep -> qos_pref .pd_min = 4000 ;
424+ TCS_1_existing .bap_stream .ep -> qos_pref .pref_pd_min = 5000 ;
425+ TCS_1_existing .bap_stream .ep -> qos_pref .pref_pd_max = 6000 ;
426+ TCS_1_existing .bap_stream .ep -> qos_pref .pd_max = 7000 ;
427+
428+ mock_add_stream_to_group (& TCS_1_existing .bap_stream , & unicast_group );
429+
430+ uint32_t computed_pres_dly_us = 0 ;
431+ uint32_t existing_pres_dly_us = 0 ;
432+ bool group_reconfig_needed = false;
433+
434+ TEST_CAP_STREAM (TCS_1_new , BT_AUDIO_DIR_SINK , 0 , 0xAAAA );
435+ struct bt_bap_qos_cfg_pref server_qos_pref ;
436+
437+ server_qos_pref .pd_min = 1000 ;
438+ server_qos_pref .pref_pd_min = 2000 ;
439+ server_qos_pref .pref_pd_max = 3000 ;
440+ server_qos_pref .pd_max = 4000 ;
441+
442+ ret = srv_store_pres_dly_find (& TCS_1_new .bap_stream , & computed_pres_dly_us ,
443+ & existing_pres_dly_us , & server_qos_pref ,
444+ & group_reconfig_needed , & unicast_group );
445+
446+ zassert_equal (ret , 0 );
447+ zassert_equal (computed_pres_dly_us , 2000 ,
448+ "Computed presentation delay should be equal to preferred min" );
449+
450+ srv_store_unlock ();
451+ }
452+
410453ZTEST (suite_server_store , test_pres_delay_advanced )
411454{
412455 int ret ;
@@ -417,6 +460,7 @@ ZTEST(suite_server_store, test_pres_delay_advanced)
417460 zassert_equal (ret , 0 );
418461
419462 TEST_CAP_STREAM (TCS_1_existing , BT_AUDIO_DIR_SINK , 2500 , 0xAAAA );
463+ TCS_1_existing .bap_stream .ep -> state = BT_BAP_EP_STATE_STREAMING ;
420464 TCS_1_existing .bap_stream .ep -> qos_pref .pd_min = 1001 ;
421465 TCS_1_existing .bap_stream .ep -> qos_pref .pref_pd_min = 2000 ;
422466 TCS_1_existing .bap_stream .ep -> qos_pref .pref_pd_max = 3000 ;
@@ -480,6 +524,7 @@ ZTEST(suite_server_store, test_pres_delay_multiple_streams)
480524 zassert_equal (ret , 0 );
481525
482526 TEST_CAP_STREAM (TCS_1_existing , BT_AUDIO_DIR_SINK , 1800 , 0xAAAA );
527+ TCS_1_existing .bap_stream .ep -> state = BT_BAP_EP_STATE_STREAMING ;
483528 TCS_1_existing .bap_stream .ep -> qos_pref .pd_min = 1000 ;
484529 TCS_1_existing .bap_stream .ep -> qos_pref .pref_pd_min = 2300 ;
485530 TCS_1_existing .bap_stream .ep -> qos_pref .pref_pd_max = 3000 ;
@@ -488,6 +533,7 @@ ZTEST(suite_server_store, test_pres_delay_multiple_streams)
488533 mock_add_stream_to_group (& TCS_1_existing .bap_stream , & unicast_group );
489534
490535 TEST_CAP_STREAM (TCS_2_existing , BT_AUDIO_DIR_SINK , 1800 , 0xAAAA );
536+ TCS_2_existing .bap_stream .ep -> state = BT_BAP_EP_STATE_STREAMING ;
491537 TCS_2_existing .bap_stream .ep -> qos_pref .pd_min = 1500 ;
492538 TCS_2_existing .bap_stream .ep -> qos_pref .pref_pd_min = 2500 ;
493539 TCS_2_existing .bap_stream .ep -> qos_pref .pref_pd_max = 3000 ;
@@ -496,6 +542,7 @@ ZTEST(suite_server_store, test_pres_delay_multiple_streams)
496542 mock_add_stream_to_group (& TCS_2_existing .bap_stream , & unicast_group );
497543
498544 TEST_CAP_STREAM (TCS_3_existing , BT_AUDIO_DIR_SINK , 1800 , 0xAAAA );
545+ TCS_3_existing .bap_stream .ep -> state = BT_BAP_EP_STATE_STREAMING ;
499546 TCS_3_existing .bap_stream .ep -> qos_pref .pd_min = 1800 ;
500547 TCS_3_existing .bap_stream .ep -> qos_pref .pref_pd_min = 2500 ;
501548 TCS_3_existing .bap_stream .ep -> qos_pref .pref_pd_max = 3000 ;
@@ -589,6 +636,7 @@ ZTEST(suite_server_store, test_pres_delay_multi_group)
589636 zassert_equal (ret , 0 );
590637
591638 TEST_CAP_STREAM (TCS_1_existing , BT_AUDIO_DIR_SINK , 2000 , 0xAAAA );
639+ TCS_1_existing .bap_stream .ep -> state = BT_BAP_EP_STATE_STREAMING ;
592640 TCS_1_existing .bap_stream .ep -> qos_pref .pd_min = 1000 ;
593641 TCS_1_existing .bap_stream .ep -> qos_pref .pref_pd_min = 2000 ;
594642 TCS_1_existing .bap_stream .ep -> qos_pref .pref_pd_max = 3000 ;
@@ -598,6 +646,7 @@ ZTEST(suite_server_store, test_pres_delay_multi_group)
598646
599647 /* Add stream in another group */
600648 TEST_CAP_STREAM (TCS_2_existing , BT_AUDIO_DIR_SINK , 500 , 0xBBBB );
649+ TCS_2_existing .bap_stream .ep -> state = BT_BAP_EP_STATE_STREAMING ;
601650 TCS_2_existing .bap_stream .ep -> qos_pref .pd_min = 500 ;
602651 TCS_2_existing .bap_stream .ep -> qos_pref .pref_pd_min = 500 ;
603652 TCS_2_existing .bap_stream .ep -> qos_pref .pref_pd_max = 500 ;
0 commit comments