From 741c1b4cc9e3d61915ee0d3df161daed0f008c3c Mon Sep 17 00:00:00 2001 From: Andre Eisenbach Date: Wed, 29 Jun 2016 12:46:13 -0700 Subject: [PATCH] Log RSSI when A2DP buffers are flushed To add another datapoint and potentially narrow down *why* we had to flush the buffers, add RSSI logging to keep track of signal strength during audio drop-out events. Change-Id: Ie52f56290951130165a9f375a898a9bacf459d55 --- btif/src/btif_media_task.cc | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/btif/src/btif_media_task.cc b/btif/src/btif_media_task.cc index 001848724..a78a25e6c 100644 --- a/btif/src/btif_media_task.cc +++ b/btif/src/btif_media_task.cc @@ -490,6 +490,25 @@ UNUSED_ATTR static const char *dump_media_event(uint16_t event) } } +static void btm_read_rssi_cb(void *data) +{ + assert(data); + + tBTM_RSSI_RESULTS *result = (tBTM_RSSI_RESULTS*)data; + if (result->status != BTM_SUCCESS) + { + LOG_ERROR(LOG_TAG, "%s unable to read remote RSSI (status %d)", + __func__, result->status); + return; + } + + char temp_buffer[20] = {0}; + LOG_WARN(LOG_TAG, "%s device: %s, rssi: %d", __func__, + bdaddr_to_string((bt_bdaddr_t *)result->rem_bda, temp_buffer, + sizeof(temp_buffer)), + result->rssi); +} + /***************************************************************************** ** A2DP CTRL PATH *****************************************************************************/ @@ -3097,13 +3116,19 @@ static void btif_media_aa_prep_2_send(uint8_t nb_frame, uint64_t timestamp_us) APPL_TRACE_WARNING("%s() - TX queue buffer count %d/%d", __func__, fixed_queue_length(btif_media_cb.TxAaQ), MAX_OUTPUT_A2DP_FRAME_QUEUE_SZ - nb_frame); + // Keep track of drop-outs btif_media_cb.stats.tx_queue_dropouts++; btif_media_cb.stats.tx_queue_last_dropouts_us = timestamp_us; + // Flush all queued buffers... while (fixed_queue_length(btif_media_cb.TxAaQ)) { btif_media_cb.stats.tx_queue_total_dropped_messages++; osi_free(fixed_queue_try_dequeue(btif_media_cb.TxAaQ)); } + + // Request RSSI for log purposes if we had to flush buffers + bt_bdaddr_t peer_bda = btif_av_get_addr(); + BTM_ReadRSSI(peer_bda.address, btm_read_rssi_cb); } // Transcode frame -- 2.11.0