Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 771c552e authored by Chris Manton's avatar Chris Manton
Browse files

btm_loghistory: Add codec reconfig

Towards loggable code

Bug: 174808695
Tag: #refactor
Test: gd/cert/run
Change-Id: Id18b467d25ab9f7e6cc4a1cd625410eb5d51ac74
parent af5aa1e8
Loading
Loading
Loading
Loading
+20 −9
Original line number Original line Diff line number Diff line
@@ -29,6 +29,7 @@
#include "bt_target.h"
#include "bt_target.h"


#include <base/logging.h>
#include <base/logging.h>
#include <base/strings/stringprintf.h>
#include <string.h>
#include <string.h>
#include <vector>
#include <vector>


@@ -52,6 +53,12 @@
#include "stack/include/btm_client_interface.h"
#include "stack/include/btm_client_interface.h"
#include "utl.h"
#include "utl.h"


namespace {

constexpr char kBtmLogTag[] = "A2DP";

}

/*****************************************************************************
/*****************************************************************************
 *  Constants
 *  Constants
 ****************************************************************************/
 ****************************************************************************/
@@ -1970,16 +1977,20 @@ void bta_av_reconfig(tBTA_AV_SCB* p_scb, tBTA_AV_DATA* p_data) {


  alarm_cancel(p_scb->avrc_ct_timer);
  alarm_cancel(p_scb->avrc_ct_timer);


  APPL_TRACE_DEBUG(
  LOG_DEBUG("p_scb->sep_info_idx=%d p_scb->rcfg_idx=%d p_rcfg->sep_info_idx=%d",
      "%s: p_scb->sep_info_idx=%d p_scb->rcfg_idx=%d p_rcfg->sep_info_idx=%d",
            p_scb->sep_info_idx, p_scb->rcfg_idx, p_rcfg->sep_info_idx);
      __func__, p_scb->sep_info_idx, p_scb->rcfg_idx, p_rcfg->sep_info_idx);
  LOG_DEBUG("Peer capable codec: %s",
  APPL_TRACE_DEBUG("%s: codec: %s", __func__,
            A2DP_CodecInfoString(p_scb->peer_cap.codec_info).c_str());
            A2DP_CodecInfoString(p_scb->peer_cap.codec_info).c_str());
  APPL_TRACE_DEBUG("%s: codec: %s", __func__,
  LOG_DEBUG("Current codec: %s",
            A2DP_CodecInfoString(p_scb->cfg.codec_info).c_str());
            A2DP_CodecInfoString(p_scb->cfg.codec_info).c_str());
  APPL_TRACE_DEBUG("%s: codec: %s", __func__,
  LOG_DEBUG("Reconfig codec: %s",
            A2DP_CodecInfoString(p_rcfg->codec_info).c_str());
            A2DP_CodecInfoString(p_rcfg->codec_info).c_str());


  BTM_LogHistory(
      kBtmLogTag, p_scb->PeerAddress(), "Codec reconfig",
      base::StringPrintf("%s => %s", A2DP_CodecName(p_scb->cfg.codec_info),
                         A2DP_CodecName(p_rcfg->codec_info)));

  p_cfg->num_protect = p_rcfg->num_protect;
  p_cfg->num_protect = p_rcfg->num_protect;
  memcpy(p_cfg->codec_info, p_rcfg->codec_info, AVDT_CODEC_SIZE);
  memcpy(p_cfg->codec_info, p_rcfg->codec_info, AVDT_CODEC_SIZE);
  memcpy(p_cfg->protect_info, p_rcfg->p_protect_info, p_rcfg->num_protect);
  memcpy(p_cfg->protect_info, p_rcfg->p_protect_info, p_rcfg->num_protect);