mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
component/bt: bug fix for HCI packet reassmebler
1. bug fix for HCI packet reassmebler; audio stream can be received; 2. fix some log message typos
This commit is contained in:
parent
ea75dc7064
commit
1fdaf74c4f
@ -142,8 +142,7 @@ static void reassemble_and_dispatch(BT_HDR *packet) {
|
|||||||
uint16_t full_length;
|
uint16_t full_length;
|
||||||
if (partial_packet) {
|
if (partial_packet) {
|
||||||
LOG_WARN("%s found unfinished packet for handle with start packet. Dropping old.", __func__);
|
LOG_WARN("%s found unfinished packet for handle with start packet. Dropping old.", __func__);
|
||||||
|
hash_map_erase(partial_packets, (void *)(uintptr_t)handle);
|
||||||
hash_map_erase(partial_packets, (void *)(uintptr_t)handle);
|
|
||||||
buffer_allocator->free(partial_packet);
|
buffer_allocator->free(partial_packet);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -151,7 +150,7 @@ static void reassemble_and_dispatch(BT_HDR *packet) {
|
|||||||
if (full_length <= packet->len) {
|
if (full_length <= packet->len) {
|
||||||
if (full_length < packet->len)
|
if (full_length < packet->len)
|
||||||
LOG_WARN("%s found l2cap full length %d less than the hci length %d.", __func__, l2cap_length, packet->len);
|
LOG_WARN("%s found l2cap full length %d less than the hci length %d.", __func__, l2cap_length, packet->len);
|
||||||
|
|
||||||
callbacks->reassembled(packet);
|
callbacks->reassembled(packet);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -161,7 +160,6 @@ static void reassemble_and_dispatch(BT_HDR *packet) {
|
|||||||
partial_packet->len = full_length;
|
partial_packet->len = full_length;
|
||||||
partial_packet->offset = packet->len;
|
partial_packet->offset = packet->len;
|
||||||
|
|
||||||
// org: memcpy(partial_packet->data, packet->data, packet->len);
|
|
||||||
memcpy(partial_packet->data, packet->data+packet->offset, packet->len);
|
memcpy(partial_packet->data, packet->data+packet->offset, packet->len);
|
||||||
|
|
||||||
// Update the ACL data size to indicate the full expected length
|
// Update the ACL data size to indicate the full expected length
|
||||||
@ -180,11 +178,10 @@ static void reassemble_and_dispatch(BT_HDR *packet) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// org: packet->offset = HCI_ACL_PREAMBLE_SIZE;
|
|
||||||
packet->offset += HCI_ACL_PREAMBLE_SIZE; // skip ACL preamble
|
packet->offset += HCI_ACL_PREAMBLE_SIZE; // skip ACL preamble
|
||||||
packet->len -= HCI_ACL_PREAMBLE_SIZE;
|
packet->len -= HCI_ACL_PREAMBLE_SIZE;
|
||||||
|
|
||||||
projected_offset = partial_packet->offset + (packet->len - HCI_ACL_PREAMBLE_SIZE);
|
projected_offset = partial_packet->offset + packet->len;
|
||||||
if (projected_offset > partial_packet->len) { // len stores the expected length
|
if (projected_offset > partial_packet->len) { // len stores the expected length
|
||||||
LOG_WARN("%s got packet which would exceed expected length of %d. Truncating.", __func__, partial_packet->len);
|
LOG_WARN("%s got packet which would exceed expected length of %d. Truncating.", __func__, partial_packet->len);
|
||||||
packet->len = partial_packet->len - partial_packet->offset;
|
packet->len = partial_packet->len - partial_packet->offset;
|
||||||
@ -194,10 +191,8 @@ static void reassemble_and_dispatch(BT_HDR *packet) {
|
|||||||
memcpy(
|
memcpy(
|
||||||
partial_packet->data + partial_packet->offset,
|
partial_packet->data + partial_packet->offset,
|
||||||
packet->data + packet->offset,
|
packet->data + packet->offset,
|
||||||
// org: packet->len - packet->offset
|
|
||||||
packet->len
|
packet->len
|
||||||
);
|
);
|
||||||
|
|
||||||
// Free the old packet buffer, since we don't need it anymore
|
// Free the old packet buffer, since we don't need it anymore
|
||||||
buffer_allocator->free(packet);
|
buffer_allocator->free(packet);
|
||||||
partial_packet->offset = projected_offset;
|
partial_packet->offset = projected_offset;
|
||||||
|
@ -91,7 +91,7 @@ static UINT8 avdt_ad_tcid_to_type(UINT8 tcid)
|
|||||||
*/
|
*/
|
||||||
type = ((tcid + AVDT_CHAN_NUM_TYPES - 2) % (AVDT_CHAN_NUM_TYPES - 1)) + 1;
|
type = ((tcid + AVDT_CHAN_NUM_TYPES - 2) % (AVDT_CHAN_NUM_TYPES - 1)) + 1;
|
||||||
}
|
}
|
||||||
AVDT_TRACE_DEBUG("tcid: %d, type: %d", tcid, type);
|
AVDT_TRACE_DEBUG("tcid: %d, type: %d\n", tcid, type);
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -302,7 +302,7 @@ tAVDT_TC_TBL *avdt_ad_tc_tbl_alloc(tAVDT_CCB *p_ccb)
|
|||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
UINT8 avdt_ad_tc_tbl_to_idx(tAVDT_TC_TBL *p_tbl)
|
UINT8 avdt_ad_tc_tbl_to_idx(tAVDT_TC_TBL *p_tbl)
|
||||||
{
|
{
|
||||||
AVDT_TRACE_DEBUG("avdt_ad_tc_tbl_to_idx: %d", (p_tbl - avdt_cb.ad.tc_tbl));
|
AVDT_TRACE_DEBUG("avdt_ad_tc_tbl_to_idx: %d\n", (p_tbl - avdt_cb.ad.tc_tbl));
|
||||||
/* use array arithmetic to determine index */
|
/* use array arithmetic to determine index */
|
||||||
return (UINT8) (p_tbl - avdt_cb.ad.tc_tbl);
|
return (UINT8) (p_tbl - avdt_cb.ad.tc_tbl);
|
||||||
}
|
}
|
||||||
@ -334,7 +334,7 @@ void avdt_ad_tc_close_ind(tAVDT_TC_TBL *p_tbl, UINT16 reason)
|
|||||||
p_tbl->cfg_flags = 0;
|
p_tbl->cfg_flags = 0;
|
||||||
p_tbl->peer_mtu = L2CAP_DEFAULT_MTU;
|
p_tbl->peer_mtu = L2CAP_DEFAULT_MTU;
|
||||||
|
|
||||||
AVDT_TRACE_DEBUG("avdt_ad_tc_close_ind tcid: %d, old: %d",
|
AVDT_TRACE_DEBUG("avdt_ad_tc_close_ind tcid: %d, old: %d\n",
|
||||||
p_tbl->tcid, close.old_tc_state);
|
p_tbl->tcid, close.old_tc_state);
|
||||||
/* if signaling channel, notify ccb that channel open */
|
/* if signaling channel, notify ccb that channel open */
|
||||||
if (p_tbl->tcid == 0)
|
if (p_tbl->tcid == 0)
|
||||||
@ -548,7 +548,7 @@ void avdt_ad_open_req(UINT8 type, tAVDT_CCB *p_ccb, tAVDT_SCB *p_scb, UINT8 role
|
|||||||
|
|
||||||
|
|
||||||
p_tbl->tcid = avdt_ad_type_to_tcid(type, p_scb);
|
p_tbl->tcid = avdt_ad_type_to_tcid(type, p_scb);
|
||||||
AVDT_TRACE_DEBUG("avdt_ad_open_req: type: %d, role: %d, tcid:%d",
|
AVDT_TRACE_DEBUG("avdt_ad_open_req: type: %d, role: %d, tcid:%d\n",
|
||||||
type, role, p_tbl->tcid);
|
type, role, p_tbl->tcid);
|
||||||
|
|
||||||
if (type == AVDT_CHAN_SIG)
|
if (type == AVDT_CHAN_SIG)
|
||||||
@ -565,7 +565,7 @@ void avdt_ad_open_req(UINT8 type, tAVDT_CCB *p_ccb, tAVDT_SCB *p_scb, UINT8 role
|
|||||||
|
|
||||||
/* also set scb_hdl in rt_tbl */
|
/* also set scb_hdl in rt_tbl */
|
||||||
avdt_cb.ad.rt_tbl[avdt_ccb_to_idx(p_ccb)][p_tbl->tcid].scb_hdl = avdt_scb_to_hdl(p_scb);
|
avdt_cb.ad.rt_tbl[avdt_ccb_to_idx(p_ccb)][p_tbl->tcid].scb_hdl = avdt_scb_to_hdl(p_scb);
|
||||||
AVDT_TRACE_DEBUG("avdt_cb.ad.rt_tbl[%d][%d].scb_hdl = %d",
|
AVDT_TRACE_DEBUG("avdt_cb.ad.rt_tbl[%d][%d].scb_hdl = %d\n",
|
||||||
avdt_ccb_to_idx(p_ccb), p_tbl->tcid,
|
avdt_ccb_to_idx(p_ccb), p_tbl->tcid,
|
||||||
avdt_scb_to_hdl(p_scb));
|
avdt_scb_to_hdl(p_scb));
|
||||||
}
|
}
|
||||||
@ -585,11 +585,11 @@ void avdt_ad_open_req(UINT8 type, tAVDT_CCB *p_ccb, tAVDT_SCB *p_scb, UINT8 role
|
|||||||
{
|
{
|
||||||
/* if connect req ok, store tcid in lcid table */
|
/* if connect req ok, store tcid in lcid table */
|
||||||
avdt_cb.ad.lcid_tbl[lcid - L2CAP_BASE_APPL_CID] = avdt_ad_tc_tbl_to_idx(p_tbl);
|
avdt_cb.ad.lcid_tbl[lcid - L2CAP_BASE_APPL_CID] = avdt_ad_tc_tbl_to_idx(p_tbl);
|
||||||
AVDT_TRACE_DEBUG("avdt_cb.ad.lcid_tbl[%d] = %d",
|
AVDT_TRACE_DEBUG("avdt_cb.ad.lcid_tbl[%d] = %d\n",
|
||||||
(lcid - L2CAP_BASE_APPL_CID), avdt_ad_tc_tbl_to_idx(p_tbl));
|
(lcid - L2CAP_BASE_APPL_CID), avdt_ad_tc_tbl_to_idx(p_tbl));
|
||||||
|
|
||||||
avdt_cb.ad.rt_tbl[avdt_ccb_to_idx(p_ccb)][p_tbl->tcid].lcid = lcid;
|
avdt_cb.ad.rt_tbl[avdt_ccb_to_idx(p_ccb)][p_tbl->tcid].lcid = lcid;
|
||||||
AVDT_TRACE_DEBUG("avdt_cb.ad.rt_tbl[%d][%d].lcid = 0x%x",
|
AVDT_TRACE_DEBUG("avdt_cb.ad.rt_tbl[%d][%d].lcid = 0x%x\n",
|
||||||
avdt_ccb_to_idx(p_ccb), p_tbl->tcid,
|
avdt_ccb_to_idx(p_ccb), p_tbl->tcid,
|
||||||
lcid);
|
lcid);
|
||||||
}
|
}
|
||||||
@ -619,7 +619,7 @@ void avdt_ad_close_req(UINT8 type, tAVDT_CCB *p_ccb, tAVDT_SCB *p_scb)
|
|||||||
tAVDT_TC_TBL *p_tbl;
|
tAVDT_TC_TBL *p_tbl;
|
||||||
|
|
||||||
p_tbl = avdt_ad_tc_tbl_by_type(type, p_ccb, p_scb);
|
p_tbl = avdt_ad_tc_tbl_by_type(type, p_ccb, p_scb);
|
||||||
AVDT_TRACE_DEBUG("avdt_ad_close_req state: %d", p_tbl->state);
|
AVDT_TRACE_DEBUG("avdt_ad_close_req state: %d\n", p_tbl->state);
|
||||||
|
|
||||||
switch(p_tbl->state)
|
switch(p_tbl->state)
|
||||||
{
|
{
|
||||||
|
@ -224,14 +224,14 @@ void AVDT_SINK_Deactivate()
|
|||||||
|
|
||||||
void AVDT_AbortReq(UINT8 handle)
|
void AVDT_AbortReq(UINT8 handle)
|
||||||
{
|
{
|
||||||
AVDT_TRACE_ERROR("%s", __func__);
|
AVDT_TRACE_ERROR("%s\n", __func__);
|
||||||
|
|
||||||
tAVDT_SCB *p_scb = avdt_scb_by_hdl(handle);
|
tAVDT_SCB *p_scb = avdt_scb_by_hdl(handle);
|
||||||
if (p_scb != NULL)
|
if (p_scb != NULL)
|
||||||
{
|
{
|
||||||
avdt_scb_event(p_scb, AVDT_SCB_API_ABORT_REQ_EVT, NULL);
|
avdt_scb_event(p_scb, AVDT_SCB_API_ABORT_REQ_EVT, NULL);
|
||||||
} else {
|
} else {
|
||||||
AVDT_TRACE_ERROR("%s Improper SCB, can not abort the stream", __func__);
|
AVDT_TRACE_ERROR("%s Improper SCB, can not abort the stream\n", __func__);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -383,7 +383,7 @@ static UINT16 avdt_get_cap_req(BD_ADDR bd_addr, tAVDT_CCB_API_GETCAP *p_evt)
|
|||||||
/* verify SEID */
|
/* verify SEID */
|
||||||
if ((p_evt->single.seid < AVDT_SEID_MIN) || (p_evt->single.seid > AVDT_SEID_MAX))
|
if ((p_evt->single.seid < AVDT_SEID_MIN) || (p_evt->single.seid > AVDT_SEID_MAX))
|
||||||
{
|
{
|
||||||
AVDT_TRACE_ERROR("seid: %d", p_evt->single.seid);
|
AVDT_TRACE_ERROR("seid: %d\n", p_evt->single.seid);
|
||||||
result = AVDT_BAD_PARAMS;
|
result = AVDT_BAD_PARAMS;
|
||||||
}
|
}
|
||||||
/* find channel control block for this bd addr; if none, allocate one */
|
/* find channel control block for this bd addr; if none, allocate one */
|
||||||
@ -1194,7 +1194,7 @@ extern UINT16 AVDT_WriteDataReq(UINT8 handle, UINT8 *p_data, UINT32 data_len,
|
|||||||
result = AVDT_BAD_HANDLE;
|
result = AVDT_BAD_HANDLE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
AVDT_TRACE_WARNING("mux_tsid_media:%d", p_scb->curr_cfg.mux_tsid_media);
|
AVDT_TRACE_WARNING("mux_tsid_media:%d\n", p_scb->curr_cfg.mux_tsid_media);
|
||||||
|
|
||||||
if (p_scb->p_pkt != NULL
|
if (p_scb->p_pkt != NULL
|
||||||
|| p_scb->p_ccb == NULL
|
|| p_scb->p_ccb == NULL
|
||||||
@ -1203,7 +1203,7 @@ extern UINT16 AVDT_WriteDataReq(UINT8 handle, UINT8 *p_data, UINT32 data_len,
|
|||||||
|| p_scb->curr_cfg.mux_tsid_media == 0)
|
|| p_scb->curr_cfg.mux_tsid_media == 0)
|
||||||
{
|
{
|
||||||
result = AVDT_ERR_BAD_STATE;
|
result = AVDT_ERR_BAD_STATE;
|
||||||
AVDT_TRACE_WARNING("p_scb->p_pkt=%x, p_scb->p_ccb=%x, IsQueueEmpty=%x, p_scb->frag_off=%x",
|
AVDT_TRACE_WARNING("p_scb->p_pkt=%x, p_scb->p_ccb=%x, IsQueueEmpty=%x, p_scb->frag_off=%x\n",
|
||||||
p_scb->p_pkt, p_scb->p_ccb, GKI_queue_is_empty(&p_scb->frag_q), p_scb->frag_off);
|
p_scb->p_pkt, p_scb->p_ccb, GKI_queue_is_empty(&p_scb->frag_q), p_scb->frag_off);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1232,7 +1232,7 @@ extern UINT16 AVDT_WriteDataReq(UINT8 handle, UINT8 *p_data, UINT32 data_len,
|
|||||||
#if (BT_USE_TRACES == TRUE)
|
#if (BT_USE_TRACES == TRUE)
|
||||||
if(result != AVDT_SUCCESS)
|
if(result != AVDT_SUCCESS)
|
||||||
{
|
{
|
||||||
AVDT_TRACE_WARNING("*** AVDT_WriteDataReq failed result=%d",result);
|
AVDT_TRACE_WARNING("*** AVDT_WriteDataReq failed result=%d\n",result);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return result;
|
return result;
|
||||||
@ -1355,9 +1355,9 @@ UINT16 AVDT_SendReport(UINT8 handle, AVDT_REPORT_TYPE type,
|
|||||||
|
|
||||||
case AVDT_RTCP_PT_RR: /* Receiver Report */
|
case AVDT_RTCP_PT_RR: /* Receiver Report */
|
||||||
*p++ = p_data->rr.frag_lost;
|
*p++ = p_data->rr.frag_lost;
|
||||||
AVDT_TRACE_API("packet_lost: %d", p_data->rr.packet_lost);
|
AVDT_TRACE_API("packet_lost: %d\n", p_data->rr.packet_lost);
|
||||||
p_data->rr.packet_lost &= 0xFFFFFF;
|
p_data->rr.packet_lost &= 0xFFFFFF;
|
||||||
AVDT_TRACE_API("packet_lost: %d", p_data->rr.packet_lost);
|
AVDT_TRACE_API("packet_lost: %d\n", p_data->rr.packet_lost);
|
||||||
UINT24_TO_BE_STREAM(p, p_data->rr.packet_lost);
|
UINT24_TO_BE_STREAM(p, p_data->rr.packet_lost);
|
||||||
UINT32_TO_BE_STREAM(p, p_data->rr.seq_num_rcvd);
|
UINT32_TO_BE_STREAM(p, p_data->rr.seq_num_rcvd);
|
||||||
UINT32_TO_BE_STREAM(p, p_data->rr.jitter);
|
UINT32_TO_BE_STREAM(p, p_data->rr.jitter);
|
||||||
|
@ -302,7 +302,7 @@ void avdt_ccb_event(tAVDT_CCB *p_ccb, UINT8 event, tAVDT_CCB_EVT *p_data)
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
#if AVDT_DEBUG == TRUE
|
#if AVDT_DEBUG == TRUE
|
||||||
AVDT_TRACE_EVENT("CCB ccb=%d event=%s state=%s", avdt_ccb_to_idx(p_ccb), avdt_ccb_evt_str[event], avdt_ccb_st_str[p_ccb->state]);
|
AVDT_TRACE_EVENT("CCB ccb=%d event=%s state=%s\n", avdt_ccb_to_idx(p_ccb), avdt_ccb_evt_str[event], avdt_ccb_st_str[p_ccb->state]);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* look up the state table for the current state */
|
/* look up the state table for the current state */
|
||||||
@ -357,7 +357,7 @@ tAVDT_CCB *avdt_ccb_by_bd(BD_ADDR bd_addr)
|
|||||||
/* if no ccb found */
|
/* if no ccb found */
|
||||||
p_ccb = NULL;
|
p_ccb = NULL;
|
||||||
|
|
||||||
AVDT_TRACE_DEBUG("No ccb for addr %02x-%02x-%02x-%02x-%02x-%02x",
|
AVDT_TRACE_DEBUG("No ccb for addr %02x-%02x-%02x-%02x-%02x-%02x\n",
|
||||||
bd_addr[0], bd_addr[1], bd_addr[2], bd_addr[3], bd_addr[4], bd_addr[5]);
|
bd_addr[0], bd_addr[1], bd_addr[2], bd_addr[3], bd_addr[4], bd_addr[5]);
|
||||||
}
|
}
|
||||||
return p_ccb;
|
return p_ccb;
|
||||||
@ -387,7 +387,7 @@ tAVDT_CCB *avdt_ccb_alloc(BD_ADDR bd_addr)
|
|||||||
GKI_init_q(&p_ccb->cmd_q);
|
GKI_init_q(&p_ccb->cmd_q);
|
||||||
GKI_init_q(&p_ccb->rsp_q);
|
GKI_init_q(&p_ccb->rsp_q);
|
||||||
p_ccb->timer_entry.param = (UINT32) p_ccb;
|
p_ccb->timer_entry.param = (UINT32) p_ccb;
|
||||||
AVDT_TRACE_DEBUG("avdt_ccb_alloc %d", i);
|
AVDT_TRACE_DEBUG("avdt_ccb_alloc %d\n", i);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -415,7 +415,7 @@ void avdt_ccb_dealloc(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data)
|
|||||||
{
|
{
|
||||||
UNUSED(p_data);
|
UNUSED(p_data);
|
||||||
|
|
||||||
AVDT_TRACE_DEBUG("avdt_ccb_dealloc %d", avdt_ccb_to_idx(p_ccb));
|
AVDT_TRACE_DEBUG("avdt_ccb_dealloc %d\n", avdt_ccb_to_idx(p_ccb));
|
||||||
btu_stop_timer(&p_ccb->timer_entry);
|
btu_stop_timer(&p_ccb->timer_entry);
|
||||||
memset(p_ccb, 0, sizeof(tAVDT_CCB));
|
memset(p_ccb, 0, sizeof(tAVDT_CCB));
|
||||||
}
|
}
|
||||||
@ -458,7 +458,7 @@ tAVDT_CCB *avdt_ccb_by_idx(UINT8 idx)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
p_ccb = NULL;
|
p_ccb = NULL;
|
||||||
AVDT_TRACE_WARNING("No ccb for idx %d", idx);
|
AVDT_TRACE_WARNING("No ccb for idx %d\n", idx);
|
||||||
}
|
}
|
||||||
return p_ccb;
|
return p_ccb;
|
||||||
}
|
}
|
||||||
|
@ -78,7 +78,7 @@ static void avdt_sec_check_complete_term (BD_ADDR bd_addr, tBT_TRANSPORT transpo
|
|||||||
tAVDT_TC_TBL *p_tbl;
|
tAVDT_TC_TBL *p_tbl;
|
||||||
UNUSED(p_ref_data);
|
UNUSED(p_ref_data);
|
||||||
|
|
||||||
AVDT_TRACE_DEBUG("avdt_sec_check_complete_term res: %d", res);
|
AVDT_TRACE_DEBUG("avdt_sec_check_complete_term res: %d\n", res);
|
||||||
if (!bd_addr)
|
if (!bd_addr)
|
||||||
{
|
{
|
||||||
AVDT_TRACE_WARNING("avdt_sec_check_complete_term: NULL BD_ADDR");
|
AVDT_TRACE_WARNING("avdt_sec_check_complete_term: NULL BD_ADDR");
|
||||||
@ -136,7 +136,7 @@ static void avdt_sec_check_complete_orig (BD_ADDR bd_addr, tBT_TRANSPORT trasnpo
|
|||||||
tAVDT_TC_TBL *p_tbl;
|
tAVDT_TC_TBL *p_tbl;
|
||||||
UNUSED(p_ref_data);
|
UNUSED(p_ref_data);
|
||||||
|
|
||||||
AVDT_TRACE_DEBUG("avdt_sec_check_complete_orig res: %d", res);
|
AVDT_TRACE_DEBUG("avdt_sec_check_complete_orig res: %d\n", res);
|
||||||
if (bd_addr)
|
if (bd_addr)
|
||||||
p_ccb = avdt_ccb_by_bd(bd_addr);
|
p_ccb = avdt_ccb_by_bd(bd_addr);
|
||||||
p_tbl = avdt_ad_tc_tbl_by_st(AVDT_CHAN_SIG, p_ccb, AVDT_AD_ST_SEC_INT);
|
p_tbl = avdt_ad_tc_tbl_by_st(AVDT_CHAN_SIG, p_ccb, AVDT_AD_ST_SEC_INT);
|
||||||
@ -283,7 +283,7 @@ void avdt_l2c_connect_cfm_cback(UINT16 lcid, UINT16 result)
|
|||||||
tL2CAP_CFG_INFO cfg;
|
tL2CAP_CFG_INFO cfg;
|
||||||
tAVDT_CCB *p_ccb;
|
tAVDT_CCB *p_ccb;
|
||||||
|
|
||||||
AVDT_TRACE_DEBUG("avdt_l2c_connect_cfm_cback lcid: %d, result: %d",
|
AVDT_TRACE_DEBUG("avdt_l2c_connect_cfm_cback lcid: %d, result: %d\n",
|
||||||
lcid, result);
|
lcid, result);
|
||||||
/* look up info for this channel */
|
/* look up info for this channel */
|
||||||
if ((p_tbl = avdt_ad_tc_tbl_by_lcid(lcid)) != NULL)
|
if ((p_tbl = avdt_ad_tc_tbl_by_lcid(lcid)) != NULL)
|
||||||
@ -409,7 +409,7 @@ void avdt_l2c_config_ind_cback(UINT16 lcid, tL2CAP_CFG_INFO *p_cfg)
|
|||||||
{
|
{
|
||||||
p_tbl->peer_mtu = L2CAP_DEFAULT_MTU;
|
p_tbl->peer_mtu = L2CAP_DEFAULT_MTU;
|
||||||
}
|
}
|
||||||
AVDT_TRACE_DEBUG("peer_mtu: %d, lcid: x%x",p_tbl->peer_mtu, lcid);
|
AVDT_TRACE_DEBUG("peer_mtu: %d, lcid: x%x\n",p_tbl->peer_mtu, lcid);
|
||||||
|
|
||||||
/* send L2CAP configure response */
|
/* send L2CAP configure response */
|
||||||
memset(p_cfg, 0, sizeof(tL2CAP_CFG_INFO));
|
memset(p_cfg, 0, sizeof(tL2CAP_CFG_INFO));
|
||||||
@ -445,7 +445,7 @@ void avdt_l2c_disconnect_ind_cback(UINT16 lcid, BOOLEAN ack_needed)
|
|||||||
{
|
{
|
||||||
tAVDT_TC_TBL *p_tbl;
|
tAVDT_TC_TBL *p_tbl;
|
||||||
|
|
||||||
AVDT_TRACE_DEBUG("avdt_l2c_disconnect_ind_cback lcid: %d, ack_needed: %d",
|
AVDT_TRACE_DEBUG("avdt_l2c_disconnect_ind_cback lcid: %d, ack_needed: %d\n",
|
||||||
lcid, ack_needed);
|
lcid, ack_needed);
|
||||||
/* look up info for this channel */
|
/* look up info for this channel */
|
||||||
if ((p_tbl = avdt_ad_tc_tbl_by_lcid(lcid)) != NULL)
|
if ((p_tbl = avdt_ad_tc_tbl_by_lcid(lcid)) != NULL)
|
||||||
@ -474,7 +474,7 @@ void avdt_l2c_disconnect_cfm_cback(UINT16 lcid, UINT16 result)
|
|||||||
{
|
{
|
||||||
tAVDT_TC_TBL *p_tbl;
|
tAVDT_TC_TBL *p_tbl;
|
||||||
|
|
||||||
AVDT_TRACE_DEBUG("avdt_l2c_disconnect_cfm_cback lcid: %d, result: %d",
|
AVDT_TRACE_DEBUG("avdt_l2c_disconnect_cfm_cback lcid: %d, result: %d\n",
|
||||||
lcid, result);
|
lcid, result);
|
||||||
/* look up info for this channel */
|
/* look up info for this channel */
|
||||||
if ((p_tbl = avdt_ad_tc_tbl_by_lcid(lcid)) != NULL)
|
if ((p_tbl = avdt_ad_tc_tbl_by_lcid(lcid)) != NULL)
|
||||||
|
@ -633,7 +633,7 @@ static UINT8 avdt_msg_prs_cfg(tAVDT_CFG *p_cfg, UINT8 *p, UINT16 len, UINT8* p_e
|
|||||||
{
|
{
|
||||||
/* Skip unknown categories. */
|
/* Skip unknown categories. */
|
||||||
p += elem_len;
|
p += elem_len;
|
||||||
AVDT_TRACE_DEBUG("skipping unknown service category=%d len: %d", elem, elem_len);
|
AVDT_TRACE_DEBUG("skipping unknown service category=%d len: %d\n", elem, elem_len);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -647,7 +647,7 @@ static UINT8 avdt_msg_prs_cfg(tAVDT_CFG *p_cfg, UINT8 *p, UINT16 len, UINT8* p_e
|
|||||||
|
|
||||||
/* add element to psc mask, but mask out codec or protect */
|
/* add element to psc mask, but mask out codec or protect */
|
||||||
p_cfg->psc_mask |= (1 << elem);
|
p_cfg->psc_mask |= (1 << elem);
|
||||||
AVDT_TRACE_DEBUG("elem=%d elem_len: %d psc_mask=0x%x", elem, elem_len, p_cfg->psc_mask);
|
AVDT_TRACE_DEBUG("elem=%d elem_len: %d psc_mask=0x%x\n", elem, elem_len, p_cfg->psc_mask);
|
||||||
|
|
||||||
/* parse individual information elements with additional parameters */
|
/* parse individual information elements with additional parameters */
|
||||||
switch (elem)
|
switch (elem)
|
||||||
@ -689,7 +689,7 @@ static UINT8 avdt_msg_prs_cfg(tAVDT_CFG *p_cfg, UINT8 *p, UINT16 len, UINT8* p_e
|
|||||||
#if AVDT_MULTIPLEXING == TRUE
|
#if AVDT_MULTIPLEXING == TRUE
|
||||||
case AVDT_CAT_MUX:
|
case AVDT_CAT_MUX:
|
||||||
/* verify length */
|
/* verify length */
|
||||||
AVDT_TRACE_WARNING("psc_mask=0x%x elem_len=%d", p_cfg->psc_mask, elem_len);
|
AVDT_TRACE_WARNING("psc_mask=0x%x elem_len=%d\n", p_cfg->psc_mask, elem_len);
|
||||||
if( ((0 == (p_cfg->psc_mask & (AVDT_PSC_RECOV|AVDT_PSC_REPORT))) && (elem_len != 3))
|
if( ((0 == (p_cfg->psc_mask & (AVDT_PSC_RECOV|AVDT_PSC_REPORT))) && (elem_len != 3))
|
||||||
|| (((p_cfg->psc_mask & AVDT_PSC_REPORT) && !(p_cfg->psc_mask & AVDT_PSC_RECOV))
|
|| (((p_cfg->psc_mask & AVDT_PSC_REPORT) && !(p_cfg->psc_mask & AVDT_PSC_RECOV))
|
||||||
&& (elem_len != 5))
|
&& (elem_len != 5))
|
||||||
@ -760,7 +760,7 @@ static UINT8 avdt_msg_prs_cfg(tAVDT_CFG *p_cfg, UINT8 *p, UINT16 len, UINT8* p_e
|
|||||||
} /* switch */
|
} /* switch */
|
||||||
} /* while ! err, !end*/
|
} /* while ! err, !end*/
|
||||||
*p_elem = elem;
|
*p_elem = elem;
|
||||||
AVDT_TRACE_DEBUG("err=0x%x, elem:0x%x psc_mask=0x%x", err, elem, p_cfg->psc_mask);
|
AVDT_TRACE_DEBUG("err=0x%x, elem:0x%x psc_mask=0x%x\n", err, elem, p_cfg->psc_mask);
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
@ -914,7 +914,7 @@ static UINT8 avdt_msg_prs_reconfig_cmd(tAVDT_MSG *p_msg, UINT8 *p, UINT16 len)
|
|||||||
/* verify no protocol service capabilities in parameters */
|
/* verify no protocol service capabilities in parameters */
|
||||||
if (!err)
|
if (!err)
|
||||||
{
|
{
|
||||||
AVDT_TRACE_DEBUG("avdt_msg_prs_reconfig_cmd psc_mask=0x%x/0x%x", p_msg->config_cmd.p_cfg->psc_mask, AVDT_MSG_PSC_MASK);
|
AVDT_TRACE_DEBUG("avdt_msg_prs_reconfig_cmd psc_mask=0x%x/0x%x\n", p_msg->config_cmd.p_cfg->psc_mask, AVDT_MSG_PSC_MASK);
|
||||||
if ((p_msg->config_cmd.p_cfg->psc_mask != 0) ||
|
if ((p_msg->config_cmd.p_cfg->psc_mask != 0) ||
|
||||||
(p_msg->config_cmd.p_cfg->num_codec == 0 && p_msg->config_cmd.p_cfg->num_protect == 0))
|
(p_msg->config_cmd.p_cfg->num_codec == 0 && p_msg->config_cmd.p_cfg->num_protect == 0))
|
||||||
{
|
{
|
||||||
@ -1161,7 +1161,7 @@ static UINT8 avdt_msg_prs_delay_rpt (tAVDT_MSG *p_msg, UINT8 *p, UINT16 len)
|
|||||||
/* verify len */
|
/* verify len */
|
||||||
if (len != AVDT_LEN_DELAY_RPT)
|
if (len != AVDT_LEN_DELAY_RPT)
|
||||||
{
|
{
|
||||||
AVDT_TRACE_WARNING("avdt_msg_prs_delay_rpt expected len: %u got: %u", AVDT_LEN_DELAY_RPT, len);
|
AVDT_TRACE_WARNING("avdt_msg_prs_delay_rpt expected len: %u got: %u\n", AVDT_LEN_DELAY_RPT, len);
|
||||||
err = AVDT_ERR_LENGTH;
|
err = AVDT_ERR_LENGTH;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1176,7 +1176,7 @@ static UINT8 avdt_msg_prs_delay_rpt (tAVDT_MSG *p_msg, UINT8 *p, UINT16 len)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
BE_STREAM_TO_UINT16 (p_msg->delay_rpt_cmd.delay, p);
|
BE_STREAM_TO_UINT16 (p_msg->delay_rpt_cmd.delay, p);
|
||||||
AVDT_TRACE_DEBUG("avdt_msg_prs_delay_rpt delay: %u", p_msg->delay_rpt_cmd.delay);
|
AVDT_TRACE_DEBUG("avdt_msg_prs_delay_rpt delay: %u\n", p_msg->delay_rpt_cmd.delay);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return err;
|
return err;
|
||||||
@ -1289,7 +1289,7 @@ BOOLEAN avdt_msg_send(tAVDT_CCB *p_ccb, BT_HDR *p_msg)
|
|||||||
label = AVDT_LAYERSPEC_LABEL(p_ccb->p_curr_msg->layer_specific);
|
label = AVDT_LAYERSPEC_LABEL(p_ccb->p_curr_msg->layer_specific);
|
||||||
msg = AVDT_LAYERSPEC_MSG(p_ccb->p_curr_msg->layer_specific);
|
msg = AVDT_LAYERSPEC_MSG(p_ccb->p_curr_msg->layer_specific);
|
||||||
sig = (UINT8) p_ccb->p_curr_msg->event;
|
sig = (UINT8) p_ccb->p_curr_msg->event;
|
||||||
AVDT_TRACE_DEBUG("avdt_msg_send label:%d, msg:%d, sig:%d", label, msg, sig);
|
AVDT_TRACE_DEBUG("avdt_msg_send label:%d, msg:%d, sig:%d\n", label, msg, sig);
|
||||||
|
|
||||||
/* keep track of how much of msg we've sent */
|
/* keep track of how much of msg we've sent */
|
||||||
curr_msg_len -= p_buf->len;
|
curr_msg_len -= p_buf->len;
|
||||||
@ -1412,7 +1412,7 @@ BT_HDR *avdt_msg_asmbl(tAVDT_CCB *p_ccb, BT_HDR *p_buf)
|
|||||||
if (p_ccb->p_rx_msg == NULL)
|
if (p_ccb->p_rx_msg == NULL)
|
||||||
{
|
{
|
||||||
GKI_freebuf(p_buf);
|
GKI_freebuf(p_buf);
|
||||||
AVDT_TRACE_WARNING("Pkt type=%d out of order", pkt_type);
|
AVDT_TRACE_WARNING("Pkt type=%d out of order\n", pkt_type);
|
||||||
p_ret = NULL;
|
p_ret = NULL;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1719,7 +1719,7 @@ void avdt_msg_ind(tAVDT_CCB *p_ccb, BT_HDR *p_buf)
|
|||||||
|
|
||||||
UNUSED(pkt_type);
|
UNUSED(pkt_type);
|
||||||
|
|
||||||
AVDT_TRACE_DEBUG("msg_type=%d, sig=%d", msg_type, sig);
|
AVDT_TRACE_DEBUG("msg_type=%d, sig=%d\n", msg_type, sig);
|
||||||
/* set up label and ccb_idx in message hdr */
|
/* set up label and ccb_idx in message hdr */
|
||||||
msg.hdr.label = label;
|
msg.hdr.label = label;
|
||||||
msg.hdr.ccb_idx = avdt_ccb_to_idx(p_ccb);
|
msg.hdr.ccb_idx = avdt_ccb_to_idx(p_ccb);
|
||||||
@ -1727,7 +1727,7 @@ void avdt_msg_ind(tAVDT_CCB *p_ccb, BT_HDR *p_buf)
|
|||||||
/* verify msg type */
|
/* verify msg type */
|
||||||
if (msg_type == AVDT_MSG_TYPE_GRJ)
|
if (msg_type == AVDT_MSG_TYPE_GRJ)
|
||||||
{
|
{
|
||||||
AVDT_TRACE_WARNING("Dropping msg msg_type=%d", msg_type);
|
AVDT_TRACE_WARNING("Dropping msg msg_type=%d\n", msg_type);
|
||||||
ok = FALSE;
|
ok = FALSE;
|
||||||
}
|
}
|
||||||
/* check for general reject */
|
/* check for general reject */
|
||||||
@ -1749,7 +1749,7 @@ void avdt_msg_ind(tAVDT_CCB *p_ccb, BT_HDR *p_buf)
|
|||||||
msg.hdr.sig_id = sig;
|
msg.hdr.sig_id = sig;
|
||||||
if ((sig == 0) || (sig > AVDT_SIG_MAX))
|
if ((sig == 0) || (sig > AVDT_SIG_MAX))
|
||||||
{
|
{
|
||||||
AVDT_TRACE_WARNING("Dropping msg sig=%d msg_type:%d", sig, msg_type);
|
AVDT_TRACE_WARNING("Dropping msg sig=%d msg_type:%d\n", sig, msg_type);
|
||||||
ok = FALSE;
|
ok = FALSE;
|
||||||
|
|
||||||
/* send a general reject */
|
/* send a general reject */
|
||||||
@ -1814,7 +1814,7 @@ void avdt_msg_ind(tAVDT_CCB *p_ccb, BT_HDR *p_buf)
|
|||||||
/* if parsing failed */
|
/* if parsing failed */
|
||||||
if (err != 0)
|
if (err != 0)
|
||||||
{
|
{
|
||||||
AVDT_TRACE_WARNING("Parsing failed sig=%d err=0x%x", sig, err);
|
AVDT_TRACE_WARNING("Parsing failed sig=%d err=0x%x\n", sig, err);
|
||||||
|
|
||||||
/* if its a rsp or rej, drop it; if its a cmd, send a rej;
|
/* if its a rsp or rej, drop it; if its a cmd, send a rej;
|
||||||
** note special case for abort; never send abort reject
|
** note special case for abort; never send abort reject
|
||||||
@ -1851,7 +1851,7 @@ void avdt_msg_ind(tAVDT_CCB *p_ccb, BT_HDR *p_buf)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
ok = FALSE;
|
ok = FALSE;
|
||||||
AVDT_TRACE_WARNING("Cmd not found for rsp sig=%d label=%d", sig, label);
|
AVDT_TRACE_WARNING("Cmd not found for rsp sig=%d label=%d\n", sig, label);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -529,7 +529,7 @@ void avdt_scb_event(tAVDT_SCB *p_scb, UINT8 event, tAVDT_SCB_EVT *p_data)
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
#if AVDT_DEBUG == TRUE
|
#if AVDT_DEBUG == TRUE
|
||||||
AVDT_TRACE_EVENT("SCB hdl=%d event=%d/%s state=%s", avdt_scb_to_hdl(p_scb), event, avdt_scb_evt_str[event], avdt_scb_st_str[p_scb->state]);
|
AVDT_TRACE_EVENT("SCB hdl=%d event=%d/%s state=%s\n", avdt_scb_to_hdl(p_scb), event, avdt_scb_evt_str[event], avdt_scb_st_str[p_scb->state]);
|
||||||
#endif
|
#endif
|
||||||
/* set current event */
|
/* set current event */
|
||||||
p_scb->curr_evt = event;
|
p_scb->curr_evt = event;
|
||||||
@ -621,7 +621,7 @@ tAVDT_SCB *avdt_scb_alloc(tAVDT_CS *p_cs)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
p_scb->timer_entry.param = (UINT32) p_scb;
|
p_scb->timer_entry.param = (UINT32) p_scb;
|
||||||
AVDT_TRACE_DEBUG("avdt_scb_alloc hdl=%d, psc_mask:0x%x", i+1, p_cs->cfg.psc_mask);
|
AVDT_TRACE_DEBUG("avdt_scb_alloc hdl=%d, psc_mask:0x%x\n", i+1, p_cs->cfg.psc_mask);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -653,7 +653,7 @@ void avdt_scb_dealloc(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data)
|
|||||||
#endif
|
#endif
|
||||||
UNUSED(p_data);
|
UNUSED(p_data);
|
||||||
|
|
||||||
AVDT_TRACE_DEBUG("avdt_scb_dealloc hdl=%d", avdt_scb_to_hdl(p_scb));
|
AVDT_TRACE_DEBUG("avdt_scb_dealloc hdl=%d\n", avdt_scb_to_hdl(p_scb));
|
||||||
btu_stop_timer(&p_scb->timer_entry);
|
btu_stop_timer(&p_scb->timer_entry);
|
||||||
|
|
||||||
#if AVDT_MULTIPLEXING == TRUE
|
#if AVDT_MULTIPLEXING == TRUE
|
||||||
@ -704,13 +704,13 @@ tAVDT_SCB *avdt_scb_by_hdl(UINT8 hdl)
|
|||||||
if (!p_scb->allocated)
|
if (!p_scb->allocated)
|
||||||
{
|
{
|
||||||
p_scb = NULL;
|
p_scb = NULL;
|
||||||
AVDT_TRACE_WARNING("scb hdl %d not allocated", hdl);
|
AVDT_TRACE_WARNING("scb hdl %d not allocated\n", hdl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
p_scb = NULL;
|
p_scb = NULL;
|
||||||
AVDT_TRACE_WARNING("scb hdl %d out of range", hdl);
|
AVDT_TRACE_WARNING("scb hdl %d out of range\n", hdl);
|
||||||
}
|
}
|
||||||
return p_scb;
|
return p_scb;
|
||||||
}
|
}
|
||||||
@ -732,7 +732,7 @@ UINT8 avdt_scb_verify(tAVDT_CCB *p_ccb, UINT8 state, UINT8 *p_seid, UINT16 num_s
|
|||||||
UINT8 nsc_mask;
|
UINT8 nsc_mask;
|
||||||
UINT8 ret = 0;
|
UINT8 ret = 0;
|
||||||
|
|
||||||
AVDT_TRACE_DEBUG("avdt_scb_verify state %d", state);
|
AVDT_TRACE_DEBUG("avdt_scb_verify state %d\n", state);
|
||||||
/* set nonsupported command mask */
|
/* set nonsupported command mask */
|
||||||
/* translate public state into private state */
|
/* translate public state into private state */
|
||||||
nsc_mask = 0;
|
nsc_mask = 0;
|
||||||
|
@ -380,14 +380,14 @@ UINT8 * avdt_scb_hdl_report(tAVDT_SCB *p_scb, UINT8 *p, UINT16 len)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AVDT_TRACE_WARNING( " - SDES SSRC=0x%08x sc=%d %d len=%d %s",
|
AVDT_TRACE_WARNING( " - SDES SSRC=0x%08x sc=%d %d len=%d %s\n",
|
||||||
ssrc, o_cc, *p, *(p+1), p+2);
|
ssrc, o_cc, *p, *(p+1), p+2);
|
||||||
result = AVDT_BUSY;
|
result = AVDT_BUSY;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
AVDT_TRACE_ERROR( "Bad Report pkt - packet type: %d", pt);
|
AVDT_TRACE_ERROR( "Bad Report pkt - packet type: %d\n", pt);
|
||||||
result = AVDT_BAD_PARAMS;
|
result = AVDT_BAD_PARAMS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -438,7 +438,7 @@ void avdt_scb_hdl_pkt_frag(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data)
|
|||||||
{
|
{
|
||||||
if (p_end - p < 4) /* length check. maximum length of AL header = 4 */
|
if (p_end - p < 4) /* length check. maximum length of AL header = 4 */
|
||||||
{
|
{
|
||||||
AVDT_TRACE_WARNING("p_end: 0x%x - p:0x%x < 4", p_end, p);
|
AVDT_TRACE_WARNING("p_end: 0x%x - p:0x%x < 4\n", p_end, p);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -488,7 +488,7 @@ void avdt_scb_hdl_pkt_frag(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data)
|
|||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
AVDT_TRACE_WARNING("bad tsid: %d, mux_tsid_media:%d", al_tsid, p_scb->curr_cfg.mux_tsid_media);
|
AVDT_TRACE_WARNING("bad tsid: %d, mux_tsid_media:%d\n", al_tsid, p_scb->curr_cfg.mux_tsid_media);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -503,7 +503,7 @@ void avdt_scb_hdl_pkt_frag(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data)
|
|||||||
/* it is media fragment beginning */
|
/* it is media fragment beginning */
|
||||||
if(!al_frag) /* is it first fragment of original media packet */
|
if(!al_frag) /* is it first fragment of original media packet */
|
||||||
{
|
{
|
||||||
AVDT_TRACE_DEBUG("al:%d media:%d",
|
AVDT_TRACE_DEBUG("al:%d media:%d\n",
|
||||||
al_len, p_scb->media_buf_len);
|
al_len, p_scb->media_buf_len);
|
||||||
|
|
||||||
p_scb->frag_off = 0;
|
p_scb->frag_off = 0;
|
||||||
@ -511,31 +511,31 @@ void avdt_scb_hdl_pkt_frag(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data)
|
|||||||
/* length check: minimum length of media header is 12 */
|
/* length check: minimum length of media header is 12 */
|
||||||
if (p_scb->frag_org_len < 12)
|
if (p_scb->frag_org_len < 12)
|
||||||
{
|
{
|
||||||
AVDT_TRACE_WARNING("bad al_len: %d(<12)", al_len);
|
AVDT_TRACE_WARNING("bad al_len: %d(<12)\n", al_len);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
/* check that data fit into buffer */
|
/* check that data fit into buffer */
|
||||||
if (al_len > p_scb->media_buf_len)
|
if (al_len > p_scb->media_buf_len)
|
||||||
{
|
{
|
||||||
AVDT_TRACE_WARNING("bad al_len: %d(>%d)", al_len, p_scb->media_buf_len);
|
AVDT_TRACE_WARNING("bad al_len: %d(>%d)\n", al_len, p_scb->media_buf_len);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
/* make sure it is the last fragment in l2cap packet */
|
/* make sure it is the last fragment in l2cap packet */
|
||||||
if (p + al_len < p_end)
|
if (p + al_len < p_end)
|
||||||
{
|
{
|
||||||
AVDT_TRACE_WARNING("bad al_len: %d(>%d)", al_len, p_scb->media_buf_len);
|
AVDT_TRACE_WARNING("bad al_len: %d(>%d)\n", al_len, p_scb->media_buf_len);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AVDT_TRACE_DEBUG("al:%d media:%d frag_org_len:%d frag_off:%d",
|
AVDT_TRACE_DEBUG("al:%d media:%d frag_org_len:%d frag_off:%d\n",
|
||||||
al_len, p_scb->media_buf_len, p_scb->frag_org_len, p_scb->frag_off);
|
al_len, p_scb->media_buf_len, p_scb->frag_org_len, p_scb->frag_off);
|
||||||
|
|
||||||
/* check that remaining length from AL header equals to original len - length of already received fragments */
|
/* check that remaining length from AL header equals to original len - length of already received fragments */
|
||||||
if(al_len != p_scb->frag_org_len - p_scb->frag_off)
|
if(al_len != p_scb->frag_org_len - p_scb->frag_off)
|
||||||
{
|
{
|
||||||
AVDT_TRACE_WARNING("al_len:%d != (frag_org_len:%d - frag_off:%d) %d",
|
AVDT_TRACE_WARNING("al_len:%d != (frag_org_len:%d - frag_off:%d) %d\n",
|
||||||
al_len, p_scb->frag_org_len, p_scb->frag_off,
|
al_len, p_scb->frag_org_len, p_scb->frag_off,
|
||||||
(p_scb->frag_org_len- p_scb->frag_off));
|
(p_scb->frag_org_len- p_scb->frag_off));
|
||||||
break;
|
break;
|
||||||
@ -551,12 +551,12 @@ void avdt_scb_hdl_pkt_frag(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data)
|
|||||||
/* do common sanity check */
|
/* do common sanity check */
|
||||||
if((p_scb->frag_org_len <= p_scb->frag_off) || (p_scb->frag_org_len >= p_scb->media_buf_len))
|
if((p_scb->frag_org_len <= p_scb->frag_off) || (p_scb->frag_org_len >= p_scb->media_buf_len))
|
||||||
{
|
{
|
||||||
AVDT_TRACE_WARNING("common sanity frag_off:%d frag_org_len:%d media_buf_len:%d",
|
AVDT_TRACE_WARNING("common sanity frag_off:%d frag_org_len:%d media_buf_len:%d\n",
|
||||||
p_scb->frag_off, p_scb->frag_org_len, p_scb->media_buf_len);
|
p_scb->frag_off, p_scb->frag_org_len, p_scb->media_buf_len);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
AVDT_TRACE_DEBUG("Received fragment org_len=%d off=%d al_len=%d frag_len=%d",
|
AVDT_TRACE_DEBUG("Received fragment org_len=%d off=%d al_len=%d frag_len=%d\n",
|
||||||
p_scb->frag_org_len, p_scb->frag_off, al_len, frag_len);
|
p_scb->frag_org_len, p_scb->frag_off, al_len, frag_len);
|
||||||
|
|
||||||
/* copy fragment into buffer */
|
/* copy fragment into buffer */
|
||||||
@ -587,7 +587,7 @@ void avdt_scb_hdl_pkt_frag(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data)
|
|||||||
{
|
{
|
||||||
if(p_scb->p_media_buf + p_scb->frag_off - p_payload < 4)
|
if(p_scb->p_media_buf + p_scb->frag_off - p_payload < 4)
|
||||||
{
|
{
|
||||||
AVDT_TRACE_WARNING("length check frag_off:%d p_media_buf:%d p_payload:%d",
|
AVDT_TRACE_WARNING("length check frag_off:%d p_media_buf:%d p_payload:%d\n",
|
||||||
p_scb->frag_off, p_scb->p_media_buf, p_payload);
|
p_scb->frag_off, p_scb->p_media_buf, p_payload);
|
||||||
break;/* length check */
|
break;/* length check */
|
||||||
}
|
}
|
||||||
@ -598,7 +598,7 @@ void avdt_scb_hdl_pkt_frag(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data)
|
|||||||
|
|
||||||
if(p_payload >= p_scb->p_media_buf + p_scb->frag_off)
|
if(p_payload >= p_scb->p_media_buf + p_scb->frag_off)
|
||||||
{
|
{
|
||||||
AVDT_TRACE_WARNING("length check2 frag_off:%d p_media_buf:%d p_payload:%d",
|
AVDT_TRACE_WARNING("length check2 frag_off:%d p_media_buf:%d p_payload:%d\n",
|
||||||
p_scb->frag_off, p_scb->p_media_buf, p_payload);
|
p_scb->frag_off, p_scb->p_media_buf, p_payload);
|
||||||
break;/* length check */
|
break;/* length check */
|
||||||
}
|
}
|
||||||
@ -614,7 +614,7 @@ void avdt_scb_hdl_pkt_frag(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data)
|
|||||||
/* payload length */
|
/* payload length */
|
||||||
payload_len = (UINT32)(p_scb->p_media_buf + p_scb->frag_off - pad_len - p_payload);
|
payload_len = (UINT32)(p_scb->p_media_buf + p_scb->frag_off - pad_len - p_payload);
|
||||||
|
|
||||||
AVDT_TRACE_DEBUG("Received last fragment header=%d len=%d",
|
AVDT_TRACE_DEBUG("Received last fragment header=%d len=%d\n",
|
||||||
p_payload - p_scb->p_media_buf,payload_len);
|
p_payload - p_scb->p_media_buf,payload_len);
|
||||||
|
|
||||||
/* send total media packet up */
|
/* send total media packet up */
|
||||||
@ -1159,7 +1159,7 @@ void avdt_scb_hdl_tc_open(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data)
|
|||||||
event = (p_scb->role == AVDT_OPEN_INT) ? AVDT_OPEN_CFM_EVT : AVDT_OPEN_IND_EVT;
|
event = (p_scb->role == AVDT_OPEN_INT) ? AVDT_OPEN_CFM_EVT : AVDT_OPEN_IND_EVT;
|
||||||
p_data->open.hdr.err_code = 0;
|
p_data->open.hdr.err_code = 0;
|
||||||
|
|
||||||
AVDT_TRACE_DEBUG("psc_mask: cfg: 0x%x, req:0x%x, cur: 0x%x",
|
AVDT_TRACE_DEBUG("psc_mask: cfg: 0x%x, req:0x%x, cur: 0x%x\n",
|
||||||
p_scb->cs.cfg.psc_mask, p_scb->req_cfg.psc_mask, p_scb->curr_cfg.psc_mask);
|
p_scb->cs.cfg.psc_mask, p_scb->req_cfg.psc_mask, p_scb->curr_cfg.psc_mask);
|
||||||
#if AVDT_REPORTING == TRUE
|
#if AVDT_REPORTING == TRUE
|
||||||
if(p_scb->curr_cfg.psc_mask & AVDT_PSC_REPORT)
|
if(p_scb->curr_cfg.psc_mask & AVDT_PSC_REPORT)
|
||||||
@ -1426,7 +1426,7 @@ void avdt_scb_snd_stream_close(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data)
|
|||||||
#if AVDT_MULTIPLEXING == TRUE
|
#if AVDT_MULTIPLEXING == TRUE
|
||||||
BT_HDR *p_frag;
|
BT_HDR *p_frag;
|
||||||
|
|
||||||
AVDT_TRACE_WARNING("avdt_scb_snd_stream_close c:%d, off:%d",
|
AVDT_TRACE_WARNING("avdt_scb_snd_stream_close c:%d, off:%d\n",
|
||||||
GKI_queue_length(&p_scb->frag_q), p_scb->frag_off);
|
GKI_queue_length(&p_scb->frag_q), p_scb->frag_off);
|
||||||
/* clean fragments queue */
|
/* clean fragments queue */
|
||||||
while((p_frag = (BT_HDR*)GKI_dequeue (&p_scb->frag_q)) != NULL)
|
while((p_frag = (BT_HDR*)GKI_dequeue (&p_scb->frag_q)) != NULL)
|
||||||
@ -1984,14 +1984,14 @@ void avdt_scb_chk_snd_pkt(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
#if 0
|
#if 0
|
||||||
AVDT_TRACE_DEBUG("num_q=%d",
|
AVDT_TRACE_DEBUG("num_q=%d\n",
|
||||||
L2CA_FlushChannel(avdt_cb.ad.rt_tbl[avdt_ccb_to_idx(p_scb->p_ccb)][avdt_ad_type_to_tcid(AVDT_CHAN_MEDIA, p_scb)].lcid),
|
L2CA_FlushChannel(avdt_cb.ad.rt_tbl[avdt_ccb_to_idx(p_scb->p_ccb)][avdt_ad_type_to_tcid(AVDT_CHAN_MEDIA, p_scb)].lcid),
|
||||||
L2CAP_FLUSH_CHANS_GET);
|
L2CAP_FLUSH_CHANS_GET);
|
||||||
#endif
|
#endif
|
||||||
while((p_pkt = (BT_HDR*)GKI_dequeue (&p_scb->frag_q)) != NULL)
|
while((p_pkt = (BT_HDR*)GKI_dequeue (&p_scb->frag_q)) != NULL)
|
||||||
{
|
{
|
||||||
sent = TRUE;
|
sent = TRUE;
|
||||||
AVDT_TRACE_DEBUG("Send fragment len=%d",p_pkt->len);
|
AVDT_TRACE_DEBUG("Send fragment len=%d\n",p_pkt->len);
|
||||||
/* fragments queue contains fragment to send */
|
/* fragments queue contains fragment to send */
|
||||||
res = avdt_ad_write_req(AVDT_CHAN_MEDIA, p_scb->p_ccb, p_scb, p_pkt);
|
res = avdt_ad_write_req(AVDT_CHAN_MEDIA, p_scb->p_ccb, p_scb, p_pkt);
|
||||||
if(AVDT_AD_CONGESTED == res)
|
if(AVDT_AD_CONGESTED == res)
|
||||||
@ -2001,7 +2001,7 @@ void avdt_scb_chk_snd_pkt(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data)
|
|||||||
break;/* exit loop if channel became congested */
|
break;/* exit loop if channel became congested */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
AVDT_TRACE_DEBUG("res=%d left=%d",res, p_scb->frag_off);
|
AVDT_TRACE_DEBUG("res=%d left=%d\n",res, p_scb->frag_off);
|
||||||
|
|
||||||
if(p_scb->frag_off)
|
if(p_scb->frag_off)
|
||||||
{
|
{
|
||||||
@ -2110,7 +2110,7 @@ void avdt_scb_queue_frags(tAVDT_SCB *p_scb, UINT8 **pp_data, UINT32 *p_data_len,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
num_frag = L2CA_FlushChannel(lcid, L2CAP_FLUSH_CHANS_GET);
|
num_frag = L2CA_FlushChannel(lcid, L2CAP_FLUSH_CHANS_GET);
|
||||||
AVDT_TRACE_DEBUG("num_q=%d lcid=%d", num_frag, lcid);
|
AVDT_TRACE_DEBUG("num_q=%d lcid=%d\n", num_frag, lcid);
|
||||||
if(num_frag >= AVDT_MAX_FRAG_COUNT)
|
if(num_frag >= AVDT_MAX_FRAG_COUNT)
|
||||||
{
|
{
|
||||||
num_frag = 0;
|
num_frag = 0;
|
||||||
@ -2124,7 +2124,7 @@ void avdt_scb_queue_frags(tAVDT_SCB *p_scb, UINT8 **pp_data, UINT32 *p_data_len,
|
|||||||
/* look up transport channel table entry to get peer mtu */
|
/* look up transport channel table entry to get peer mtu */
|
||||||
p_tbl = avdt_ad_tc_tbl_by_type(AVDT_CHAN_MEDIA, p_scb->p_ccb, p_scb);
|
p_tbl = avdt_ad_tc_tbl_by_type(AVDT_CHAN_MEDIA, p_scb->p_ccb, p_scb);
|
||||||
buf_size = p_tbl->peer_mtu + BT_HDR_SIZE;
|
buf_size = p_tbl->peer_mtu + BT_HDR_SIZE;
|
||||||
AVDT_TRACE_DEBUG("peer_mtu: %d, buf_size: %d num_frag=%d",
|
AVDT_TRACE_DEBUG("peer_mtu: %d, buf_size: %d num_frag=%d\n",
|
||||||
p_tbl->peer_mtu, buf_size, num_frag);
|
p_tbl->peer_mtu, buf_size, num_frag);
|
||||||
|
|
||||||
if(buf_size > AVDT_DATA_POOL_SIZE)
|
if(buf_size > AVDT_DATA_POOL_SIZE)
|
||||||
@ -2137,7 +2137,7 @@ void avdt_scb_queue_frags(tAVDT_SCB *p_scb, UINT8 **pp_data, UINT32 *p_data_len,
|
|||||||
/* allocate buffer for fragment */
|
/* allocate buffer for fragment */
|
||||||
if(NULL == (p_frag = (BT_HDR*)GKI_getbuf(buf_size)))
|
if(NULL == (p_frag = (BT_HDR*)GKI_getbuf(buf_size)))
|
||||||
{
|
{
|
||||||
AVDT_TRACE_WARNING("avdt_scb_queue_frags len=%d(out of GKI buffers)",*p_data_len);
|
AVDT_TRACE_WARNING("avdt_scb_queue_frags len=%d(out of GKI buffers)\n",*p_data_len);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
/* fill fragment by chunk of media payload */
|
/* fill fragment by chunk of media payload */
|
||||||
@ -2152,7 +2152,7 @@ void avdt_scb_queue_frags(tAVDT_SCB *p_scb, UINT8 **pp_data, UINT32 *p_data_len,
|
|||||||
memcpy((UINT8*)(p_frag+1) + p_frag->offset, *pp_data, p_frag->len);
|
memcpy((UINT8*)(p_frag+1) + p_frag->offset, *pp_data, p_frag->len);
|
||||||
*pp_data += p_frag->len;
|
*pp_data += p_frag->len;
|
||||||
*p_data_len -= p_frag->len;
|
*p_data_len -= p_frag->len;
|
||||||
AVDT_TRACE_DEBUG("Prepared fragment len=%d", p_frag->len);
|
AVDT_TRACE_DEBUG("Prepared fragment len=%d\n", p_frag->len);
|
||||||
|
|
||||||
if(al_hdr)
|
if(al_hdr)
|
||||||
{
|
{
|
||||||
|
@ -356,7 +356,7 @@ static void log_tstamps_us(char *comment)
|
|||||||
{
|
{
|
||||||
static UINT64 prev_us = 0;
|
static UINT64 prev_us = 0;
|
||||||
const UINT64 now_us = time_now_us();
|
const UINT64 now_us = time_now_us();
|
||||||
APPL_TRACE_DEBUG("[%s] ts %08llu, diff : %08llu, queue sz %d", comment, now_us, now_us - prev_us,
|
APPL_TRACE_DEBUG("[%s] ts %08llu, diff : %08llu, queue sz %d\n", comment, now_us, now_us - prev_us,
|
||||||
GKI_queue_length(&btif_media_cb.TxAaQ));
|
GKI_queue_length(&btif_media_cb.TxAaQ));
|
||||||
prev_us = now_us;
|
prev_us = now_us;
|
||||||
}
|
}
|
||||||
@ -420,7 +420,7 @@ static void a2dp_cmd_acknowledge(int status)
|
|||||||
{
|
{
|
||||||
UINT8 ack = status;
|
UINT8 ack = status;
|
||||||
|
|
||||||
APPL_TRACE_EVENT("## a2dp ack : %s, status %d ##",
|
APPL_TRACE_EVENT("## a2dp ack : %s, status %d ##\n",
|
||||||
dump_a2dp_ctrl_event(btif_media_cb.a2dp_cmd_pending), status);
|
dump_a2dp_ctrl_event(btif_media_cb.a2dp_cmd_pending), status);
|
||||||
|
|
||||||
/* sanity check */
|
/* sanity check */
|
||||||
@ -455,7 +455,7 @@ static void btif_recv_ctrl_data(void)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
APPL_TRACE_DEBUG("a2dp-ctrl-cmd : %s", dump_a2dp_ctrl_event(cmd));
|
APPL_TRACE_DEBUG("a2dp-ctrl-cmd : %s\n", dump_a2dp_ctrl_event(cmd));
|
||||||
|
|
||||||
btif_media_cb.a2dp_cmd_pending = cmd;
|
btif_media_cb.a2dp_cmd_pending = cmd;
|
||||||
|
|
||||||
@ -558,18 +558,18 @@ static void btif_recv_ctrl_data(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
APPL_TRACE_ERROR("UNSUPPORTED CMD (%d)", cmd);
|
APPL_TRACE_ERROR("UNSUPPORTED CMD (%d)\n", cmd);
|
||||||
a2dp_cmd_acknowledge(A2DP_CTRL_ACK_FAILURE);
|
a2dp_cmd_acknowledge(A2DP_CTRL_ACK_FAILURE);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
APPL_TRACE_DEBUG("a2dp-ctrl-cmd : %s DONE", dump_a2dp_ctrl_event(cmd));
|
APPL_TRACE_DEBUG("a2dp-ctrl-cmd : %s DONE\n", dump_a2dp_ctrl_event(cmd));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void btif_a2dp_ctrl_cb(tUIPC_CH_ID ch_id, tUIPC_EVENT event)
|
static void btif_a2dp_ctrl_cb(tUIPC_CH_ID ch_id, tUIPC_EVENT event)
|
||||||
{
|
{
|
||||||
UNUSED(ch_id);
|
UNUSED(ch_id);
|
||||||
|
|
||||||
APPL_TRACE_DEBUG("A2DP-CTRL-CHANNEL EVENT %s", dump_uipc_event(event));
|
APPL_TRACE_DEBUG("A2DP-CTRL-CHANNEL EVENT %s\n", dump_uipc_event(event));
|
||||||
|
|
||||||
switch(event)
|
switch(event)
|
||||||
{
|
{
|
||||||
@ -589,7 +589,7 @@ static void btif_a2dp_ctrl_cb(tUIPC_CH_ID ch_id, tUIPC_EVENT event)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default :
|
default :
|
||||||
APPL_TRACE_ERROR("### A2DP-CTRL-CHANNEL EVENT %d NOT HANDLED ###", event);
|
APPL_TRACE_ERROR("### A2DP-CTRL-CHANNEL EVENT %d NOT HANDLED ###\n", event);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -598,7 +598,7 @@ static void btif_a2dp_data_cb(tUIPC_CH_ID ch_id, tUIPC_EVENT event)
|
|||||||
{
|
{
|
||||||
UNUSED(ch_id);
|
UNUSED(ch_id);
|
||||||
|
|
||||||
APPL_TRACE_DEBUG("BTIF MEDIA (A2DP-DATA) EVENT %s", dump_uipc_event(event));
|
APPL_TRACE_DEBUG("BTIF MEDIA (A2DP-DATA) EVENT %s\n", dump_uipc_event(event));
|
||||||
|
|
||||||
switch(event)
|
switch(event)
|
||||||
{
|
{
|
||||||
@ -629,7 +629,7 @@ static void btif_a2dp_data_cb(tUIPC_CH_ID ch_id, tUIPC_EVENT event)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default :
|
default :
|
||||||
APPL_TRACE_ERROR("### A2DP-DATA EVENT %d NOT HANDLED ###", event);
|
APPL_TRACE_ERROR("### A2DP-DATA EVENT %d NOT HANDLED ###\n", event);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -647,7 +647,7 @@ static UINT16 btif_media_task_get_sbc_rate(void)
|
|||||||
if (!btif_av_is_peer_edr())
|
if (!btif_av_is_peer_edr())
|
||||||
{
|
{
|
||||||
rate = BTIF_A2DP_NON_EDR_MAX_RATE;
|
rate = BTIF_A2DP_NON_EDR_MAX_RATE;
|
||||||
APPL_TRACE_DEBUG("non-edr a2dp sink detected, restrict rate to %d", rate);
|
APPL_TRACE_DEBUG("non-edr a2dp sink detected, restrict rate to %d\n", rate);
|
||||||
}
|
}
|
||||||
|
|
||||||
return rate;
|
return rate;
|
||||||
@ -679,7 +679,7 @@ static void btif_a2dp_encoder_init(void)
|
|||||||
msg.SamplingFreq = freq_block_tbl[sbc_config.samp_freq >> 5];
|
msg.SamplingFreq = freq_block_tbl[sbc_config.samp_freq >> 5];
|
||||||
msg.MtuSize = minmtu;
|
msg.MtuSize = minmtu;
|
||||||
|
|
||||||
APPL_TRACE_EVENT("msg.ChannelMode %x", msg.ChannelMode);
|
APPL_TRACE_EVENT("msg.ChannelMode %x\n", msg.ChannelMode);
|
||||||
|
|
||||||
/* Init the media task to encode SBC properly */
|
/* Init the media task to encode SBC properly */
|
||||||
btif_media_task_enc_init_req(&msg);
|
btif_media_task_enc_init_req(&msg);
|
||||||
@ -698,7 +698,7 @@ static void btif_a2dp_encoder_update(void)
|
|||||||
/* Retrieve the current SBC configuration (default if currently not used) */
|
/* Retrieve the current SBC configuration (default if currently not used) */
|
||||||
bta_av_co_audio_get_sbc_config(&sbc_config, &minmtu);
|
bta_av_co_audio_get_sbc_config(&sbc_config, &minmtu);
|
||||||
|
|
||||||
APPL_TRACE_DEBUG("btif_a2dp_encoder_update: Common min_bitpool:%d(0x%x) max_bitpool:%d(0x%x)",
|
APPL_TRACE_DEBUG("btif_a2dp_encoder_update: Common min_bitpool:%d(0x%x) max_bitpool:%d(0x%x)\n",
|
||||||
sbc_config.min_bitpool, sbc_config.min_bitpool,
|
sbc_config.min_bitpool, sbc_config.min_bitpool,
|
||||||
sbc_config.max_bitpool, sbc_config.max_bitpool);
|
sbc_config.max_bitpool, sbc_config.max_bitpool);
|
||||||
|
|
||||||
@ -724,7 +724,7 @@ static void btif_a2dp_encoder_update(void)
|
|||||||
|
|
||||||
if ((pref_min != sbc_config.min_bitpool) || (pref_max != sbc_config.max_bitpool))
|
if ((pref_min != sbc_config.min_bitpool) || (pref_max != sbc_config.max_bitpool))
|
||||||
{
|
{
|
||||||
APPL_TRACE_EVENT("## adjusted our bitpool range to peer pref [%d:%d] ##",
|
APPL_TRACE_EVENT("## adjusted our bitpool range to peer pref [%d:%d] ##\n",
|
||||||
pref_min, pref_max);
|
pref_min, pref_max);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -777,7 +777,7 @@ static void btif_media_task_handler(void *arg)
|
|||||||
btif_media_thread_cleanup(NULL);
|
btif_media_thread_cleanup(NULL);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
APPL_TRACE_ERROR("media task unhandled evt: 0x%x\n", e->sig);
|
APPL_TRACE_ERROR("media task unhandled evt: 0x%x\n\n", e->sig);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
osi_free(e);
|
osi_free(e);
|
||||||
@ -803,7 +803,7 @@ bool btif_a2dp_start_media_task(void)
|
|||||||
if (xBtifMediaQueue == 0) {
|
if (xBtifMediaQueue == 0) {
|
||||||
goto error_exit;
|
goto error_exit;
|
||||||
}
|
}
|
||||||
xTaskCreate(btif_media_task_handler, "BtifMediaT", 8192, NULL, configMAX_PRIORITIES - 1, &xBtifMediaTaskHandle);
|
xTaskCreate(btif_media_task_handler, "BtifMediaT\n", 8192, NULL, configMAX_PRIORITIES - 1, &xBtifMediaTaskHandle);
|
||||||
if (xBtifMediaTaskHandle == NULL)
|
if (xBtifMediaTaskHandle == NULL)
|
||||||
goto error_exit;
|
goto error_exit;
|
||||||
fixed_queue_register_dequeue(btif_media_cmd_msg_queue, btif_media_thread_handle_cmd);
|
fixed_queue_register_dequeue(btif_media_cmd_msg_queue, btif_media_thread_handle_cmd);
|
||||||
@ -814,7 +814,7 @@ bool btif_a2dp_start_media_task(void)
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
error_exit:;
|
error_exit:;
|
||||||
APPL_TRACE_ERROR("%s unable to start up media thread", __func__);
|
APPL_TRACE_ERROR("%s unable to start up media thread\n", __func__);
|
||||||
|
|
||||||
if (xBtifMediaTaskHandle != NULL) {
|
if (xBtifMediaTaskHandle != NULL) {
|
||||||
vTaskDelete(xBtifMediaTaskHandle);
|
vTaskDelete(xBtifMediaTaskHandle);
|
||||||
@ -996,7 +996,7 @@ BOOLEAN btif_media_task_clear_track(void)
|
|||||||
void btif_reset_decoder(UINT8 *p_av)
|
void btif_reset_decoder(UINT8 *p_av)
|
||||||
{
|
{
|
||||||
APPL_TRACE_EVENT("btif_reset_decoder");
|
APPL_TRACE_EVENT("btif_reset_decoder");
|
||||||
APPL_TRACE_DEBUG("btif_reset_decoder p_codec_info[%x:%x:%x:%x:%x:%x]",
|
APPL_TRACE_DEBUG("btif_reset_decoder p_codec_info[%x:%x:%x:%x:%x:%x]\n",
|
||||||
p_av[1], p_av[2], p_av[3],
|
p_av[1], p_av[2], p_av[3],
|
||||||
p_av[4], p_av[5], p_av[6]);
|
p_av[4], p_av[5], p_av[6]);
|
||||||
|
|
||||||
@ -1109,7 +1109,7 @@ void btif_a2dp_on_stopped(tBTA_AV_SUSPEND *p_av)
|
|||||||
{
|
{
|
||||||
if (p_av->status != BTA_AV_SUCCESS)
|
if (p_av->status != BTA_AV_SUCCESS)
|
||||||
{
|
{
|
||||||
APPL_TRACE_EVENT("AV STOP FAILED (%d)", p_av->status);
|
APPL_TRACE_EVENT("AV STOP FAILED (%d)\n", p_av->status);
|
||||||
|
|
||||||
if (p_av->initiator)
|
if (p_av->initiator)
|
||||||
a2dp_cmd_acknowledge(A2DP_CTRL_ACK_FAILURE);
|
a2dp_cmd_acknowledge(A2DP_CTRL_ACK_FAILURE);
|
||||||
@ -1168,14 +1168,14 @@ void btif_a2dp_on_suspended(tBTA_AV_SUSPEND *p_av)
|
|||||||
/* when true media task discards any rx frames */
|
/* when true media task discards any rx frames */
|
||||||
void btif_a2dp_set_rx_flush(BOOLEAN enable)
|
void btif_a2dp_set_rx_flush(BOOLEAN enable)
|
||||||
{
|
{
|
||||||
APPL_TRACE_EVENT("## DROP RX %d ##", enable);
|
APPL_TRACE_EVENT("## DROP RX %d ##\n", enable);
|
||||||
btif_media_cb.rx_flush = enable;
|
btif_media_cb.rx_flush = enable;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* when true media task discards any tx frames */
|
/* when true media task discards any tx frames */
|
||||||
void btif_a2dp_set_tx_flush(BOOLEAN enable)
|
void btif_a2dp_set_tx_flush(BOOLEAN enable)
|
||||||
{
|
{
|
||||||
APPL_TRACE_EVENT("## DROP TX %d ##", enable);
|
APPL_TRACE_EVENT("## DROP TX %d ##\n", enable);
|
||||||
btif_media_cb.tx_flush = enable;
|
btif_media_cb.tx_flush = enable;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1209,9 +1209,9 @@ static void btif_media_task_avk_handle_timer(UNUSED_ATTR void *context)
|
|||||||
if (p_msg == NULL)
|
if (p_msg == NULL)
|
||||||
return;
|
return;
|
||||||
num_sbc_frames = p_msg->num_frames_to_be_processed; /* num of frames in Que Packets */
|
num_sbc_frames = p_msg->num_frames_to_be_processed; /* num of frames in Que Packets */
|
||||||
APPL_TRACE_DEBUG(" Frames left in topmost packet %d", num_sbc_frames);
|
APPL_TRACE_DEBUG(" Frames left in topmost packet %d\n", num_sbc_frames);
|
||||||
APPL_TRACE_DEBUG(" Remaining frames to process in tick %d", num_frames_to_process);
|
APPL_TRACE_DEBUG(" Remaining frames to process in tick %d\n", num_frames_to_process);
|
||||||
APPL_TRACE_DEBUG(" Num of Packets in Que %d", btif_media_cb.RxSbcQ._count);
|
APPL_TRACE_DEBUG(" Num of Packets in Que %d\n", btif_media_cb.RxSbcQ._count);
|
||||||
|
|
||||||
if ( num_sbc_frames > num_frames_to_process) /* Que Packet has more frames*/
|
if ( num_sbc_frames > num_frames_to_process) /* Que Packet has more frames*/
|
||||||
{
|
{
|
||||||
@ -1338,7 +1338,7 @@ static void btif_media_thread_handle_cmd(fixed_queue_t *queue)
|
|||||||
BT_HDR *p_msg;
|
BT_HDR *p_msg;
|
||||||
while (!fixed_queue_is_empty(queue)) {
|
while (!fixed_queue_is_empty(queue)) {
|
||||||
p_msg = (BT_HDR *)fixed_queue_dequeue(queue);
|
p_msg = (BT_HDR *)fixed_queue_dequeue(queue);
|
||||||
LOG_VERBOSE("btif_media_thread_handle_cmd : %d %s", p_msg->event,
|
LOG_VERBOSE("btif_media_thread_handle_cmd : %d %s\n", p_msg->event,
|
||||||
dump_media_event(p_msg->event));
|
dump_media_event(p_msg->event));
|
||||||
|
|
||||||
switch (p_msg->event)
|
switch (p_msg->event)
|
||||||
@ -1380,10 +1380,10 @@ static void btif_media_thread_handle_cmd(fixed_queue_t *queue)
|
|||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
default:
|
default:
|
||||||
APPL_TRACE_ERROR("ERROR in %s unknown event %d", __func__, p_msg->event);
|
APPL_TRACE_ERROR("ERROR in %s unknown event %d\n", __func__, p_msg->event);
|
||||||
}
|
}
|
||||||
GKI_freebuf(p_msg);
|
GKI_freebuf(p_msg);
|
||||||
LOG_VERBOSE("%s: %s DONE", __func__, dump_media_event(p_msg->event));
|
LOG_VERBOSE("%s: %s DONE\n", __func__, dump_media_event(p_msg->event));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1419,7 +1419,7 @@ static void btif_media_task_handle_inc_media(tBT_SBC_HDR*p_msg)
|
|||||||
if (!btif_media_cb.data_channel_open)
|
if (!btif_media_cb.data_channel_open)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
APPL_TRACE_DEBUG("Number of sbc frames %d, frame_len %d", num_sbc_frames, sbc_frame_len);
|
APPL_TRACE_DEBUG("Number of sbc frames %d, frame_len %d\n", num_sbc_frames, sbc_frame_len);
|
||||||
|
|
||||||
for(count = 0; count < num_sbc_frames && sbc_frame_len != 0; count ++)
|
for(count = 0; count < num_sbc_frames && sbc_frame_len != 0; count ++)
|
||||||
{
|
{
|
||||||
@ -1429,7 +1429,7 @@ static void btif_media_task_handle_inc_media(tBT_SBC_HDR*p_msg)
|
|||||||
(OI_INT16 *)pcmDataPointer,
|
(OI_INT16 *)pcmDataPointer,
|
||||||
(OI_UINT32 *)&pcmBytes);
|
(OI_UINT32 *)&pcmBytes);
|
||||||
if (!OI_SUCCESS(status)) {
|
if (!OI_SUCCESS(status)) {
|
||||||
APPL_TRACE_ERROR("Decoding failure: %d\n", status);
|
APPL_TRACE_ERROR("Decoding failure: %d\n\n", status);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
availPcmBytes -= pcmBytes;
|
availPcmBytes -= pcmBytes;
|
||||||
@ -1707,9 +1707,9 @@ static void btif_media_task_enc_init(BT_HDR *p_msg)
|
|||||||
< pInitAudio->MtuSize) ? (BTIF_MEDIA_AA_BUF_SIZE - BTIF_MEDIA_AA_SBC_OFFSET
|
< pInitAudio->MtuSize) ? (BTIF_MEDIA_AA_BUF_SIZE - BTIF_MEDIA_AA_SBC_OFFSET
|
||||||
- sizeof(BT_HDR)) : pInitAudio->MtuSize;
|
- sizeof(BT_HDR)) : pInitAudio->MtuSize;
|
||||||
|
|
||||||
APPL_TRACE_EVENT("btif_media_task_enc_init busy %d, mtu %d, peer mtu %d",
|
APPL_TRACE_EVENT("btif_media_task_enc_init busy %d, mtu %d, peer mtu %d\n",
|
||||||
btif_media_cb.busy_level, btif_media_cb.TxAaMtuSize, pInitAudio->MtuSize);
|
btif_media_cb.busy_level, btif_media_cb.TxAaMtuSize, pInitAudio->MtuSize);
|
||||||
APPL_TRACE_EVENT(" ch mode %d, subnd %d, nb blk %d, alloc %d, rate %d, freq %d",
|
APPL_TRACE_EVENT(" ch mode %d, subnd %d, nb blk %d, alloc %d, rate %d, freq %d\n",
|
||||||
btif_media_cb.encoder.s16ChannelMode, btif_media_cb.encoder.s16NumOfSubBands,
|
btif_media_cb.encoder.s16ChannelMode, btif_media_cb.encoder.s16NumOfSubBands,
|
||||||
btif_media_cb.encoder.s16NumOfBlocks,
|
btif_media_cb.encoder.s16NumOfBlocks,
|
||||||
btif_media_cb.encoder.s16AllocationMethod, btif_media_cb.encoder.u16BitRate,
|
btif_media_cb.encoder.s16AllocationMethod, btif_media_cb.encoder.u16BitRate,
|
||||||
@ -1717,7 +1717,7 @@ static void btif_media_task_enc_init(BT_HDR *p_msg)
|
|||||||
|
|
||||||
/* Reset entirely the SBC encoder */
|
/* Reset entirely the SBC encoder */
|
||||||
SBC_Encoder_Init(&(btif_media_cb.encoder));
|
SBC_Encoder_Init(&(btif_media_cb.encoder));
|
||||||
APPL_TRACE_DEBUG("btif_media_task_enc_init bit pool %d", btif_media_cb.encoder.s16BitPool);
|
APPL_TRACE_DEBUG("btif_media_task_enc_init bit pool %d\n", btif_media_cb.encoder.s16BitPool);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
@ -1740,7 +1740,7 @@ static void btif_media_task_enc_update(BT_HDR *p_msg)
|
|||||||
SINT16 s16FrameLen;
|
SINT16 s16FrameLen;
|
||||||
UINT8 protect = 0;
|
UINT8 protect = 0;
|
||||||
|
|
||||||
APPL_TRACE_DEBUG("btif_media_task_enc_update : minmtu %d, maxbp %d minbp %d",
|
APPL_TRACE_DEBUG("btif_media_task_enc_update : minmtu %d, maxbp %d minbp %d\n",
|
||||||
pUpdateAudio->MinMtuSize, pUpdateAudio->MaxBitPool, pUpdateAudio->MinBitPool);
|
pUpdateAudio->MinMtuSize, pUpdateAudio->MaxBitPool, pUpdateAudio->MinBitPool);
|
||||||
|
|
||||||
/* Only update the bitrate and MTU size while timer is running to make sure it has been initialized */
|
/* Only update the bitrate and MTU size while timer is running to make sure it has been initialized */
|
||||||
@ -1769,7 +1769,7 @@ static void btif_media_task_enc_update(BT_HDR *p_msg)
|
|||||||
|| pstrEncParams->s16NumOfChannels == 0)
|
|| pstrEncParams->s16NumOfChannels == 0)
|
||||||
{
|
{
|
||||||
APPL_TRACE_ERROR("btif_media_task_enc_update() - Avoiding division by zero...");
|
APPL_TRACE_ERROR("btif_media_task_enc_update() - Avoiding division by zero...");
|
||||||
APPL_TRACE_ERROR("btif_media_task_enc_update() - block=%d, subBands=%d, channels=%d",
|
APPL_TRACE_ERROR("btif_media_task_enc_update() - block=%d, subBands=%d, channels=%d\n",
|
||||||
pstrEncParams->s16NumOfBlocks, pstrEncParams->s16NumOfSubBands,
|
pstrEncParams->s16NumOfBlocks, pstrEncParams->s16NumOfSubBands,
|
||||||
pstrEncParams->s16NumOfChannels);
|
pstrEncParams->s16NumOfChannels);
|
||||||
break;
|
break;
|
||||||
@ -1823,12 +1823,12 @@ static void btif_media_task_enc_update(BT_HDR *p_msg)
|
|||||||
s16BitPool = 0;
|
s16BitPool = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
APPL_TRACE_EVENT("bitpool candidate : %d (%d kbps)",
|
APPL_TRACE_EVENT("bitpool candidate : %d (%d kbps)\n",
|
||||||
s16BitPool, pstrEncParams->u16BitRate);
|
s16BitPool, pstrEncParams->u16BitRate);
|
||||||
|
|
||||||
if (s16BitPool > pUpdateAudio->MaxBitPool)
|
if (s16BitPool > pUpdateAudio->MaxBitPool)
|
||||||
{
|
{
|
||||||
APPL_TRACE_DEBUG("btif_media_task_enc_update computed bitpool too large (%d)",
|
APPL_TRACE_DEBUG("btif_media_task_enc_update computed bitpool too large (%d)\n",
|
||||||
s16BitPool);
|
s16BitPool);
|
||||||
/* Decrease bitrate */
|
/* Decrease bitrate */
|
||||||
btif_media_cb.encoder.u16BitRate -= BTIF_MEDIA_BITRATE_STEP;
|
btif_media_cb.encoder.u16BitRate -= BTIF_MEDIA_BITRATE_STEP;
|
||||||
@ -1837,7 +1837,7 @@ static void btif_media_task_enc_update(BT_HDR *p_msg)
|
|||||||
}
|
}
|
||||||
else if (s16BitPool < pUpdateAudio->MinBitPool)
|
else if (s16BitPool < pUpdateAudio->MinBitPool)
|
||||||
{
|
{
|
||||||
APPL_TRACE_WARNING("btif_media_task_enc_update computed bitpool too small (%d)", s16BitPool);
|
APPL_TRACE_WARNING("btif_media_task_enc_update computed bitpool too small (%d)\n", s16BitPool);
|
||||||
|
|
||||||
/* Increase bitrate */
|
/* Increase bitrate */
|
||||||
UINT16 previous_u16BitRate = btif_media_cb.encoder.u16BitRate;
|
UINT16 previous_u16BitRate = btif_media_cb.encoder.u16BitRate;
|
||||||
@ -1863,7 +1863,7 @@ static void btif_media_task_enc_update(BT_HDR *p_msg)
|
|||||||
/* Finally update the bitpool in the encoder structure */
|
/* Finally update the bitpool in the encoder structure */
|
||||||
pstrEncParams->s16BitPool = s16BitPool;
|
pstrEncParams->s16BitPool = s16BitPool;
|
||||||
|
|
||||||
APPL_TRACE_DEBUG("btif_media_task_enc_update final bit rate %d, final bit pool %d",
|
APPL_TRACE_DEBUG("btif_media_task_enc_update final bit rate %d, final bit pool %d\n",
|
||||||
btif_media_cb.encoder.u16BitRate, btif_media_cb.encoder.s16BitPool);
|
btif_media_cb.encoder.u16BitRate, btif_media_cb.encoder.s16BitPool);
|
||||||
|
|
||||||
/* make sure we reinitialize encoder with new settings */
|
/* make sure we reinitialize encoder with new settings */
|
||||||
@ -1885,9 +1885,9 @@ static void btif_media_task_pcm2sbc_init(tBTIF_MEDIA_INIT_AUDIO_FEEDING * p_feed
|
|||||||
BOOLEAN reconfig_needed = FALSE;
|
BOOLEAN reconfig_needed = FALSE;
|
||||||
|
|
||||||
APPL_TRACE_DEBUG("PCM feeding:");
|
APPL_TRACE_DEBUG("PCM feeding:");
|
||||||
APPL_TRACE_DEBUG("sampling_freq:%d", p_feeding->feeding.cfg.pcm.sampling_freq);
|
APPL_TRACE_DEBUG("sampling_freq:%d\n", p_feeding->feeding.cfg.pcm.sampling_freq);
|
||||||
APPL_TRACE_DEBUG("num_channel:%d", p_feeding->feeding.cfg.pcm.num_channel);
|
APPL_TRACE_DEBUG("num_channel:%d\n", p_feeding->feeding.cfg.pcm.num_channel);
|
||||||
APPL_TRACE_DEBUG("bit_per_sample:%d", p_feeding->feeding.cfg.pcm.bit_per_sample);
|
APPL_TRACE_DEBUG("bit_per_sample:%d\n", p_feeding->feeding.cfg.pcm.bit_per_sample);
|
||||||
|
|
||||||
/* Check the PCM feeding sampling_freq */
|
/* Check the PCM feeding sampling_freq */
|
||||||
switch (p_feeding->feeding.cfg.pcm.sampling_freq)
|
switch (p_feeding->feeding.cfg.pcm.sampling_freq)
|
||||||
@ -1935,8 +1935,8 @@ static void btif_media_task_pcm2sbc_init(tBTIF_MEDIA_INIT_AUDIO_FEEDING * p_feed
|
|||||||
|
|
||||||
if (reconfig_needed != FALSE)
|
if (reconfig_needed != FALSE)
|
||||||
{
|
{
|
||||||
APPL_TRACE_DEBUG("btif_media_task_pcm2sbc_init :: mtu %d", btif_media_cb.TxAaMtuSize);
|
APPL_TRACE_DEBUG("btif_media_task_pcm2sbc_init :: mtu %d\n", btif_media_cb.TxAaMtuSize);
|
||||||
APPL_TRACE_DEBUG("ch mode %d, nbsubd %d, nb %d, alloc %d, rate %d, freq %d",
|
APPL_TRACE_DEBUG("ch mode %d, nbsubd %d, nb %d, alloc %d, rate %d, freq %d\n",
|
||||||
btif_media_cb.encoder.s16ChannelMode,
|
btif_media_cb.encoder.s16ChannelMode,
|
||||||
btif_media_cb.encoder.s16NumOfSubBands, btif_media_cb.encoder.s16NumOfBlocks,
|
btif_media_cb.encoder.s16NumOfSubBands, btif_media_cb.encoder.s16NumOfBlocks,
|
||||||
btif_media_cb.encoder.s16AllocationMethod, btif_media_cb.encoder.u16BitRate,
|
btif_media_cb.encoder.s16AllocationMethod, btif_media_cb.encoder.u16BitRate,
|
||||||
@ -1964,7 +1964,7 @@ static void btif_media_task_audio_feeding_init(BT_HDR *p_msg)
|
|||||||
{
|
{
|
||||||
tBTIF_MEDIA_INIT_AUDIO_FEEDING *p_feeding = (tBTIF_MEDIA_INIT_AUDIO_FEEDING *) p_msg;
|
tBTIF_MEDIA_INIT_AUDIO_FEEDING *p_feeding = (tBTIF_MEDIA_INIT_AUDIO_FEEDING *) p_msg;
|
||||||
|
|
||||||
APPL_TRACE_DEBUG("btif_media_task_audio_feeding_init format:%d", p_feeding->feeding.format);
|
APPL_TRACE_DEBUG("btif_media_task_audio_feeding_init format:%d\n", p_feeding->feeding.format);
|
||||||
|
|
||||||
/* Save Media Feeding information */
|
/* Save Media Feeding information */
|
||||||
btif_media_cb.feeding_mode = p_feeding->feeding_mode;
|
btif_media_cb.feeding_mode = p_feeding->feeding_mode;
|
||||||
@ -1979,7 +1979,7 @@ static void btif_media_task_audio_feeding_init(BT_HDR *p_msg)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default :
|
default :
|
||||||
APPL_TRACE_ERROR("unknown feeding format %d", p_feeding->feeding.format);
|
APPL_TRACE_ERROR("unknown feeding format %d\n", p_feeding->feeding.format);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2040,9 +2040,9 @@ static void btif_media_task_aa_handle_start_decoding(void) {
|
|||||||
if (btif_media_cb.decode_alarm)
|
if (btif_media_cb.decode_alarm)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
btif_media_cb.decode_alarm = osi_alarm_new("dec_timer", btif_decode_alarm_cb, NULL, BTIF_SINK_MEDIA_TIME_TICK, true);
|
btif_media_cb.decode_alarm = osi_alarm_new("dec_timer\n", btif_decode_alarm_cb, NULL, BTIF_SINK_MEDIA_TIME_TICK, true);
|
||||||
if (!btif_media_cb.decode_alarm) {
|
if (!btif_media_cb.decode_alarm) {
|
||||||
APPL_TRACE_ERROR("%s unable to allocate decode alarm.", __func__);
|
APPL_TRACE_ERROR("%s unable to allocate decode alarm.\n", __func__);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2076,14 +2076,14 @@ static void btif_media_task_aa_handle_decoder_reset(BT_HDR *p_msg)
|
|||||||
UINT32 num_blocks = 16;
|
UINT32 num_blocks = 16;
|
||||||
UINT32 num_subbands = 8;
|
UINT32 num_subbands = 8;
|
||||||
|
|
||||||
APPL_TRACE_DEBUG("btif_media_task_aa_handle_decoder_reset p_codec_info[%x:%x:%x:%x:%x:%x]",
|
APPL_TRACE_DEBUG("btif_media_task_aa_handle_decoder_reset p_codec_info[%x:%x:%x:%x:%x:%x]\n",
|
||||||
p_buf->codec_info[1], p_buf->codec_info[2], p_buf->codec_info[3],
|
p_buf->codec_info[1], p_buf->codec_info[2], p_buf->codec_info[3],
|
||||||
p_buf->codec_info[4], p_buf->codec_info[5], p_buf->codec_info[6]);
|
p_buf->codec_info[4], p_buf->codec_info[5], p_buf->codec_info[6]);
|
||||||
|
|
||||||
a2d_status = A2D_ParsSbcInfo(&sbc_cie, p_buf->codec_info, FALSE);
|
a2d_status = A2D_ParsSbcInfo(&sbc_cie, p_buf->codec_info, FALSE);
|
||||||
if (a2d_status != A2D_SUCCESS)
|
if (a2d_status != A2D_SUCCESS)
|
||||||
{
|
{
|
||||||
APPL_TRACE_ERROR("ERROR dump_codec_info A2D_ParsSbcInfo fail:%d", a2d_status);
|
APPL_TRACE_ERROR("ERROR dump_codec_info A2D_ParsSbcInfo fail:%d\n", a2d_status);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2102,19 +2102,19 @@ static void btif_media_task_aa_handle_decoder_reset(BT_HDR *p_msg)
|
|||||||
switch(sbc_cie.samp_freq)
|
switch(sbc_cie.samp_freq)
|
||||||
{
|
{
|
||||||
case A2D_SBC_IE_SAMP_FREQ_16:
|
case A2D_SBC_IE_SAMP_FREQ_16:
|
||||||
APPL_TRACE_DEBUG("\tsamp_freq:%d (16000)", sbc_cie.samp_freq);
|
APPL_TRACE_DEBUG("\tsamp_freq:%d (16000)\n", sbc_cie.samp_freq);
|
||||||
freq_multiple = 16*20;
|
freq_multiple = 16*20;
|
||||||
break;
|
break;
|
||||||
case A2D_SBC_IE_SAMP_FREQ_32:
|
case A2D_SBC_IE_SAMP_FREQ_32:
|
||||||
APPL_TRACE_DEBUG("\tsamp_freq:%d (32000)", sbc_cie.samp_freq);
|
APPL_TRACE_DEBUG("\tsamp_freq:%d (32000)\n", sbc_cie.samp_freq);
|
||||||
freq_multiple = 32*20;
|
freq_multiple = 32*20;
|
||||||
break;
|
break;
|
||||||
case A2D_SBC_IE_SAMP_FREQ_44:
|
case A2D_SBC_IE_SAMP_FREQ_44:
|
||||||
APPL_TRACE_DEBUG("\tsamp_freq:%d (44100)", sbc_cie.samp_freq);
|
APPL_TRACE_DEBUG("\tsamp_freq:%d (44100)\n", sbc_cie.samp_freq);
|
||||||
freq_multiple = 441*2;
|
freq_multiple = 441*2;
|
||||||
break;
|
break;
|
||||||
case A2D_SBC_IE_SAMP_FREQ_48:
|
case A2D_SBC_IE_SAMP_FREQ_48:
|
||||||
APPL_TRACE_DEBUG("\tsamp_freq:%d (48000)", sbc_cie.samp_freq);
|
APPL_TRACE_DEBUG("\tsamp_freq:%d (48000)\n", sbc_cie.samp_freq);
|
||||||
freq_multiple = 48*20;
|
freq_multiple = 48*20;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -2125,16 +2125,16 @@ static void btif_media_task_aa_handle_decoder_reset(BT_HDR *p_msg)
|
|||||||
switch(sbc_cie.ch_mode)
|
switch(sbc_cie.ch_mode)
|
||||||
{
|
{
|
||||||
case A2D_SBC_IE_CH_MD_MONO:
|
case A2D_SBC_IE_CH_MD_MONO:
|
||||||
APPL_TRACE_DEBUG("\tch_mode:%d (Mono)", sbc_cie.ch_mode);
|
APPL_TRACE_DEBUG("\tch_mode:%d (Mono)\n", sbc_cie.ch_mode);
|
||||||
break;
|
break;
|
||||||
case A2D_SBC_IE_CH_MD_DUAL:
|
case A2D_SBC_IE_CH_MD_DUAL:
|
||||||
APPL_TRACE_DEBUG("\tch_mode:%d (DUAL)", sbc_cie.ch_mode);
|
APPL_TRACE_DEBUG("\tch_mode:%d (DUAL)\n", sbc_cie.ch_mode);
|
||||||
break;
|
break;
|
||||||
case A2D_SBC_IE_CH_MD_STEREO:
|
case A2D_SBC_IE_CH_MD_STEREO:
|
||||||
APPL_TRACE_DEBUG("\tch_mode:%d (STEREO)", sbc_cie.ch_mode);
|
APPL_TRACE_DEBUG("\tch_mode:%d (STEREO)\n", sbc_cie.ch_mode);
|
||||||
break;
|
break;
|
||||||
case A2D_SBC_IE_CH_MD_JOINT:
|
case A2D_SBC_IE_CH_MD_JOINT:
|
||||||
APPL_TRACE_DEBUG("\tch_mode:%d (JOINT)", sbc_cie.ch_mode);
|
APPL_TRACE_DEBUG("\tch_mode:%d (JOINT)\n", sbc_cie.ch_mode);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
APPL_TRACE_DEBUG(" Unknown Mode ");
|
APPL_TRACE_DEBUG(" Unknown Mode ");
|
||||||
@ -2144,19 +2144,19 @@ static void btif_media_task_aa_handle_decoder_reset(BT_HDR *p_msg)
|
|||||||
switch(sbc_cie.block_len)
|
switch(sbc_cie.block_len)
|
||||||
{
|
{
|
||||||
case A2D_SBC_IE_BLOCKS_4:
|
case A2D_SBC_IE_BLOCKS_4:
|
||||||
APPL_TRACE_DEBUG("\tblock_len:%d (4)", sbc_cie.block_len);
|
APPL_TRACE_DEBUG("\tblock_len:%d (4)\n", sbc_cie.block_len);
|
||||||
num_blocks = 4;
|
num_blocks = 4;
|
||||||
break;
|
break;
|
||||||
case A2D_SBC_IE_BLOCKS_8:
|
case A2D_SBC_IE_BLOCKS_8:
|
||||||
APPL_TRACE_DEBUG("\tblock_len:%d (8)", sbc_cie.block_len);
|
APPL_TRACE_DEBUG("\tblock_len:%d (8)\n", sbc_cie.block_len);
|
||||||
num_blocks = 8;
|
num_blocks = 8;
|
||||||
break;
|
break;
|
||||||
case A2D_SBC_IE_BLOCKS_12:
|
case A2D_SBC_IE_BLOCKS_12:
|
||||||
APPL_TRACE_DEBUG("\tblock_len:%d (12)", sbc_cie.block_len);
|
APPL_TRACE_DEBUG("\tblock_len:%d (12)\n", sbc_cie.block_len);
|
||||||
num_blocks = 12;
|
num_blocks = 12;
|
||||||
break;
|
break;
|
||||||
case A2D_SBC_IE_BLOCKS_16:
|
case A2D_SBC_IE_BLOCKS_16:
|
||||||
APPL_TRACE_DEBUG("\tblock_len:%d (16)", sbc_cie.block_len);
|
APPL_TRACE_DEBUG("\tblock_len:%d (16)\n", sbc_cie.block_len);
|
||||||
num_blocks = 16;
|
num_blocks = 16;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -2167,11 +2167,11 @@ static void btif_media_task_aa_handle_decoder_reset(BT_HDR *p_msg)
|
|||||||
switch(sbc_cie.num_subbands)
|
switch(sbc_cie.num_subbands)
|
||||||
{
|
{
|
||||||
case A2D_SBC_IE_SUBBAND_4:
|
case A2D_SBC_IE_SUBBAND_4:
|
||||||
APPL_TRACE_DEBUG("\tnum_subbands:%d (4)", sbc_cie.num_subbands);
|
APPL_TRACE_DEBUG("\tnum_subbands:%d (4)\n", sbc_cie.num_subbands);
|
||||||
num_subbands = 4;
|
num_subbands = 4;
|
||||||
break;
|
break;
|
||||||
case A2D_SBC_IE_SUBBAND_8:
|
case A2D_SBC_IE_SUBBAND_8:
|
||||||
APPL_TRACE_DEBUG("\tnum_subbands:%d (8)", sbc_cie.num_subbands);
|
APPL_TRACE_DEBUG("\tnum_subbands:%d (8)\n", sbc_cie.num_subbands);
|
||||||
num_subbands = 8;
|
num_subbands = 8;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -2182,20 +2182,20 @@ static void btif_media_task_aa_handle_decoder_reset(BT_HDR *p_msg)
|
|||||||
switch(sbc_cie.alloc_mthd)
|
switch(sbc_cie.alloc_mthd)
|
||||||
{
|
{
|
||||||
case A2D_SBC_IE_ALLOC_MD_S:
|
case A2D_SBC_IE_ALLOC_MD_S:
|
||||||
APPL_TRACE_DEBUG("\talloc_mthd:%d (SNR)", sbc_cie.alloc_mthd);
|
APPL_TRACE_DEBUG("\talloc_mthd:%d (SNR)\n", sbc_cie.alloc_mthd);
|
||||||
break;
|
break;
|
||||||
case A2D_SBC_IE_ALLOC_MD_L:
|
case A2D_SBC_IE_ALLOC_MD_L:
|
||||||
APPL_TRACE_DEBUG("\talloc_mthd:%d (Loudness)", sbc_cie.alloc_mthd);
|
APPL_TRACE_DEBUG("\talloc_mthd:%d (Loudness)\n", sbc_cie.alloc_mthd);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
APPL_TRACE_DEBUG(" Unknown Allocation Method");
|
APPL_TRACE_DEBUG(" Unknown Allocation Method");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
APPL_TRACE_DEBUG("\tBit pool Min:%d Max:%d", sbc_cie.min_bitpool, sbc_cie.max_bitpool);
|
APPL_TRACE_DEBUG("\tBit pool Min:%d Max:%d\n", sbc_cie.min_bitpool, sbc_cie.max_bitpool);
|
||||||
|
|
||||||
btif_media_cb.frames_to_process = ((freq_multiple)/(num_blocks*num_subbands)) + 1;
|
btif_media_cb.frames_to_process = ((freq_multiple)/(num_blocks*num_subbands)) + 1;
|
||||||
APPL_TRACE_DEBUG(" Frames to be processed in 20 ms %d",btif_media_cb.frames_to_process);
|
APPL_TRACE_DEBUG(" Frames to be processed in 20 ms %d\n",btif_media_cb.frames_to_process);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -2221,7 +2221,7 @@ static void btif_media_task_feeding_state_reset(void)
|
|||||||
btif_media_cb.media_feeding.cfg.pcm.num_channel *
|
btif_media_cb.media_feeding.cfg.pcm.num_channel *
|
||||||
BTIF_MEDIA_TIME_TICK)/1000;
|
BTIF_MEDIA_TIME_TICK)/1000;
|
||||||
|
|
||||||
APPL_TRACE_WARNING("pcm bytes per tick %d",
|
APPL_TRACE_WARNING("pcm bytes per tick %d\n",
|
||||||
(int)btif_media_cb.media_feeding_state.pcm.bytes_per_tick);
|
(int)btif_media_cb.media_feeding_state.pcm.bytes_per_tick);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2246,7 +2246,7 @@ static void btif_media_task_alarm_cb(UNUSED_ATTR void *context)
|
|||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
static void btif_media_task_aa_start_tx(void)
|
static void btif_media_task_aa_start_tx(void)
|
||||||
{
|
{
|
||||||
APPL_TRACE_DEBUG("btif_media_task_aa_start_tx is timer %d, feeding mode %d",
|
APPL_TRACE_DEBUG("btif_media_task_aa_start_tx is timer %d, feeding mode %d\n",
|
||||||
btif_media_cb.is_tx_timer, btif_media_cb.feeding_mode);
|
btif_media_cb.is_tx_timer, btif_media_cb.feeding_mode);
|
||||||
|
|
||||||
/* Use a timer to poll the UIPC, get rid of the UIPC call back */
|
/* Use a timer to poll the UIPC, get rid of the UIPC call back */
|
||||||
@ -2258,13 +2258,13 @@ static void btif_media_task_aa_start_tx(void)
|
|||||||
/* Reset the media feeding state */
|
/* Reset the media feeding state */
|
||||||
btif_media_task_feeding_state_reset();
|
btif_media_task_feeding_state_reset();
|
||||||
|
|
||||||
APPL_TRACE_EVENT("starting timer %dms", BTIF_MEDIA_TIME_TICK);
|
APPL_TRACE_EVENT("starting timer %dms\n", BTIF_MEDIA_TIME_TICK);
|
||||||
|
|
||||||
assert(btif_media_cb.media_alarm == NULL);
|
assert(btif_media_cb.media_alarm == NULL);
|
||||||
|
|
||||||
btif_media_cb.media_alarm = osi_alarm_new("media_alarm", btif_media_task_alarm_cb, NULL, BTIF_MEDIA_TIME_TICK, true);
|
btif_media_cb.media_alarm = osi_alarm_new("media_alarm\n", btif_media_task_alarm_cb, NULL, BTIF_MEDIA_TIME_TICK, true);
|
||||||
if (!btif_media_cb.media_alarm) {
|
if (!btif_media_cb.media_alarm) {
|
||||||
APPL_TRACE_ERROR("%s unable to allocate media alarm.", __func__);
|
APPL_TRACE_ERROR("%s unable to allocate media alarm.\n", __func__);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2283,7 +2283,7 @@ static void btif_media_task_aa_start_tx(void)
|
|||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
static void btif_media_task_aa_stop_tx(void)
|
static void btif_media_task_aa_stop_tx(void)
|
||||||
{
|
{
|
||||||
APPL_TRACE_DEBUG("%s is_tx_timer: %d", __func__, btif_media_cb.is_tx_timer);
|
APPL_TRACE_DEBUG("%s is_tx_timer: %d\n", __func__, btif_media_cb.is_tx_timer);
|
||||||
|
|
||||||
const bool send_ack = (btif_media_cb.is_tx_timer != FALSE);
|
const bool send_ack = (btif_media_cb.is_tx_timer != FALSE);
|
||||||
|
|
||||||
@ -2358,12 +2358,12 @@ static UINT8 btif_get_num_aa_frame(void)
|
|||||||
}
|
}
|
||||||
btif_media_cb.media_feeding_state.pcm.counter -= result*pcm_bytes_per_frame;
|
btif_media_cb.media_feeding_state.pcm.counter -= result*pcm_bytes_per_frame;
|
||||||
|
|
||||||
LOG_VERBOSE("WRITE %d FRAMES", result);
|
LOG_VERBOSE("WRITE %d FRAMES\n", result);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
APPL_TRACE_ERROR("ERROR btif_get_num_aa_frame Unsupported transcoding format 0x%x",
|
APPL_TRACE_ERROR("ERROR btif_get_num_aa_frame Unsupported transcoding format 0x%x\n",
|
||||||
btif_media_cb.TxTranscoding);
|
btif_media_cb.TxTranscoding);
|
||||||
result = 0;
|
result = 0;
|
||||||
break;
|
break;
|
||||||
@ -2399,7 +2399,7 @@ UINT8 btif_media_sink_enque_buf(BT_HDR *p_pkt)
|
|||||||
{
|
{
|
||||||
memcpy(p_msg, p_pkt, (sizeof(BT_HDR) + p_pkt->offset + p_pkt->len));
|
memcpy(p_msg, p_pkt, (sizeof(BT_HDR) + p_pkt->offset + p_pkt->len));
|
||||||
p_msg->num_frames_to_be_processed = (*((UINT8*)(p_msg + 1) + p_msg->offset)) & 0x0f;
|
p_msg->num_frames_to_be_processed = (*((UINT8*)(p_msg + 1) + p_msg->offset)) & 0x0f;
|
||||||
BTIF_TRACE_VERBOSE("btif_media_sink_enque_buf + ", p_msg->num_frames_to_be_processed);
|
BTIF_TRACE_VERBOSE("btif_media_sink_enque_buf + \n", p_msg->num_frames_to_be_processed);
|
||||||
GKI_enqueue(&(btif_media_cb.RxSbcQ), p_msg);
|
GKI_enqueue(&(btif_media_cb.RxSbcQ), p_msg);
|
||||||
if(GKI_queue_length(&btif_media_cb.RxSbcQ) == MAX_A2DP_DELAYED_START_FRAME_COUNT)
|
if(GKI_queue_length(&btif_media_cb.RxSbcQ) == MAX_A2DP_DELAYED_START_FRAME_COUNT)
|
||||||
{
|
{
|
||||||
@ -2487,7 +2487,7 @@ BOOLEAN btif_media_aa_read_feeding(tUIPC_CH_ID channel_id)
|
|||||||
btif_media_cb.media_feeding_state.pcm.aa_feed_residue = 0;
|
btif_media_cb.media_feeding_state.pcm.aa_feed_residue = 0;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
} else {
|
} else {
|
||||||
APPL_TRACE_WARNING("### UNDERFLOW :: ONLY READ %d BYTES OUT OF %d ###",
|
APPL_TRACE_WARNING("### UNDERFLOW :: ONLY READ %d BYTES OUT OF %d ###\n",
|
||||||
nb_byte_read, read_size);
|
nb_byte_read, read_size);
|
||||||
btif_media_cb.media_feeding_state.pcm.aa_feed_residue += nb_byte_read;
|
btif_media_cb.media_feeding_state.pcm.aa_feed_residue += nb_byte_read;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -2546,7 +2546,7 @@ BOOLEAN btif_media_aa_read_feeding(tUIPC_CH_ID channel_id)
|
|||||||
|
|
||||||
if (nb_byte_read < read_size)
|
if (nb_byte_read < read_size)
|
||||||
{
|
{
|
||||||
APPL_TRACE_WARNING("### UNDERRUN :: ONLY READ %d BYTES OUT OF %d ###",
|
APPL_TRACE_WARNING("### UNDERRUN :: ONLY READ %d BYTES OUT OF %d ###\n",
|
||||||
nb_byte_read, read_size);
|
nb_byte_read, read_size);
|
||||||
|
|
||||||
if (nb_byte_read == 0)
|
if (nb_byte_read == 0)
|
||||||
@ -2617,7 +2617,7 @@ static void btif_media_aa_prep_sbc_2_send(UINT8 nb_frame)
|
|||||||
{
|
{
|
||||||
if (NULL == (p_buf = GKI_getpoolbuf(BTIF_MEDIA_AA_POOL_ID)))
|
if (NULL == (p_buf = GKI_getpoolbuf(BTIF_MEDIA_AA_POOL_ID)))
|
||||||
{
|
{
|
||||||
APPL_TRACE_ERROR ("ERROR btif_media_aa_prep_sbc_2_send no buffer TxCnt %d ",
|
APPL_TRACE_ERROR ("ERROR btif_media_aa_prep_sbc_2_send no buffer TxCnt %d \n",
|
||||||
GKI_queue_length(&btif_media_cb.TxAaQ));
|
GKI_queue_length(&btif_media_cb.TxAaQ));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -2649,7 +2649,7 @@ static void btif_media_aa_prep_sbc_2_send(UINT8 nb_frame)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
APPL_TRACE_WARNING("btif_media_aa_prep_sbc_2_send underflow %d, %d",
|
APPL_TRACE_WARNING("btif_media_aa_prep_sbc_2_send underflow %d, %d\n",
|
||||||
nb_frame, btif_media_cb.media_feeding_state.pcm.aa_feed_residue);
|
nb_frame, btif_media_cb.media_feeding_state.pcm.aa_feed_residue);
|
||||||
btif_media_cb.media_feeding_state.pcm.counter += nb_frame *
|
btif_media_cb.media_feeding_state.pcm.counter += nb_frame *
|
||||||
btif_media_cb.encoder.s16NumOfSubBands *
|
btif_media_cb.encoder.s16NumOfSubBands *
|
||||||
@ -2719,7 +2719,7 @@ static void btif_media_aa_prep_2_send(UINT8 nb_frame)
|
|||||||
|
|
||||||
if (GKI_queue_length(&btif_media_cb.TxAaQ) > (MAX_OUTPUT_A2DP_FRAME_QUEUE_SZ - nb_frame))
|
if (GKI_queue_length(&btif_media_cb.TxAaQ) > (MAX_OUTPUT_A2DP_FRAME_QUEUE_SZ - nb_frame))
|
||||||
{
|
{
|
||||||
APPL_TRACE_WARNING("%s() - TX queue buffer count %d/%d", __func__,
|
APPL_TRACE_WARNING("%s() - TX queue buffer count %d/%d\n", __func__,
|
||||||
GKI_queue_length(&btif_media_cb.TxAaQ), MAX_OUTPUT_A2DP_FRAME_QUEUE_SZ - nb_frame);
|
GKI_queue_length(&btif_media_cb.TxAaQ), MAX_OUTPUT_A2DP_FRAME_QUEUE_SZ - nb_frame);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2735,7 +2735,7 @@ static void btif_media_aa_prep_2_send(UINT8 nb_frame)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
APPL_TRACE_ERROR("%s unsupported transcoding format 0x%x", __func__, btif_media_cb.TxTranscoding);
|
APPL_TRACE_ERROR("%s unsupported transcoding format 0x%x\n", __func__, btif_media_cb.TxTranscoding);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2763,7 +2763,7 @@ static void btif_media_send_aa_frame(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* send it */
|
/* send it */
|
||||||
LOG_VERBOSE("btif_media_send_aa_frame : send %d frames", nb_frame_2_send);
|
LOG_VERBOSE("btif_media_send_aa_frame : send %d frames\n", nb_frame_2_send);
|
||||||
bta_av_ci_src_data_ready(BTA_AV_CHNL_AUDIO);
|
bta_av_ci_src_data_ready(BTA_AV_CHNL_AUDIO);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2786,59 +2786,59 @@ void dump_codec_info(unsigned char *p_codec)
|
|||||||
a2d_status = A2D_ParsSbcInfo(&sbc_cie, p_codec, FALSE);
|
a2d_status = A2D_ParsSbcInfo(&sbc_cie, p_codec, FALSE);
|
||||||
if (a2d_status != A2D_SUCCESS)
|
if (a2d_status != A2D_SUCCESS)
|
||||||
{
|
{
|
||||||
APPL_TRACE_ERROR("ERROR dump_codec_info A2D_ParsSbcInfo fail:%d", a2d_status);
|
APPL_TRACE_ERROR("ERROR dump_codec_info A2D_ParsSbcInfo fail:%d\n", a2d_status);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
APPL_TRACE_DEBUG("dump_codec_info");
|
APPL_TRACE_DEBUG("dump_codec_info");
|
||||||
|
|
||||||
if (sbc_cie.samp_freq == A2D_SBC_IE_SAMP_FREQ_16)
|
if (sbc_cie.samp_freq == A2D_SBC_IE_SAMP_FREQ_16)
|
||||||
{ APPL_TRACE_DEBUG("\tsamp_freq:%d (16000)", sbc_cie.samp_freq);}
|
{ APPL_TRACE_DEBUG("\tsamp_freq:%d (16000)\n", sbc_cie.samp_freq);}
|
||||||
else if (sbc_cie.samp_freq == A2D_SBC_IE_SAMP_FREQ_32)
|
else if (sbc_cie.samp_freq == A2D_SBC_IE_SAMP_FREQ_32)
|
||||||
{ APPL_TRACE_DEBUG("\tsamp_freq:%d (32000)", sbc_cie.samp_freq);}
|
{ APPL_TRACE_DEBUG("\tsamp_freq:%d (32000)\n", sbc_cie.samp_freq);}
|
||||||
else if (sbc_cie.samp_freq == A2D_SBC_IE_SAMP_FREQ_44)
|
else if (sbc_cie.samp_freq == A2D_SBC_IE_SAMP_FREQ_44)
|
||||||
{ APPL_TRACE_DEBUG("\tsamp_freq:%d (44.100)", sbc_cie.samp_freq);}
|
{ APPL_TRACE_DEBUG("\tsamp_freq:%d (44.100)\n", sbc_cie.samp_freq);}
|
||||||
else if (sbc_cie.samp_freq == A2D_SBC_IE_SAMP_FREQ_48)
|
else if (sbc_cie.samp_freq == A2D_SBC_IE_SAMP_FREQ_48)
|
||||||
{ APPL_TRACE_DEBUG("\tsamp_freq:%d (48000)", sbc_cie.samp_freq);}
|
{ APPL_TRACE_DEBUG("\tsamp_freq:%d (48000)\n", sbc_cie.samp_freq);}
|
||||||
else
|
else
|
||||||
{ APPL_TRACE_DEBUG("\tBAD samp_freq:%d", sbc_cie.samp_freq);}
|
{ APPL_TRACE_DEBUG("\tBAD samp_freq:%d\n", sbc_cie.samp_freq);}
|
||||||
|
|
||||||
if (sbc_cie.ch_mode == A2D_SBC_IE_CH_MD_MONO)
|
if (sbc_cie.ch_mode == A2D_SBC_IE_CH_MD_MONO)
|
||||||
{ APPL_TRACE_DEBUG("\tch_mode:%d (Mono)", sbc_cie.ch_mode);}
|
{ APPL_TRACE_DEBUG("\tch_mode:%d (Mono)\n", sbc_cie.ch_mode);}
|
||||||
else if (sbc_cie.ch_mode == A2D_SBC_IE_CH_MD_DUAL)
|
else if (sbc_cie.ch_mode == A2D_SBC_IE_CH_MD_DUAL)
|
||||||
{ APPL_TRACE_DEBUG("\tch_mode:%d (Dual)", sbc_cie.ch_mode);}
|
{ APPL_TRACE_DEBUG("\tch_mode:%d (Dual)\n", sbc_cie.ch_mode);}
|
||||||
else if (sbc_cie.ch_mode == A2D_SBC_IE_CH_MD_STEREO)
|
else if (sbc_cie.ch_mode == A2D_SBC_IE_CH_MD_STEREO)
|
||||||
{ APPL_TRACE_DEBUG("\tch_mode:%d (Stereo)", sbc_cie.ch_mode);}
|
{ APPL_TRACE_DEBUG("\tch_mode:%d (Stereo)\n", sbc_cie.ch_mode);}
|
||||||
else if (sbc_cie.ch_mode == A2D_SBC_IE_CH_MD_JOINT)
|
else if (sbc_cie.ch_mode == A2D_SBC_IE_CH_MD_JOINT)
|
||||||
{ APPL_TRACE_DEBUG("\tch_mode:%d (Joint)", sbc_cie.ch_mode);}
|
{ APPL_TRACE_DEBUG("\tch_mode:%d (Joint)\n", sbc_cie.ch_mode);}
|
||||||
else
|
else
|
||||||
{ APPL_TRACE_DEBUG("\tBAD ch_mode:%d", sbc_cie.ch_mode);}
|
{ APPL_TRACE_DEBUG("\tBAD ch_mode:%d\n", sbc_cie.ch_mode);}
|
||||||
|
|
||||||
if (sbc_cie.block_len == A2D_SBC_IE_BLOCKS_4)
|
if (sbc_cie.block_len == A2D_SBC_IE_BLOCKS_4)
|
||||||
{ APPL_TRACE_DEBUG("\tblock_len:%d (4)", sbc_cie.block_len);}
|
{ APPL_TRACE_DEBUG("\tblock_len:%d (4)\n", sbc_cie.block_len);}
|
||||||
else if (sbc_cie.block_len == A2D_SBC_IE_BLOCKS_8)
|
else if (sbc_cie.block_len == A2D_SBC_IE_BLOCKS_8)
|
||||||
{ APPL_TRACE_DEBUG("\tblock_len:%d (8)", sbc_cie.block_len);}
|
{ APPL_TRACE_DEBUG("\tblock_len:%d (8)\n", sbc_cie.block_len);}
|
||||||
else if (sbc_cie.block_len == A2D_SBC_IE_BLOCKS_12)
|
else if (sbc_cie.block_len == A2D_SBC_IE_BLOCKS_12)
|
||||||
{ APPL_TRACE_DEBUG("\tblock_len:%d (12)", sbc_cie.block_len);}
|
{ APPL_TRACE_DEBUG("\tblock_len:%d (12)\n", sbc_cie.block_len);}
|
||||||
else if (sbc_cie.block_len == A2D_SBC_IE_BLOCKS_16)
|
else if (sbc_cie.block_len == A2D_SBC_IE_BLOCKS_16)
|
||||||
{ APPL_TRACE_DEBUG("\tblock_len:%d (16)", sbc_cie.block_len);}
|
{ APPL_TRACE_DEBUG("\tblock_len:%d (16)\n", sbc_cie.block_len);}
|
||||||
else
|
else
|
||||||
{ APPL_TRACE_DEBUG("\tBAD block_len:%d", sbc_cie.block_len);}
|
{ APPL_TRACE_DEBUG("\tBAD block_len:%d\n", sbc_cie.block_len);}
|
||||||
|
|
||||||
if (sbc_cie.num_subbands == A2D_SBC_IE_SUBBAND_4)
|
if (sbc_cie.num_subbands == A2D_SBC_IE_SUBBAND_4)
|
||||||
{ APPL_TRACE_DEBUG("\tnum_subbands:%d (4)", sbc_cie.num_subbands);}
|
{ APPL_TRACE_DEBUG("\tnum_subbands:%d (4)\n", sbc_cie.num_subbands);}
|
||||||
else if (sbc_cie.num_subbands == A2D_SBC_IE_SUBBAND_8)
|
else if (sbc_cie.num_subbands == A2D_SBC_IE_SUBBAND_8)
|
||||||
{ APPL_TRACE_DEBUG("\tnum_subbands:%d (8)", sbc_cie.num_subbands);}
|
{ APPL_TRACE_DEBUG("\tnum_subbands:%d (8)\n", sbc_cie.num_subbands);}
|
||||||
else
|
else
|
||||||
{ APPL_TRACE_DEBUG("\tBAD num_subbands:%d", sbc_cie.num_subbands);}
|
{ APPL_TRACE_DEBUG("\tBAD num_subbands:%d\n", sbc_cie.num_subbands);}
|
||||||
|
|
||||||
if (sbc_cie.alloc_mthd == A2D_SBC_IE_ALLOC_MD_S)
|
if (sbc_cie.alloc_mthd == A2D_SBC_IE_ALLOC_MD_S)
|
||||||
{ APPL_TRACE_DEBUG("\talloc_mthd:%d (SNR)", sbc_cie.alloc_mthd);}
|
{ APPL_TRACE_DEBUG("\talloc_mthd:%d (SNR)\n", sbc_cie.alloc_mthd);}
|
||||||
else if (sbc_cie.alloc_mthd == A2D_SBC_IE_ALLOC_MD_L)
|
else if (sbc_cie.alloc_mthd == A2D_SBC_IE_ALLOC_MD_L)
|
||||||
{ APPL_TRACE_DEBUG("\talloc_mthd:%d (Loundess)", sbc_cie.alloc_mthd);}
|
{ APPL_TRACE_DEBUG("\talloc_mthd:%d (Loundess)\n", sbc_cie.alloc_mthd);}
|
||||||
else
|
else
|
||||||
{ APPL_TRACE_DEBUG("\tBAD alloc_mthd:%d", sbc_cie.alloc_mthd);}
|
{ APPL_TRACE_DEBUG("\tBAD alloc_mthd:%d\n", sbc_cie.alloc_mthd);}
|
||||||
|
|
||||||
APPL_TRACE_DEBUG("\tBit pool Min:%d Max:%d", sbc_cie.min_bitpool, sbc_cie.max_bitpool);
|
APPL_TRACE_DEBUG("\tBit pool Min:%d Max:%d\n", sbc_cie.min_bitpool, sbc_cie.max_bitpool);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user