[go: nahoru, domu]

A2DP Sink: add a mechanism for selecting the codec

Use the existing mechanism for selecting the A2DP Source codec to
select the A2DP Sink codec when the local device is A2DP Sink.

* Added new method BtaAvCo::SelectSinkCodec() similar to
  SelectSourceCodec() and use the new method to select the actual
  codec based on the AVDTP Codec capability discovery.
* Renamed method BtaAvCo::UpdateSelectableCodec() to
  UpdateSelectableSourceCodec() and added similar
  UpdateSelectableSinkCodec()
* Renamed method BtaAvCo::AttemptCodecSelection() to
  AttemptSourceCodecSelection() and added similar
  AttemptSinkCodecSelection
* Renamed AudioSinkHasContentProtection() to AudioSepHasContentProtection()
  because it can be used for either A2DP Source or Sink
* Removed method BtaAvCo::FindPeerSourceSepForCurrentCodec() because it
  is not needed anymore.
* Added new method A2dpCodecs::findSinkCodecConfig() similar to
  findSourceCodecConfig()
* Added new function A2DP_SinkCodecIndex() similar to
  A2DP_SourceCodecIndex()
* Added new method A2dpCodecs::setSinkCodecConfig()
* Reorganize the SBC and AAC Source/Sink codec config classes:
  - Virtual method A2dpCodecConfig::setCodecConfig() is now implemented
    for Sink codecs as well: SBC Sink, AAC Sink
  - Renamed A2dpCodecConfigSbc to A2dpCodecConfigSbcSource
  - Renamed A2dpCodecConfigAac to A2dpCodecConfigAacSource
  - Added base class A2dpCodecConfigSbcBase. That class implements
    method setCodecConfig() for both A2dpCodecConfigSbcSource and
    A2dpCodecConfigSbcSink
  - Added base class A2dpCodecConfigAacBase. That class implements
    method setCodecConfig() for both A2dpCodecConfigAacSource and
    A2dpCodecConfigAacSink
  - Updated the A2dpCodecConfigAacBase::setCodecConfig() so it computes
    correctly the AAC Variable Bit Rate Support flag in the result codec
    config: The Variable Bit Rate Support is disabled if either side
    disables it.
* Removed A2DP_BuildSrc2SinkConfig() because it is not needed anymore.
  The correspinding A2DP_BuildSrc2SinkConfigSbc() and
  A2DP_BuildSrc2SinkConfigAac() are removed as well.
* Renamed a2dp_sbc_caps inside a2dp_sbc.cc to a2dp_sbc_source_caps
* Renamed a2dp_aac_caps inside a2dp_aac.cc to a2dp_aac_source_caps
* Added corresponding unit tests

Bug: 74521894
Test: Manual: initiate connection from A2DP Sink.
      Unit tests in system/bt: test/run_unit_tests.sh net_test_stack

Change-Id: I3fc541a068993c123e8d61c209896bb758fd3764
(cherry picked from commit f8dd02a26b01cdccf5424ff340dc954dd10ee671)
12 files changed
tree: d946b79a2c3d6fae06a90d799ba846c1fecd0528
  1. audio_a2dp_hw/
  2. audio_hearing_aid_hw/
  3. binder/
  4. bta/
  5. btcore/
  6. btif/
  7. build/
  8. conf/
  9. device/
  10. doc/
  11. embdrv/
  12. hci/
  13. include/
  14. internal_include/
  15. main/
  16. osi/
  17. packet/
  18. profile/
  19. proto/
  20. service/
  21. stack/
  22. test/
  23. tools/
  24. types/
  25. udrv/
  26. utils/
  27. vendor_libs/
  28. vnd/
  29. .clang-format
  30. .gitignore
  31. .gn
  32. Android.bp
  33. Android.mk
  34. BUILD.gn
  35. CleanSpec.mk
  36. EventLogTags.logtags
  37. MODULE_LICENSE_APACHE2
  38. NOTICE
  39. OWNERS
  40. PREUPLOAD.cfg
  41. README.md
README.md

Fluoride Bluetooth stack

Building and running on AOSP

Just build AOSP - Fluoride is there by default.

Building and running on Linux

Instructions for Ubuntu, tested on 14.04 with Clang 3.5.0 and 16.10 with Clang 3.8.0

Download source

mkdir ~/fluoride
cd ~/fluoride
git clone https://android.googlesource.com/platform/system/bt

Install dependencies (require sudo access):

cd ~/fluoride/bt
build/install_deps.sh

Then fetch third party dependencies:

cd ~/fluoride/bt
mkdir third_party
cd third_party
git clone https://github.com/google/googletest.git
git clone https://android.googlesource.com/platform/external/aac
git clone https://android.googlesource.com/platform/external/libchrome
git clone https://android.googlesource.com/platform/external/libldac
git clone https://android.googlesource.com/platform/external/modp_b64
git clone https://android.googlesource.com/platform/external/tinyxml2

And third party dependencies of third party dependencies:

cd fluoride/bt/third_party/libchrome/base/third_party
mkdir valgrind
cd valgrind
curl https://chromium.googlesource.com/chromium/src/base/+/master/third_party/valgrind/valgrind.h?format=TEXT | base64 -d > valgrind.h
curl https://chromium.googlesource.com/chromium/src/base/+/master/third_party/valgrind/memcheck.h?format=TEXT | base64 -d > memcheck.h

NOTE: If system/bt is checked out under AOSP, then create symbolic links instead of downloading sources

cd system/bt
mkdir third_party
cd third_party
ln -s ../../../external/aac aac
ln -s ../../../external/libchrome libchrome
ln -s ../../../external/libldac libldac
ln -s ../../../external/modp_b64 modp_b64
ln -s ../../../external/tinyxml2 tinyxml2
ln -s ../../../external/googletest googletest

Generate your build files

cd ~/fluoride/bt
gn gen out/Default

Build

cd ~/fluoride/bt
ninja -C out/Default all

This will build all targets (the shared library, executables, tests, etc) and put them in out/Default. To build an individual target, replace “all” with the target of your choice, e.g. ninja -C out/Default net_test_osi.

Run

cd ~/fluoride/bt/out/Default
LD_LIBRARY_PATH=./ ./bluetoothtbd -create-ipc-socket=fluoride

Eclipse IDE Support

  1. Follows the Chromium project Eclipse Setup Instructions until “Optional: Building inside Eclipse” section (don't do that section, we will set it up differently)

  2. Generate Eclipse settings:

cd system/bt
gn gen --ide=eclipse out/Default
  1. In Eclipse, do File->Import->C/C++->C/C++ Project Settings, choose the XML location under system/bt/out/Default

  2. Right click on the project. Go to Preferences->C/C++ Build->Builder Settings. Uncheck “Use default build command”, but instead using “ninja -C out/Default”

  3. Goto Behaviour tab, change clean command to “-t clean”