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

Commit da8ce9eb authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "AV Suspend from source device should not suspend a2dp source stream" into main

parents e78036d9 1180715d
Loading
Loading
Loading
Loading
+28 −8
Original line number Diff line number Diff line
@@ -136,26 +136,46 @@ void btif_a2dp_on_stopped(tBTA_AV_SUSPEND* p_av_suspend,
                          const A2dpType local_a2dp_type) {
  log::info("## ON A2DP STOPPED ## p_av_suspend={}", fmt::ptr(p_av_suspend));

  if (btif_av_get_peer_sep(local_a2dp_type) == AVDT_TSEP_SRC) {
  const uint8_t peer_type_sep = btif_av_get_peer_sep(local_a2dp_type);
  if (peer_type_sep == AVDT_TSEP_SRC) {
    btif_a2dp_sink_on_stopped(p_av_suspend);
    return;
  }
  if (!IS_FLAG_ENABLED(a2dp_concurrent_source_sink)) {
    if (bluetooth::audio::a2dp::is_hal_enabled() ||
        !btif_av_is_a2dp_offload_running()) {
      btif_a2dp_source_on_stopped(p_av_suspend);
      return;
    }
  } else if (peer_type_sep == AVDT_TSEP_SNK) {
    if (bluetooth::audio::a2dp::is_hal_enabled() ||
        !btif_av_is_a2dp_offload_running()) {
      btif_a2dp_source_on_stopped(p_av_suspend);
      return;
    }
  }
}

void btif_a2dp_on_suspended(tBTA_AV_SUSPEND* p_av_suspend,
                            const A2dpType local_a2dp_type) {
  log::info("## ON A2DP SUSPENDED ## p_av_suspend={}", fmt::ptr(p_av_suspend));
  if (btif_av_get_peer_sep(local_a2dp_type) == AVDT_TSEP_SRC) {
  const uint8_t peer_type_sep = btif_av_get_peer_sep(local_a2dp_type);
  if (peer_type_sep == AVDT_TSEP_SRC) {
    btif_a2dp_sink_on_suspended(p_av_suspend);
    return;
  }
  if (!IS_FLAG_ENABLED(a2dp_concurrent_source_sink)) {
    if (bluetooth::audio::a2dp::is_hal_enabled() ||
        !btif_av_is_a2dp_offload_running()) {
      btif_a2dp_source_on_suspended(p_av_suspend);
      return;
    }
  } else if (peer_type_sep == AVDT_TSEP_SNK) {
    if (bluetooth::audio::a2dp::is_hal_enabled() ||
        !btif_av_is_a2dp_offload_running()) {
      btif_a2dp_source_on_suspended(p_av_suspend);
      return;
    }
  }
}