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

Commit ded5fc28 authored by Cheney Ni's avatar Cheney Ni Committed by android-build-merger
Browse files

Merge changes I58ceea50,I73319018

am: b4b1b380

Change-Id: Id62babcd79cd2565e3a537b838dc3814dfeb048e
parents 0cc26297 b4b1b380
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -312,7 +312,8 @@ bool BluetoothAudioPortOut::CondwaitState(BluetoothStreamState state) {
                   << " waiting for STARTED";
      retval = internal_cv_.wait_for(
          port_lock, std::chrono::milliseconds(kMaxWaitingTimeMs),
          [this] { return this->state_ == BluetoothStreamState::STARTED; });
          [this] { return this->state_ != BluetoothStreamState::STARTING; });
      retval = retval && state_ == BluetoothStreamState::STARTED;
      break;
    case BluetoothStreamState::SUSPENDING:
      LOG(VERBOSE) << __func__ << ": session_type=" << toString(session_type_)
@@ -321,7 +322,8 @@ bool BluetoothAudioPortOut::CondwaitState(BluetoothStreamState state) {
                   << " waiting for SUSPENDED";
      retval = internal_cv_.wait_for(
          port_lock, std::chrono::milliseconds(kMaxWaitingTimeMs),
          [this] { return this->state_ == BluetoothStreamState::STANDBY; });
          [this] { return this->state_ != BluetoothStreamState::SUSPENDING; });
      retval = retval && state_ == BluetoothStreamState::STANDBY;
      break;
    default:
      LOG(WARNING) << __func__ << ": session_type=" << toString(session_type_)
+7 −3
Original line number Diff line number Diff line
@@ -48,7 +48,7 @@ static void btif_a2dp_ctrl_cb(tUIPC_CH_ID ch_id, tUIPC_EVENT event);

/* We can have max one command pending */
static tA2DP_CTRL_CMD a2dp_cmd_pending = A2DP_CTRL_CMD_NONE;
std::unique_ptr<tUIPC_STATE> a2dp_uipc;
std::unique_ptr<tUIPC_STATE> a2dp_uipc = nullptr;

void btif_a2dp_control_init(void) {
  a2dp_uipc = UIPC_Init();
@@ -57,8 +57,10 @@ void btif_a2dp_control_init(void) {

void btif_a2dp_control_cleanup(void) {
  /* This calls blocks until UIPC is fully closed */
  if (a2dp_uipc != nullptr) {
    UIPC_Close(*a2dp_uipc, UIPC_CH_ID_ALL);
  }
}

static void btif_a2dp_recv_ctrl_data(void) {
  tA2DP_CTRL_CMD cmd = A2DP_CTRL_CMD_NONE;
@@ -419,8 +421,10 @@ void btif_a2dp_command_ack(tA2DP_CTRL_ACK status) {
  a2dp_cmd_pending = A2DP_CTRL_CMD_NONE;

  /* Acknowledge start request */
  if (a2dp_uipc != nullptr) {
    UIPC_Send(*a2dp_uipc, UIPC_CH_ID_AV_CTRL, 0, &ack, sizeof(ack));
  }
}

void btif_a2dp_control_log_bytes_read(uint32_t bytes_read) {
  delay_report_stats.total_bytes_read += bytes_read;
+5 −5
Original line number Diff line number Diff line
@@ -800,7 +800,7 @@ static void btif_a2dp_source_audio_tx_stop_event(void) {
  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 {
  } 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)));
  }
@@ -811,7 +811,7 @@ static void btif_a2dp_source_audio_tx_stop_event(void) {

  if (bluetooth::audio::a2dp::is_hal_2_0_enabled()) {
    bluetooth::audio::a2dp::ack_stream_suspended(A2DP_CTRL_ACK_SUCCESS);
  } else {
  } else if (a2dp_uipc != nullptr) {
    UIPC_Close(*a2dp_uipc, UIPC_CH_ID_AV_AUDIO);

    /*
@@ -869,11 +869,11 @@ 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;
  uint32_t bytes_read = 0;

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

@@ -1003,7 +1003,7 @@ static void btif_a2dp_source_audio_tx_flush_event(void) {
      bluetooth::common::time_get_os_boottime_us();
  fixed_queue_flush(btif_a2dp_source_cb.tx_audio_queue, osi_free);

  if (!bluetooth::audio::a2dp::is_hal_2_0_enabled()) {
  if (!bluetooth::audio::a2dp::is_hal_2_0_enabled() && a2dp_uipc != nullptr) {
    UIPC_Ioctl(*a2dp_uipc, UIPC_CH_ID_AV_AUDIO, UIPC_REQ_RX_FLUSH, nullptr);
  }
}