mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-01 18:50:34 +03:00
fix(ble_audio): Miscellaneous fixes for ISO & LE Audio (stage 1)
This commit is contained in:
@@ -40,19 +40,26 @@ typedef struct bt_bap_lc3_preset esp_ble_audio_bap_lc3_preset_t;
|
||||
* @param _rtn Number of retransmissions.
|
||||
* @param _latency Maximum transport latency (in milliseconds).
|
||||
* @param _pd Presentation delay (in microseconds).
|
||||
*
|
||||
* Backing buffers are sized to `CONFIG_BT_AUDIO_CODEC_CFG_MAX_*_SIZE` so
|
||||
* the preset is safe to mutate via `esp_ble_audio_codec_cfg_*_set_*`.
|
||||
*/
|
||||
#define ESP_BLE_AUDIO_BAP_LC3_PRESET_DEFINE(_name, _freq, _duration, _loc, _len, \
|
||||
_frames_per_sdu, _stream_context, \
|
||||
_interval, _sdu, _rtn, _latency, _pd) \
|
||||
static uint8_t codec_cfg_data_##_name[] = \
|
||||
static uint8_t codec_cfg_data_##_name[CONFIG_BT_AUDIO_CODEC_CFG_MAX_DATA_SIZE] = \
|
||||
ESP_BLE_AUDIO_CODEC_CFG_LC3_DATA(_freq, _duration, _loc, _len, _frames_per_sdu); \
|
||||
static uint8_t codec_cfg_meta_##_name[] = \
|
||||
static uint8_t codec_cfg_meta_##_name[CONFIG_BT_AUDIO_CODEC_CFG_MAX_METADATA_SIZE] = \
|
||||
ESP_BLE_AUDIO_CODEC_CFG_LC3_META(_stream_context); \
|
||||
static esp_ble_audio_bap_lc3_preset_t _name = \
|
||||
ESP_BLE_AUDIO_BAP_LC3_PRESET(ESP_BLE_AUDIO_CODEC_CFG_LC3(codec_cfg_data_##_name, \
|
||||
codec_cfg_meta_##_name), \
|
||||
ESP_BLE_AUDIO_BAP_QOS_CFG_UNFRAMED(_interval, _sdu, _rtn, \
|
||||
_latency, _pd));
|
||||
ESP_BLE_AUDIO_BAP_LC3_PRESET( \
|
||||
ESP_BLE_AUDIO_CODEC_CFG_LC3_LEN( \
|
||||
codec_cfg_data_##_name, \
|
||||
sizeof((uint8_t[])ESP_BLE_AUDIO_CODEC_CFG_LC3_DATA(_freq, _duration, _loc, \
|
||||
_len, _frames_per_sdu)), \
|
||||
codec_cfg_meta_##_name, \
|
||||
sizeof((uint8_t[])ESP_BLE_AUDIO_CODEC_CFG_LC3_META(_stream_context))), \
|
||||
ESP_BLE_AUDIO_BAP_QOS_CFG_UNFRAMED(_interval, _sdu, _rtn, _latency, _pd));
|
||||
|
||||
/**
|
||||
* @brief Helper to declare LC3 Unicast 8_1_1 codec configuration.
|
||||
|
||||
@@ -77,6 +77,35 @@ typedef enum bt_audio_codec_cfg_target_phy esp_ble_audio_codec_cfg_
|
||||
.meta = (_meta), \
|
||||
})
|
||||
|
||||
/**
|
||||
* @brief Variant of ESP_BLE_AUDIO_CODEC_CFG with explicit LVT content lengths.
|
||||
*
|
||||
* @param _id Codec ID.
|
||||
* @param _cid Company ID.
|
||||
* @param _vid Vendor ID.
|
||||
* @param _data Codec Specific Data buffer in LVT format.
|
||||
* @param _data_len Current LVT content length in `_data`.
|
||||
* @param _meta Codec Specific Metadata buffer in LVT format.
|
||||
* @param _meta_len Current LVT content length in `_meta`.
|
||||
*/
|
||||
#define ESP_BLE_AUDIO_CODEC_CFG_LEN(_id, _cid, _vid, _data, _data_len, _meta, _meta_len) \
|
||||
((esp_ble_audio_codec_cfg_t){ \
|
||||
/* Use HCI data path as default, can be overwritten by application */ \
|
||||
.path_id = ESP_BLE_ISO_DATA_PATH_HCI, \
|
||||
.ctlr_transcode = false, \
|
||||
COND_CODE_1(IS_ENABLED(CONFIG_BT_BAP_UNICAST), \
|
||||
(.target_latency = ESP_BLE_AUDIO_CODEC_CFG_TARGET_LATENCY_BALANCED, \
|
||||
.target_phy = ESP_BLE_AUDIO_CODEC_CFG_TARGET_PHY_2M,), \
|
||||
()) \
|
||||
.id = (_id), \
|
||||
.cid = (_cid), \
|
||||
.vid = (_vid), \
|
||||
.data_len = (_data_len), \
|
||||
.data = (_data), \
|
||||
.meta_len = (_meta_len), \
|
||||
.meta = (_meta), \
|
||||
})
|
||||
|
||||
/**
|
||||
* @brief Helper to declare esp_ble_audio_codec_cap_t.
|
||||
*
|
||||
@@ -100,6 +129,23 @@ typedef enum bt_audio_codec_cfg_target_phy esp_ble_audio_codec_cfg_
|
||||
.meta = (_meta), \
|
||||
})
|
||||
|
||||
/**
|
||||
* @brief Variant of ESP_BLE_AUDIO_CODEC_CAP with explicit LVT content lengths.
|
||||
*/
|
||||
#define ESP_BLE_AUDIO_CODEC_CAP_LEN(_id, _cid, _vid, _data, _data_len, _meta, _meta_len) \
|
||||
((esp_ble_audio_codec_cap_t){ \
|
||||
/* Use HCI data path as default, can be overwritten by application */ \
|
||||
.path_id = ESP_BLE_ISO_DATA_PATH_HCI, \
|
||||
.ctlr_transcode = false, \
|
||||
.id = (_id), \
|
||||
.cid = (_cid), \
|
||||
.vid = (_vid), \
|
||||
.data_len = (_data_len), \
|
||||
.data = (_data), \
|
||||
.meta_len = (_meta_len), \
|
||||
.meta = (_meta), \
|
||||
})
|
||||
|
||||
/*!< Supported sampling frequencies */
|
||||
#define ESP_BLE_AUDIO_CODEC_CAP_TYPE_FREQ BT_AUDIO_CODEC_CAP_TYPE_FREQ
|
||||
/*!< Supported frame durations */
|
||||
|
||||
@@ -31,19 +31,26 @@ extern "C" {
|
||||
* @param _rtn Maximum number of retransmissions.
|
||||
* @param _latency Maximum latency in milliseconds.
|
||||
* @param _pd Presentation delay in microseconds.
|
||||
*
|
||||
* Backing buffers are sized to `CONFIG_BT_AUDIO_CODEC_CFG_MAX_*_SIZE` so
|
||||
* the preset is safe to mutate via `esp_ble_audio_codec_cfg_*_set_*`.
|
||||
*/
|
||||
#define ESP_BLE_AUDIO_GMAP_LC3_PRESET_DEFINE(_name, _freq, _duration, _loc, _len, \
|
||||
_frames_per_sdu, _stream_context, \
|
||||
_interval, _sdu, _rtn, _latency, _pd) \
|
||||
static uint8_t codec_cfg_data_##_name[] = \
|
||||
static uint8_t codec_cfg_data_##_name[CONFIG_BT_AUDIO_CODEC_CFG_MAX_DATA_SIZE] = \
|
||||
ESP_BLE_AUDIO_CODEC_CFG_LC3_DATA(_freq, _duration, _loc, _len, _frames_per_sdu); \
|
||||
static uint8_t codec_cfg_meta_##_name[] = \
|
||||
static uint8_t codec_cfg_meta_##_name[CONFIG_BT_AUDIO_CODEC_CFG_MAX_METADATA_SIZE] = \
|
||||
ESP_BLE_AUDIO_CODEC_CFG_LC3_META(_stream_context); \
|
||||
static esp_ble_audio_bap_lc3_preset_t _name = \
|
||||
ESP_BLE_AUDIO_BAP_LC3_PRESET(ESP_BLE_AUDIO_CODEC_CFG_LC3(codec_cfg_data_##_name, \
|
||||
codec_cfg_meta_##_name), \
|
||||
ESP_BLE_AUDIO_BAP_QOS_CFG_UNFRAMED(_interval, _sdu, _rtn, \
|
||||
_latency, _pd));
|
||||
ESP_BLE_AUDIO_BAP_LC3_PRESET( \
|
||||
ESP_BLE_AUDIO_CODEC_CFG_LC3_LEN( \
|
||||
codec_cfg_data_##_name, \
|
||||
sizeof((uint8_t[])ESP_BLE_AUDIO_CODEC_CFG_LC3_DATA(_freq, _duration, _loc, \
|
||||
_len, _frames_per_sdu)), \
|
||||
codec_cfg_meta_##_name, \
|
||||
sizeof((uint8_t[])ESP_BLE_AUDIO_CODEC_CFG_LC3_META(_stream_context))), \
|
||||
ESP_BLE_AUDIO_BAP_QOS_CFG_UNFRAMED(_interval, _sdu, _rtn, _latency, _pd));
|
||||
|
||||
/**
|
||||
* @brief Gaming Reliable (GR) preset at 32kHz, 7.5ms frame duration.
|
||||
|
||||
@@ -52,6 +52,13 @@ extern "C" {
|
||||
#define ESP_BLE_AUDIO_CODEC_CAP_LC3(_data, _meta) \
|
||||
ESP_BLE_AUDIO_CODEC_CAP(ESP_BLE_ISO_CODING_FORMAT_LC3, 0x0000, 0x0000, _data, _meta)
|
||||
|
||||
/**
|
||||
* @brief Variant of ESP_BLE_AUDIO_CODEC_CAP_LC3 with explicit LVT content lengths.
|
||||
*/
|
||||
#define ESP_BLE_AUDIO_CODEC_CAP_LC3_LEN(_data, _data_len, _meta, _meta_len) \
|
||||
ESP_BLE_AUDIO_CODEC_CAP_LEN(ESP_BLE_ISO_CODING_FORMAT_LC3, 0x0000, 0x0000, \
|
||||
_data, _data_len, _meta, _meta_len)
|
||||
|
||||
/**
|
||||
* @brief Helper to declare LC3 codec data configuration.
|
||||
*
|
||||
@@ -82,6 +89,13 @@ extern "C" {
|
||||
#define ESP_BLE_AUDIO_CODEC_CFG_LC3(_data, _meta) \
|
||||
ESP_BLE_AUDIO_CODEC_CFG(ESP_BLE_ISO_CODING_FORMAT_LC3, 0x0000, 0x0000, _data, _meta)
|
||||
|
||||
/**
|
||||
* @brief Variant of ESP_BLE_AUDIO_CODEC_CFG_LC3 with explicit LVT content lengths.
|
||||
*/
|
||||
#define ESP_BLE_AUDIO_CODEC_CFG_LC3_LEN(_data, _data_len, _meta, _meta_len) \
|
||||
ESP_BLE_AUDIO_CODEC_CFG_LEN(ESP_BLE_ISO_CODING_FORMAT_LC3, 0x0000, 0x0000, \
|
||||
_data, _data_len, _meta, _meta_len)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user