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

Commit 691b78da authored by Hansong Zhang's avatar Hansong Zhang
Browse files

UIPC_Read: p_msg_evt is unused.

Remove it.

Test: cert/run
Bug: 190730870
Tag: #refactor
Change-Id: I1c3c33058c7ef2f69ad11028ab855bcf1c5d07f2
parent 171297a7
Loading
Loading
Loading
Loading
+6 −7
Original line number Diff line number Diff line
@@ -87,15 +87,14 @@ void send_audio_data() {
  uint32_t bytes_per_tick =
      (num_channels * sample_rate * data_interval_ms * (bit_rate / 8)) / 1000;

  uint16_t event;
  uint8_t p_buf[bytes_per_tick];

  uint32_t bytes_read;
  if (bluetooth::audio::hearing_aid::is_hal_2_0_enabled()) {
    bytes_read = bluetooth::audio::hearing_aid::read(p_buf, bytes_per_tick);
  } else {
    bytes_read = UIPC_Read(*uipc_hearing_aid, UIPC_CH_ID_AV_AUDIO, &event,
                           p_buf, bytes_per_tick);
    bytes_read = UIPC_Read(*uipc_hearing_aid, UIPC_CH_ID_AV_AUDIO, p_buf,
                           bytes_per_tick);
  }

  VLOG(2) << "bytes_read: " << bytes_read;
@@ -169,7 +168,7 @@ void hearing_aid_recv_ctrl_data() {
  int n;

  uint8_t read_cmd = 0; /* The read command size is one octet */
  n = UIPC_Read(*uipc_hearing_aid, UIPC_CH_ID_AV_CTRL, NULL, &read_cmd, 1);
  n = UIPC_Read(*uipc_hearing_aid, UIPC_CH_ID_AV_CTRL, &read_cmd, 1);
  cmd = static_cast<tHEARING_AID_CTRL_CMD>(read_cmd);

  /* detach on ctrl channel means audioflinger process was terminated */
@@ -270,14 +269,14 @@ void hearing_aid_recv_ctrl_data() {

      hearing_aid_send_ack(HEARING_AID_CTRL_ACK_SUCCESS);
      // Send the current codec config
      if (UIPC_Read(*uipc_hearing_aid, UIPC_CH_ID_AV_CTRL, 0,
      if (UIPC_Read(*uipc_hearing_aid, UIPC_CH_ID_AV_CTRL,
                    reinterpret_cast<uint8_t*>(&codec_config.sample_rate),
                    sizeof(btav_a2dp_codec_sample_rate_t)) !=
          sizeof(btav_a2dp_codec_sample_rate_t)) {
        LOG(ERROR) << __func__ << "Error reading sample rate from audio HAL";
        break;
      }
      if (UIPC_Read(*uipc_hearing_aid, UIPC_CH_ID_AV_CTRL, 0,
      if (UIPC_Read(*uipc_hearing_aid, UIPC_CH_ID_AV_CTRL,
                    reinterpret_cast<uint8_t*>(&codec_config.bits_per_sample),
                    sizeof(btav_a2dp_codec_bits_per_sample_t)) !=
          sizeof(btav_a2dp_codec_bits_per_sample_t)) {
@@ -286,7 +285,7 @@ void hearing_aid_recv_ctrl_data() {

        break;
      }
      if (UIPC_Read(*uipc_hearing_aid, UIPC_CH_ID_AV_CTRL, 0,
      if (UIPC_Read(*uipc_hearing_aid, UIPC_CH_ID_AV_CTRL,
                    reinterpret_cast<uint8_t*>(&codec_config.channel_mode),
                    sizeof(btav_a2dp_codec_channel_mode_t)) !=
          sizeof(btav_a2dp_codec_channel_mode_t)) {
+4 −4
Original line number Diff line number Diff line
@@ -67,7 +67,7 @@ static void btif_a2dp_recv_ctrl_data(void) {
  int n;

  uint8_t read_cmd = 0; /* The read command size is one octet */
  n = UIPC_Read(*a2dp_uipc, UIPC_CH_ID_AV_CTRL, NULL, &read_cmd, 1);
  n = UIPC_Read(*a2dp_uipc, UIPC_CH_ID_AV_CTRL, &read_cmd, 1);
  cmd = static_cast<tA2DP_CTRL_CMD>(read_cmd);

  /* detach on ctrl channel means audioflinger process was terminated */
@@ -246,7 +246,7 @@ static void btif_a2dp_recv_ctrl_data(void) {

      btif_a2dp_command_ack(A2DP_CTRL_ACK_SUCCESS);
      // Send the current codec config
      if (UIPC_Read(*a2dp_uipc, UIPC_CH_ID_AV_CTRL, 0,
      if (UIPC_Read(*a2dp_uipc, UIPC_CH_ID_AV_CTRL,
                    reinterpret_cast<uint8_t*>(&codec_config.sample_rate),
                    sizeof(btav_a2dp_codec_sample_rate_t)) !=
          sizeof(btav_a2dp_codec_sample_rate_t)) {
@@ -254,7 +254,7 @@ static void btif_a2dp_recv_ctrl_data(void) {
                         __func__);
        break;
      }
      if (UIPC_Read(*a2dp_uipc, UIPC_CH_ID_AV_CTRL, 0,
      if (UIPC_Read(*a2dp_uipc, UIPC_CH_ID_AV_CTRL,
                    reinterpret_cast<uint8_t*>(&codec_config.bits_per_sample),
                    sizeof(btav_a2dp_codec_bits_per_sample_t)) !=
          sizeof(btav_a2dp_codec_bits_per_sample_t)) {
@@ -262,7 +262,7 @@ static void btif_a2dp_recv_ctrl_data(void) {
                         __func__);
        break;
      }
      if (UIPC_Read(*a2dp_uipc, UIPC_CH_ID_AV_CTRL, 0,
      if (UIPC_Read(*a2dp_uipc, UIPC_CH_ID_AV_CTRL,
                    reinterpret_cast<uint8_t*>(&codec_config.channel_mode),
                    sizeof(btav_a2dp_codec_channel_mode_t)) !=
          sizeof(btav_a2dp_codec_channel_mode_t)) {
+3 −5
Original line number Diff line number Diff line
@@ -828,15 +828,14 @@ static void btif_a2dp_source_audio_tx_stop_event(void) {
                                    &btif_a2dp_source_cb.accumulated_stats);

  uint8_t p_buf[AUDIO_STREAM_OUTPUT_BUFFER_SZ * 2];
  uint16_t event;

  // Keep track of audio data still left in the pipe
  if (bluetooth::audio::a2dp::is_hal_2_0_enabled()) {
    btif_a2dp_control_log_bytes_read(
        bluetooth::audio::a2dp::read(p_buf, sizeof(p_buf)));
  } else if (a2dp_uipc != nullptr) {
    btif_a2dp_control_log_bytes_read(UIPC_Read(*a2dp_uipc, UIPC_CH_ID_AV_AUDIO,
                                               &event, p_buf, sizeof(p_buf)));
    btif_a2dp_control_log_bytes_read(
        UIPC_Read(*a2dp_uipc, UIPC_CH_ID_AV_AUDIO, p_buf, sizeof(p_buf)));
  }

  /* Stop the timer first */
@@ -901,13 +900,12 @@ static void btif_a2dp_source_audio_handle_timer(void) {
}

static uint32_t btif_a2dp_source_read_callback(uint8_t* p_buf, uint32_t len) {
  uint16_t event;
  uint32_t bytes_read = 0;

  if (bluetooth::audio::a2dp::is_hal_2_0_enabled()) {
    bytes_read = bluetooth::audio::a2dp::read(p_buf, len);
  } else if (a2dp_uipc != nullptr) {
    bytes_read = UIPC_Read(*a2dp_uipc, UIPC_CH_ID_AV_AUDIO, &event, p_buf, len);
    bytes_read = UIPC_Read(*a2dp_uipc, UIPC_CH_ID_AV_AUDIO, p_buf, len);
  }

  if (bytes_read < len) {
+1 −2
Original line number Diff line number Diff line
@@ -75,8 +75,7 @@ const char* dump_uipc_event(tUIPC_EVENT event) {
  mock_function_count_map[__func__]++;
  return nullptr;
}
uint32_t UIPC_Read(tUIPC_STATE& uipc, tUIPC_CH_ID ch_id,
                   UNUSED_ATTR uint16_t* p_msg_evt, uint8_t* p_buf,
uint32_t UIPC_Read(tUIPC_STATE& uipc, tUIPC_CH_ID ch_id, uint8_t* p_buf,
                   uint32_t len) {
  mock_function_count_map[__func__]++;
  return 0;
+2 −2
Original line number Diff line number Diff line
@@ -124,8 +124,8 @@ bool UIPC_Send(tUIPC_STATE& uipc, tUIPC_CH_ID ch_id, uint16_t msg_evt,
 * @param len Bytes to read
 * @return true on success, otherwise false
 */
uint32_t UIPC_Read(tUIPC_STATE& uipc, tUIPC_CH_ID ch_id, uint16_t* p_msg_evt,
                   uint8_t* p_buf, uint32_t len);
uint32_t UIPC_Read(tUIPC_STATE& uipc, tUIPC_CH_ID ch_id, uint8_t* p_buf,
                   uint32_t len);

/**
 * Control the UIPC parameter
Loading