Merge branch 'bugfix/btdm_a2dp_task_stack_size_for_v3.0' into 'release/v3.0'

component/bt: make A2DP sink task size configurable through menuconfig

See merge request idf/esp-idf!1890
This commit is contained in:
Jiang Jiang Jian
2018-02-24 10:18:12 +08:00
4 changed files with 23 additions and 14 deletions

View File

@@ -113,6 +113,13 @@ config CLASSIC_BT_ENABLED
help help
For now this option needs "SMP_ENABLE" to be set to yes For now this option needs "SMP_ENABLE" to be set to yes
config A2DP_SINK_TASK_STACK_SIZE
int "A2DP sink (audio stream decoding) task stack size"
depends on CLASSIC_BT_ENABLED
default 2048
help
This affects the stack size of A2DP sink task which invokes the data callback function.
config GATTS_ENABLE config GATTS_ENABLE
bool "Include GATT server module(GATTS)" bool "Include GATT server module(GATTS)"
depends on BLUEDROID_ENABLED depends on BLUEDROID_ENABLED

View File

@@ -138,9 +138,10 @@ esp_err_t esp_a2d_register_callback(esp_a2d_cb_t callback);
/** /**
* @brief Register A2DP sink data output function; For now the output is PCM data stream decoded * @brief Register A2DP sink data output function; For now the output is PCM data stream decoded
* from SBC format. This function should be called only after esp_bluedroid_enable() * from SBC format. This function should be called only after esp_bluedroid_enable()
* completes successfully * completes successfully, used only by A2DP sink. The callback is invoked in the context
* * of A2DP sink task whose stack size is configurable through menuconfig
*
* @param[in] callback: A2DP data callback function * @param[in] callback: A2DP data callback function
* *
* @return * @return

View File

@@ -272,13 +272,13 @@ bool btc_a2dp_start_media_task(void)
APPL_TRACE_EVENT("## A2DP START MEDIA THREAD ##"); APPL_TRACE_EVENT("## A2DP START MEDIA THREAD ##");
xBtcMediaQueueSet = xQueueCreateSet(BTC_MEDIA_TASK_QUEUE_SET_LEN); xBtcMediaQueueSet = xQueueCreateSet(BTC_A2DP_SINK_TASK_QUEUE_SET_LEN);
configASSERT(xBtcMediaQueueSet); configASSERT(xBtcMediaQueueSet);
xBtcMediaDataQueue = xQueueCreate(BTC_MEDIA_DATA_QUEUE_LEN, sizeof(void *)); xBtcMediaDataQueue = xQueueCreate(BTC_A2DP_SINK_DATA_QUEUE_LEN, sizeof(void *));
configASSERT(xBtcMediaDataQueue); configASSERT(xBtcMediaDataQueue);
xQueueAddToSet(xBtcMediaDataQueue, xBtcMediaQueueSet); xQueueAddToSet(xBtcMediaDataQueue, xBtcMediaQueueSet);
xBtcMediaCtrlQueue = xQueueCreate(BTC_MEDIA_CTRL_QUEUE_LEN, sizeof(void *)); xBtcMediaCtrlQueue = xQueueCreate(BTC_A2DP_SINK_CTRL_QUEUE_LEN, sizeof(void *));
configASSERT(xBtcMediaCtrlQueue); configASSERT(xBtcMediaCtrlQueue);
xQueueAddToSet(xBtcMediaCtrlQueue, xBtcMediaQueueSet); xQueueAddToSet(xBtcMediaCtrlQueue, xBtcMediaQueueSet);
@@ -286,7 +286,7 @@ bool btc_a2dp_start_media_task(void)
goto error_exit; goto error_exit;
} }
xTaskCreatePinnedToCore(btc_media_task_handler, "BtcMediaT\n", 2048, NULL, configMAX_PRIORITIES - 3, &xBtcMediaTaskHandle, 0); xTaskCreatePinnedToCore(btc_media_task_handler, BTC_A2DP_SINK_TASK_NAME, BTC_A2DP_SINK_TASK_STACK_SIZE, NULL, BTC_A2DP_SINK_TASK_PRIO, &xBtcMediaTaskHandle, BTC_A2DP_SINK_TASK_PINNED_TO_CORE);
if (xBtcMediaTaskHandle == NULL) { if (xBtcMediaTaskHandle == NULL) {
goto error_exit; goto error_exit;
} }

View File

@@ -83,13 +83,14 @@ typedef enum {
#define BTC_TASK_PRIO (configMAX_PRIORITIES - 6) #define BTC_TASK_PRIO (configMAX_PRIORITIES - 6)
#define BTC_TASK_QUEUE_LEN 60 #define BTC_TASK_QUEUE_LEN 60
#define BTC_MEDIA_TASK_PINNED_TO_CORE (TASK_PINNED_TO_CORE) #define BTC_A2DP_SINK_TASK_PINNED_TO_CORE (TASK_PINNED_TO_CORE)
#define BTC_MEDIA_TASK_STACK_SIZE (CONFIG_BTC_TASK_STACK_SIZE + BT_TASK_EXTRA_STACK_SIZE) #define BTC_A2DP_SINK_TASK_STACK_SIZE (CONFIG_A2DP_SINK_TASK_STACK_SIZE + BT_TASK_EXTRA_STACK_SIZE) // by menuconfig
#define BTC_MEDIA_TASK_NAME "BtcMediaT" #define BTC_A2DP_SINK_TASK_NAME "BtA2dSinkT"
#define BTC_MEDIA_TASK_PRIO (configMAX_PRIORITIES - 3) #define BTC_A2DP_SINK_TASK_PRIO (configMAX_PRIORITIES - 3)
#define BTC_MEDIA_DATA_QUEUE_LEN (1) #define BTC_A2DP_SINK_DATA_QUEUE_LEN (1)
#define BTC_MEDIA_CTRL_QUEUE_LEN (5) #define BTC_A2DP_SINK_CTRL_QUEUE_LEN (5)
#define BTC_MEDIA_TASK_QUEUE_SET_LEN (BTC_MEDIA_DATA_QUEUE_LEN + BTC_MEDIA_CTRL_QUEUE_LEN) #define BTC_A2DP_SINK_TASK_QUEUE_SET_LEN (BTC_A2DP_SINK_DATA_QUEUE_LEN + BTC_A2DP_SINK_CTRL_QUEUE_LEN)
#define TASK_POST_NON_BLOCKING (0) #define TASK_POST_NON_BLOCKING (0)
#define TASK_POST_BLOCKING (portMAX_DELAY) #define TASK_POST_BLOCKING (portMAX_DELAY)