OSDN Git Service

Don't reuse AVDTP internal state for different purposes
authorPavlin Radoslavov <pavlin@google.com>
Wed, 2 Aug 2017 20:52:14 +0000 (13:52 -0700)
committerPavlin Radoslavov <pavlin@google.com>
Wed, 2 Aug 2017 23:14:08 +0000 (23:14 +0000)
commitc64dc1d28496b5e917d0f82317d40d3c60e6495d
treea170304c558f7c613518b1c308179213be9c203b
parent81c2234305d4c84eb38f0d5a92605e3b42366f84
Don't reuse AVDTP internal state for different purposes

A number of issues were exposed by carkits that proactively try
to discover the codecs supported by the Phone and explicitly select
the A2DP codec.

* Don't reuse p_scb->p_cap for storing the most recent fetched capability
  and for storing the result configuration while reconfiguring the stream.
  Instead, use p_scb->cfg for storing the result configuration.
* Don't try to reconfigure the audio stream before all peer's capabilities
  have been retrieved.
* Don't reset p_scb->sep_info_idx after fetching all capabilities inside
  bta_av_save_caps(), otherwise the stream reconfiguration logic is
  confused. Apparently, p_scb->sep_info_idx is overused for both:
  (a) Pointing where to store the next capability while fetching the
      capabilities.
  (b) Storing the selected the SEP after the codec selection is completed.
  Resetting p_scb->sep_info_idx to 0 creates logical confusion when the
  actual selected SEP index is 0.
* Add extra debug log messages

Test: Connecting to and streaming with various carkits
Bug: 64128712
Change-Id: I5f57e9069d5402bcbb17613470ac0d29c8e45069
bta/av/bta_av_aact.cc
btif/co/bta_av_co.cc
stack/avdt/avdt_api.cc
stack/avdt/avdt_ccb.cc
stack/avdt/avdt_ccb_act.cc
stack/avdt/avdt_scb_act.cc