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

Commit fe40c3d7 authored by Cheney Ni's avatar Cheney Ni
Browse files

BTIF_AV doesn't start offloading while suspending

This is timing issue that upper-layer was asking to pause the stream
which was starting A2DP offloading, but caused an offloading leakage.
This CL checks those suspending flags to fix it.

Tag: #compatibility
Bug: 201396929
Test: A2DP playback manually
Change-Id: I1150160afc2c36f88db84b3566549c9473c2d7b6
parent aa93b0df
Loading
Loading
Loading
Loading
+11 −1
Original line number Diff line number Diff line
@@ -2020,7 +2020,7 @@ bool BtifAvStateMachine::StateOpened::ProcessEvent(uint32_t event,
    } break;

    case BTIF_AV_OFFLOAD_START_REQ_EVT:
      BTIF_TRACE_ERROR("%s: Peer %s : event=%s: stream is not Opened",
      BTIF_TRACE_ERROR("%s: Peer %s : event=%s: stream is not Started",
                       __PRETTY_FUNCTION__,
                       peer_.PeerAddress().ToString().c_str(),
                       BtifAvEvent::EventName(event).c_str());
@@ -2224,6 +2224,16 @@ bool BtifAvStateMachine::StateStarted::ProcessEvent(uint32_t event,
      break;

    case BTIF_AV_OFFLOAD_START_REQ_EVT:
      if (peer_.CheckFlags(BtifAvPeer::kFlagLocalSuspendPending |
                           BtifAvPeer::kFlagRemoteSuspend |
                           BtifAvPeer::kFlagPendingStop)) {
        LOG_WARN("%s: Peer %s : event=%s flags=%s: stream is Suspending",
                 __PRETTY_FUNCTION__, peer_.PeerAddress().ToString().c_str(),
                 BtifAvEvent::EventName(event).c_str(),
                 peer_.FlagsToString().c_str());
        btif_a2dp_on_offload_started(peer_.PeerAddress(), BTA_AV_FAIL);
        break;
      }
      BTA_AvOffloadStart(peer_.BtaHandle());
      break;