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

Commit 66a57b69 authored by Pavlin Radoslavov's avatar Pavlin Radoslavov
Browse files

Use correct call btif_a2dp_sink_startup() for Sink peers

Replaced an incorrect call to btif_a2dp_source_startup() with
btif_a2dp_sink_startup() inside BtifAvSink::SetActivePeer()

Also, minor cleanup: fix log messages, add missing description for
some of the methods.

Bug: 72701090
Test: Manual with Headet
Change-Id: I0620833b02bd9012fea63ce2ce5e3c4c74d27bf7
parent f71b1cc4
Loading
Loading
Loading
Loading
+30 −4
Original line number Diff line number Diff line
@@ -360,11 +360,24 @@ class BtifAvSource {
   */
  void DeleteIdlePeers();

  /**
   * Get the active peer.
   *
   * @return the active peer
   */
  const RawAddress& ActivePeer() const { return active_peer_; }

  /**
   * Set the active peer.
   *
   * @param peer_address the active peer address or RawAddress::kEmpty to
   * reset the active peer
   * @return true on success, otherwise false
   */
  bool SetActivePeer(const RawAddress& peer_address) {
    if (active_peer_ == peer_address) return true;  // Nothing has changed
    if (peer_address.IsEmpty()) {
      BTIF_TRACE_EVENT("%s: peer address is empty, shutdown the audio source",
      BTIF_TRACE_EVENT("%s: peer address is empty, shutdown the Audio source",
                       __func__);
      if (!bta_av_co_set_active_peer(peer_address)) {
        BTIF_TRACE_WARNING("%s: unable to set active peer to empty in BtaAvCo",
@@ -460,11 +473,24 @@ class BtifAvSink {
   */
  void DeleteIdlePeers();

  /**
   * Get the active peer.
   *
   * @return the active peer
   */
  const RawAddress& ActivePeer() const { return active_peer_; }

  /**
   * Set the active peer.
   *
   * @param peer_address the active peer address or RawAddress::kEmpty to
   * reset the active peer
   * @return true on success, otherwise false
   */
  bool SetActivePeer(const RawAddress& peer_address) {
    if (active_peer_ == peer_address) return true;  // Nothing has changed
    if (peer_address.IsEmpty()) {
      BTIF_TRACE_EVENT("%s: peer address is empty, shutdown the audio sink",
      BTIF_TRACE_EVENT("%s: peer address is empty, shutdown the Audio sink",
                       __func__);
      if (!bta_av_co_set_active_peer(peer_address)) {
        BTIF_TRACE_WARNING("%s: unable to set active peer to empty in BtaAvCo",
@@ -489,9 +515,9 @@ class BtifAvSink {
    bool should_startup = active_peer_.IsEmpty();
    active_peer_ = peer_address;
    if (should_startup) {
      BTIF_TRACE_EVENT("%s: active peer is empty, startup the Audio source",
      BTIF_TRACE_EVENT("%s: active peer is empty, startup the Audio sink",
                       __func__);
      btif_a2dp_source_startup();
      btif_a2dp_sink_startup();
    }
    return true;
  }