LoginSignup
7
6

More than 5 years have passed since last update.

Android の aptX aptX-HD LDAC AACサポートについて

Last updated at Posted at 2017-01-16

2017年にリリースされる新しいバージョンのAndroidではOSの標準機能として、A2DPのaptX、aptX-HD、LDAC、AACがサポートされるみたいです。

そう考える根拠としては、2017年1月ごろにAndroidのBluetoothプロトコルスタックにA2DPのaptX、aptX-HD、LDAC、AACサポートするコードが追加されました。

でも、実際の端末に搭載されるかどうかは、端末ベンダ毎にCODECのライセンス契約が必要になるんじゃないのかなぁ。

2017-01になって、ソニーのLDAC encoderのソースコード(libldac) がAOSPに追加されました。なので、LDACが次のAndroidに標準搭載される可能性があるのかもしれません。特許はどうするるんだろ。

AndroidのBluetoothプロトコルスタックへのコードの変更点

aptX and aptX-HD

        "a2dp/a2dp_vendor_aptx.cc",
        "a2dp/a2dp_vendor_aptx_hd.cc",
        "a2dp/a2dp_vendor_aptx_encoder.cc",
        "a2dp/a2dp_vendor_aptx_hd_encoder.cc",

LDAC

        "a2dp/a2dp_vendor_ldac.cc",
        "a2dp/a2dp_vendor_ldac_encoder.cc",

AAC

        "a2dp/a2dp_aac.cc",
        "a2dp/a2dp_aac_encoder.cc",

configure A2DP source CODEC

このパッチのコメントがまとまっているので引用しときます。

Add a mechanism for configuring the A2DP Source codecs

* Codec config internal abstraction:
 - Add new classes A2dpCodecConfig and A2dpCodecs that (will)
   encapsulate all codec-related APIs
 - Add unit tests for the above two classes
 - Add method A2dpCodecConfig.buildCodecConfig(), and use it when
   creating the codec configuration instead of A2DP_InitSource2SinkCodec().
   The new method can build the codec config by taking into account
   optional user codec-related configuration preferences.
 - Use the A2DP codec config API from the hardware/libhardware bt_av.h API
 - Replace enum tA2DP_CODEC_SEP_INDEX with btav_a2dp_codec_index_t
   from the bt_av.h API
 - Move codec-specific functions from stack/include/a2dp_api.h
   and stack/a2dp/a2dp_api.cc to stack/include/a2dp_codec_api.h
   and stack/a2dp/a2dp_codec_config.cc
 - Create a new base class A2dpCodecConfig() to hold some of the
   codec-related state, and implement the corresponding A2dpCodecConfigSbc
   and A2dpCodecConfigSbcSink derived classes.
 - Move A2DP spec-related constants from stack/include/a2dp_api.h
   to stack/include/a2dp_constants.h
 - Move A2DP-related error codes from stack/include/a2dp_api.h
   to stack/include/a2dp_error_codes.h
 - Move A2DP SBC spec-related constants from stack/include/a2dp_sbc.h to
   stack/include/a2dp_sbc_constants.h

* Implement the backend mechanism for handling user (re)configuration of
  A2DP Source codecs as requested via the JNI API calls.
  Also, any codec changes are reported back via JNI API callbacks.
  The current audio parameter selection (sample rate, bits per
  sample, channel mode - mono/stereo) is as follows:
  - If the user selected parameters are acceptable (based on
    local codec capability and the remote Sink capability),
    those parameters are used.
  - Else if the Audio HAL's requested parameters are acceptable,
    those are used.
  - Else if the default settings are acceptable, those are used.
  - Else use the best match among the local and the remote device's
    capabilities.

* Update the mechanism for handling OTA configuration requests from the
  remote Sink device.
  - The OTA prefered codec configuration is ignored if the current
  codec configuration contains explicit user configuration, or if the
  codec configuration for the same codec contains explicit user
  configuration.

* Refactor the Audio HAL <-> Bluetooth audio parameter negotiation
  mechanism:
  The new mechanism gives some flexibility to the Media Framework to
  choose the appropriate audio format (sample rate, bits per sample,
  and channel mode - mono/stereo), and at the same time allows
  the Bluetooth stack to double-check / overwrite the choice.
 - out_get_parameters() on the Audio HAL side asks the Bluetooth stack
   for all currently supported formats (for the current codec),
   and returns them to the Media Framework: sample rate, bits per sample,
   and channel mode (mono/stereo).
 - The first time adev_open_output_stream() is called on the Audio HAL,
   it asks the Bluetooth stack about the audio format currently selected
   by the Bluetooth stack (based on codec negotiation with the Sink device,
   and User Configuration).
 - The second time adev_open_output_stream() is called on the Audio HAL,
   its "config" will eventually contain the audio format selected
   internally by the Media Framework. That audio format is sent to the
   Bluetooth stack.
   If that format is acceptable to the Bluetooth stack, the Bluetooth
   stack will reconfigure itself internally, and will respond back with
   those values. Otherwise, it will respond back with the values that
   should be used instead.

* Misc other fixes and refactoring:
 - Fix the BTA handling of A2DP codec reconfiguration
 - Fix a bug in the implementation of A2DP_BitsSet(), and add the
   approriate unit test. Also, fix the code that was using this function
   incorrectly.
 - The SBC encoder is compiled as a separate library
 - Replace leftover usage of "false" with "FALSE" for macros, and
   vice-versa for variable values.

ライブラリ

  • libaptX_encoder.so
  • libaptXHD_encoder.so
  • libldacBT_enc.so
  • libFraunhoferAAC.so

ldacライブラリの使い方について「LDACエンコーダを使ってみた」に書きました。

追記

AACも追加されたので記載した。 (2017-01-28)

7
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
6