Loading system/audio_bluetooth_hw/device_port_proxy.cc +4 −2 Original line number Diff line number Diff line Loading @@ -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_) Loading @@ -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_) Loading system/btif/src/btif_a2dp_control.cc +7 −3 Original line number Diff line number Diff line Loading @@ -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(); Loading @@ -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; Loading Loading @@ -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; Loading system/btif/src/btif_a2dp_source.cc +5 −5 Original line number Diff line number Diff line Loading @@ -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))); } Loading @@ -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); /* Loading Loading @@ -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); } Loading Loading @@ -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); } } Loading Loading
system/audio_bluetooth_hw/device_port_proxy.cc +4 −2 Original line number Diff line number Diff line Loading @@ -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_) Loading @@ -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_) Loading
system/btif/src/btif_a2dp_control.cc +7 −3 Original line number Diff line number Diff line Loading @@ -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(); Loading @@ -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; Loading Loading @@ -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; Loading
system/btif/src/btif_a2dp_source.cc +5 −5 Original line number Diff line number Diff line Loading @@ -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))); } Loading @@ -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); /* Loading Loading @@ -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); } Loading Loading @@ -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); } } Loading