OSDN Git Service

Using std::promise and std::future to block till A2DP device activated
authorCheney Ni <cheneyni@google.com>
Wed, 19 Dec 2018 10:46:18 +0000 (18:46 +0800)
committerJack He <siyuanh@google.com>
Tue, 29 Jan 2019 23:17:41 +0000 (23:17 +0000)
commitf0999d8be87bb8c2591cf04a8d7c4e302f509880
tree13179c07a289d2ceae5d5ad37f45cc1cf7a4b64c
parent23478f71d0492cf537c6987fc6afcdd7a13a71cf
Using std::promise and std::future to block till A2DP device activated

There is a new interface to replace UIPC with Blueototh Audio Hal v2 and
synchronization issues between BT Stack and Audio Hal was found when
activating a new A2DP device. Because the API to activate an A2DP device
was non-blocking, it was possilbe that there was a race condition when
BT Stack starting A2DP session and Audio Hal was opening A2DP output.
There was a chance that the output was opened before session started and
causing A2DP to have no sound.

This CL uses std::promise and std::future are able to achieve the
serialize of starting session and opening output for A2DP.

Bug: 111519504
Bug: 122505783
Test: A2DP reconnection and switching

Change-Id: I88c42ea1eb5f8def2345dbfaab26c6d1a91c54cc
btif/include/btif_a2dp_sink.h
btif/include/btif_a2dp_source.h
btif/src/btif_a2dp_sink.cc
btif/src/btif_a2dp_source.cc
btif/src/btif_av.cc