Loading system/btif/src/btif_av.cc +30 −4 Original line number Original line Diff line number Diff line Loading @@ -360,11 +360,24 @@ class BtifAvSource { */ */ void DeleteIdlePeers(); void DeleteIdlePeers(); /** * Get the active peer. * * @return the active peer */ const RawAddress& ActivePeer() const { return 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) { bool SetActivePeer(const RawAddress& peer_address) { if (active_peer_ == peer_address) return true; // Nothing has changed if (active_peer_ == peer_address) return true; // Nothing has changed if (peer_address.IsEmpty()) { 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__); __func__); if (!bta_av_co_set_active_peer(peer_address)) { if (!bta_av_co_set_active_peer(peer_address)) { BTIF_TRACE_WARNING("%s: unable to set active peer to empty in BtaAvCo", BTIF_TRACE_WARNING("%s: unable to set active peer to empty in BtaAvCo", Loading Loading @@ -460,11 +473,24 @@ class BtifAvSink { */ */ void DeleteIdlePeers(); void DeleteIdlePeers(); /** * Get the active peer. * * @return the active peer */ const RawAddress& ActivePeer() const { return 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) { bool SetActivePeer(const RawAddress& peer_address) { if (active_peer_ == peer_address) return true; // Nothing has changed if (active_peer_ == peer_address) return true; // Nothing has changed if (peer_address.IsEmpty()) { 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__); __func__); if (!bta_av_co_set_active_peer(peer_address)) { if (!bta_av_co_set_active_peer(peer_address)) { BTIF_TRACE_WARNING("%s: unable to set active peer to empty in BtaAvCo", BTIF_TRACE_WARNING("%s: unable to set active peer to empty in BtaAvCo", Loading @@ -489,9 +515,9 @@ class BtifAvSink { bool should_startup = active_peer_.IsEmpty(); bool should_startup = active_peer_.IsEmpty(); active_peer_ = peer_address; active_peer_ = peer_address; if (should_startup) { 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__); __func__); btif_a2dp_source_startup(); btif_a2dp_sink_startup(); } } return true; return true; } } Loading Loading
system/btif/src/btif_av.cc +30 −4 Original line number Original line Diff line number Diff line Loading @@ -360,11 +360,24 @@ class BtifAvSource { */ */ void DeleteIdlePeers(); void DeleteIdlePeers(); /** * Get the active peer. * * @return the active peer */ const RawAddress& ActivePeer() const { return 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) { bool SetActivePeer(const RawAddress& peer_address) { if (active_peer_ == peer_address) return true; // Nothing has changed if (active_peer_ == peer_address) return true; // Nothing has changed if (peer_address.IsEmpty()) { 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__); __func__); if (!bta_av_co_set_active_peer(peer_address)) { if (!bta_av_co_set_active_peer(peer_address)) { BTIF_TRACE_WARNING("%s: unable to set active peer to empty in BtaAvCo", BTIF_TRACE_WARNING("%s: unable to set active peer to empty in BtaAvCo", Loading Loading @@ -460,11 +473,24 @@ class BtifAvSink { */ */ void DeleteIdlePeers(); void DeleteIdlePeers(); /** * Get the active peer. * * @return the active peer */ const RawAddress& ActivePeer() const { return 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) { bool SetActivePeer(const RawAddress& peer_address) { if (active_peer_ == peer_address) return true; // Nothing has changed if (active_peer_ == peer_address) return true; // Nothing has changed if (peer_address.IsEmpty()) { 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__); __func__); if (!bta_av_co_set_active_peer(peer_address)) { if (!bta_av_co_set_active_peer(peer_address)) { BTIF_TRACE_WARNING("%s: unable to set active peer to empty in BtaAvCo", BTIF_TRACE_WARNING("%s: unable to set active peer to empty in BtaAvCo", Loading @@ -489,9 +515,9 @@ class BtifAvSink { bool should_startup = active_peer_.IsEmpty(); bool should_startup = active_peer_.IsEmpty(); active_peer_ = peer_address; active_peer_ = peer_address; if (should_startup) { 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__); __func__); btif_a2dp_source_startup(); btif_a2dp_sink_startup(); } } return true; return true; } } Loading