Merge branch 'bugfix/btdm_a2dp_src_pkt_overflow' into 'master'

component/bt: fix some performance issues in A2DP source data flow control

See merge request idf/esp-idf!4932
This commit is contained in:
Jiang Jiang Jian 2019-06-04 16:07:31 +08:00
commit 5274739fff
2 changed files with 11 additions and 5 deletions

View file

@ -1155,10 +1155,16 @@ static UINT8 btc_get_num_aa_frame(void)
/* calculate nbr of frames pending for this media tick */ /* calculate nbr of frames pending for this media tick */
result = btc_aa_src_cb.media_feeding_state.pcm.counter / pcm_bytes_per_frame; result = btc_aa_src_cb.media_feeding_state.pcm.counter / pcm_bytes_per_frame;
if (result > MAX_PCM_FRAME_NUM_PER_TICK) {
APPL_TRACE_WARNING("%s() - Limiting frames to be sent from %d to %d" /* limit the frames to be sent */
, __FUNCTION__, result, MAX_PCM_FRAME_NUM_PER_TICK); UINT32 frm_nb_threshold = MAX_OUTPUT_A2DP_SRC_FRAME_QUEUE_SZ - fixed_queue_length(btc_aa_src_cb.TxAaQ);
result = MAX_PCM_FRAME_NUM_PER_TICK; if (frm_nb_threshold > MAX_PCM_FRAME_NUM_PER_TICK) {
frm_nb_threshold = MAX_PCM_FRAME_NUM_PER_TICK;
}
if (result > frm_nb_threshold) {
APPL_TRACE_EVENT("Limit frms to send from %d to %d", result, frm_nb_threshold);
result = frm_nb_threshold;
} }
btc_aa_src_cb.media_feeding_state.pcm.counter -= result * pcm_bytes_per_frame; btc_aa_src_cb.media_feeding_state.pcm.counter -= result * pcm_bytes_per_frame;

View file

@ -95,7 +95,7 @@ typedef enum {
#define BTC_A2DP_SOURCE_TASK_STACK_SIZE (CONFIG_BT_A2DP_SOURCE_TASK_STACK_SIZE + BT_TASK_EXTRA_STACK_SIZE) // by menuconfig #define BTC_A2DP_SOURCE_TASK_STACK_SIZE (CONFIG_BT_A2DP_SOURCE_TASK_STACK_SIZE + BT_TASK_EXTRA_STACK_SIZE) // by menuconfig
#define BTC_A2DP_SOURCE_TASK_NAME "BtA2dSourceT" #define BTC_A2DP_SOURCE_TASK_NAME "BtA2dSourceT"
#define BTC_A2DP_SOURCE_TASK_PRIO (configMAX_PRIORITIES - 3) #define BTC_A2DP_SOURCE_TASK_PRIO (configMAX_PRIORITIES - 3)
#define BTC_A2DP_SOURCE_DATA_QUEUE_LEN (3) #define BTC_A2DP_SOURCE_DATA_QUEUE_LEN (1)
#define BTC_A2DP_SOURCE_CTRL_QUEUE_LEN (5) #define BTC_A2DP_SOURCE_CTRL_QUEUE_LEN (5)
#define BTC_A2DP_SOURCE_TASK_QUEUE_SET_LEN (BTC_A2DP_SOURCE_DATA_QUEUE_LEN + BTC_A2DP_SOURCE_CTRL_QUEUE_LEN) #define BTC_A2DP_SOURCE_TASK_QUEUE_SET_LEN (BTC_A2DP_SOURCE_DATA_QUEUE_LEN + BTC_A2DP_SOURCE_CTRL_QUEUE_LEN)