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

Commit 344dda11 authored by Henri Chataing's avatar Henri Chataing Committed by Gerrit Code Review
Browse files

Merge changes I90988e36,I059fb39e into main

* changes:
  Gracefully handle IBluetoothAudioProviderFactory::openProvider failure
  btif_a2dp_source: Remove unused APIs
parents bb017b59 a15f4f14
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -197,7 +197,7 @@ void BluetoothAudioClientInterface::FetchAudioProvider() {
              toString(transport_->GetSessionType()), capabilities_.size());

    aidl_retval = provider_factory->openProvider(transport_->GetSessionType(), &provider_);
    if (!aidl_retval.isOk()) {
    if (!aidl_retval.isOk() || provider_ == nullptr) {
      log::error("BluetoothAudioHal::openProvider failure: {}, retry number {}",
                 aidl_retval.getDescription(), retry_no + 1);
    } else {
+0 −13
Original line number Diff line number Diff line
@@ -34,11 +34,6 @@
// module.
bool btif_a2dp_source_init(void);

// Startup the A2DP Source module.
// This function should be called by the BTIF state machine after
// btif_a2dp_source_init() to prepare to start streaming.
bool btif_a2dp_source_startup(void);

// Start the A2DP Source session.
// This function should be called by the BTIF state machine after
// btif_a2dp_source_startup() to start the streaming session for |peer_address|.
@@ -70,14 +65,6 @@ void btif_a2dp_source_shutdown(std::promise<void>);
// cleanup.
void btif_a2dp_source_cleanup(void);

// Check whether the A2DP Source media task is running.
// Returns true if the A2DP Source media task is running, otherwise false.
bool btif_a2dp_source_media_task_is_running(void);

// Check whether the A2DP Source media task is shutting down.
// Returns true if the A2DP Source media task is shutting down.
bool btif_a2dp_source_media_task_is_shutting_down(void);

// Return true if the A2DP Source module is streaming.
bool btif_a2dp_source_is_streaming(void);

+2 −17
Original line number Diff line number Diff line
@@ -233,12 +233,12 @@ static BtifA2dpSource btif_a2dp_source_cb;
static uint8_t btif_a2dp_source_dynamic_audio_buffer_size = MAX_OUTPUT_A2DP_FRAME_QUEUE_SZ;

static void btif_a2dp_source_init_delayed(void);
static bool btif_a2dp_source_startup(void);
static void btif_a2dp_source_startup_delayed(void);
static void btif_a2dp_source_start_session_delayed(const RawAddress& peer_address,
                                                   std::promise<void> start_session_promise);
static void btif_a2dp_source_end_session_delayed(const RawAddress& peer_address);
static void btif_a2dp_source_shutdown_delayed(std::promise<void>);
static void btif_a2dp_source_cleanup_delayed(void);
static void btif_a2dp_source_audio_tx_start_event(void);
static void btif_a2dp_source_audio_tx_stop_event(void);
static void btif_a2dp_source_audio_tx_flush_event(void);
@@ -388,7 +388,7 @@ static void btif_a2dp_source_init_delayed(void) {
                               btif_av_is_a2dp_offload_enabled());
}

bool btif_a2dp_source_startup(void) {
static bool btif_a2dp_source_startup(void) {
  log::info("state={}", btif_a2dp_source_cb.StateStr());

  if (btif_a2dp_source_cb.State() != BtifA2dpSource::kStateOff) {
@@ -555,25 +555,10 @@ void btif_a2dp_source_cleanup(void) {
  std::promise<void> shutdown_complete_promise;
  btif_a2dp_source_shutdown(std::move(shutdown_complete_promise));

  btif_a2dp_source_thread.DoInThread(FROM_HERE, base::BindOnce(&btif_a2dp_source_cleanup_delayed));

  // Exit the thread
  btif_a2dp_source_thread.ShutDown();
}

static void btif_a2dp_source_cleanup_delayed(void) {
  log::info("state={}", btif_a2dp_source_cb.StateStr());
  // Nothing to do
}

bool btif_a2dp_source_media_task_is_running(void) {
  return btif_a2dp_source_cb.State() == BtifA2dpSource::kStateRunning;
}

bool btif_a2dp_source_media_task_is_shutting_down(void) {
  return btif_a2dp_source_cb.State() == BtifA2dpSource::kStateShuttingDown;
}

// This runs on worker thread
bool btif_a2dp_source_is_streaming(void) { return btif_a2dp_source_cb.media_alarm.IsScheduled(); }