History log of /system/bt/stack/a2dp/a2dp_aac.cc
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
b4ae75f4524fd5bf55d015f860f1deaee0d81f43 04-Oct-2017 Pavlin Radoslavov <pavlin@google.com> Decrese the default verbosity for A2DP codec info logs

Bug: 64159791
Test: Manual
Change-Id: Ida10f5d2aa6643df136a41891d7775e175c06570
/system/bt/stack/a2dp/a2dp_aac.cc
81c2234305d4c84eb38f0d5a92605e3b42366f84 02-Aug-2017 Pavlin Radoslavov <pavlin@google.com> Add A2DP_DumpCodecInfo() API

The API can be used to display A2DP codec info when using |LOG_DEBUG|.

Test: Code compilation
Bug: 64128712
Change-Id: I04379b45f24adb7008365d38ccc8aa7f49ed4b73
/system/bt/stack/a2dp/a2dp_aac.cc
ebf7dd1290faca697031b2436be8ba95d7fe996e 08-Jun-2017 Pavlin Radoslavov <pavlin@google.com> Disable 48.0kHz sampling rate for AAC
am: ad73569d62

Change-Id: Ic295d9d8d09ba555372bd786b8045e309c80c390
ad73569d625463e21bd934de9c9ef9420b6e6452 02-Jun-2017 Pavlin Radoslavov <pavlin@google.com> Disable 48.0kHz sampling rate for AAC

Some carkits have issues playing A2DP audio using AAC with 48.0kHz
sampling rate, while playing AAC with 44.1kHz sampling rate is fine.

Bug: 38443632
Bug: 62301376
Test: manual
Change-Id: I50de2db1d5386d41bfe361fbac99fc7ebbbd3640
(cherry picked from commit 3d268331ae32bd70f60984c9553db1c961073c42)
/system/bt/stack/a2dp/a2dp_aac.cc
b549bd72999284a8cba10bbb75466eca62bd5597 12-May-2017 Pavlin Radoslavov <pavlin@google.com> Set the RTP Header Marker bit selectively per A2DP codec

Add a mechanism to set the RTP Header Marker bit per codec.
Currently, the Marker bit is set only for AAC.

Test: A2DP streaming, PTS AVDTP tests: TC_ACP_SRC_TRA_BTR_BV_01_C,
TC_INT_SRC_SIG_SMG_BV_17_C, TC_INT_SRC_TRA_BTR_BV_01_C
Bug: 37723283
Change-Id: I9b8e77d44c750746c169df9628d5539ad2406b92
(cherry picked from commit 3b8391cd47dd0ea3e399f99a888f029de8c7d8c8)
/system/bt/stack/a2dp/a2dp_aac.cc
3b8391cd47dd0ea3e399f99a888f029de8c7d8c8 12-May-2017 Pavlin Radoslavov <pavlin@google.com> Set the RTP Header Marker bit selectively per A2DP codec

Add a mechanism to set the RTP Header Marker bit per codec.
Currently, the Marker bit is set only for AAC.

Test: A2DP streaming, PTS AVDTP tests: TC_ACP_SRC_TRA_BTR_BV_01_C,
TC_INT_SRC_SIG_SMG_BV_17_C, TC_INT_SRC_TRA_BTR_BV_01_C
Bug: 37723283
Change-Id: I9b8e77d44c750746c169df9628d5539ad2406b92
/system/bt/stack/a2dp/a2dp_aac.cc
c95e5dd827275ca33d84ee8084b8511c0dd9892e 11-May-2017 Pavlin Radoslavov <pavlin@google.com> Removed A2DP_GetTrackBitsPerSample() API because it is not needed

The A2DP_GetTrackBitsPerSample() API was replaced in the past
by A2dpCodecConfig::getAudioBitsPerSample() .
* Removed A2DP_GetTrackBitsPerSample() and related codec-specific APIs:
- A2DP_GetTrackBitsPerSampleSbc
- A2DP_GetTrackBitsPerSampleAac
- A2DP_GetTrackBitsPerSampleAptx
- A2DP_GetTrackBitsPerSampleAptxHd
- A2DP_GetTrackBitsPerSampleLdac
NOTE: The removed A2DP_GetTrackBitsPerSampleLdac implementation
had a bug: a2dp_ldac_caps.bits_per_sample -> ldac_cie.bits_per_sample
This bug itself was uncovered when switching to clang-3960126
- A2DP_VendorGetTrackBitsPerSample()
* Replaced few leftover usages of A2DP_GetTrackBitsPerSample()
A2dpCodecConfig::getAudioBitsPerSample()
* Updated the unit tests

Test: Code compilation, unit tests, A2DP streaming
Bug: 37752547
Change-Id: I7feeda0f32922b8ef888b157673e3e2ade98b179
/system/bt/stack/a2dp/a2dp_aac.cc
d7809b1a8cd290a8c6c3d95e1702c5633986654e 04-May-2017 Pavlin Radoslavov <pavlin@google.com> Remove 96.0 and 88.2 kHz sample rate from A2DP AAC capability

The A2DP AAC Source capabilty should not include 96.0 and 88.2 kHz
sample rate - those were included unintentionally without being tested.

Bug: 37968743
Test: A2DP AAC streaming
Change-Id: Ia3228d4d14d3288acfda42fbaf8ab248ae530b48
(cherry picked from commit 4b93aeb450c4e42a80d8519528dc8fcfacc1d964)
/system/bt/stack/a2dp/a2dp_aac.cc
4b93aeb450c4e42a80d8519528dc8fcfacc1d964 04-May-2017 Pavlin Radoslavov <pavlin@google.com> Remove 96.0 and 88.2 kHz sample rate from A2DP AAC capability

The A2DP AAC Source capabilty should not include 96.0 and 88.2 kHz
sample rate - those were included unintentionally without being tested.

Bug: 37968743
Test: A2DP AAC streaming
Change-Id: Ia3228d4d14d3288acfda42fbaf8ab248ae530b48
/system/bt/stack/a2dp/a2dp_aac.cc
67ae84fb7f01d8458bfc1dcb506f32e7d9350d17 07-Apr-2017 Pavlin Radoslavov <pavlin@google.com> Add A2DP codec-specific information to dumpsys output

Now we print the following information:
* Current codec name
* Info for each supported codec:
- Priority
- Encoder interval (ms)
- Codec Config: Sampling rate, Bits per sample, Channel mode (MONO/STEREO)
- Selectable codec configuration
- Codec's local capability
- Packet counts (expected/dropped)
- PCM read counts (expected/actual)
- PCM read bytes (expected/actual)
* LDAC codec-specific info:
- LDAC quality mode: HIGH/MID/LOW/ABR
- LDAC saved transmit queue length [used in ABR mode]
* SBC codec-specific info:
- Frames counts (expected/dropped)

Sample of the new format is below:

---
A2DP Codecs State:
Current Codec: LDAC

A2DP LDAC State:
Priority: 1000000
Encoder interval (ms): 20
Config: Rate=96000 Bits=32 Mode=STEREO
Selectable: Rate=44100|48000|88200|96000 Bits=16|24|32 Mode=MONO|STEREO
Local capability: Rate=44100|48000|88200|96000 Bits=16|24|32 Mode=MONO|STEREO
Packet counts (expected/dropped) : 596 / 161
PCM read counts (expected/actual) : 2488 / 2488
PCM read bytes (expected/actual) : 2547712 / 2547712
LDAC quality mode : ABR
LDAC saved transmit queue length : 0

A2DP aptX-HD State:
Priority: 4001
Encoder interval (ms): 0
Config: Invalid
Selectable: Invalid
Local capability: Rate=44100|48000 Bits=24 Mode=STEREO
Packet counts (expected/dropped) : 0 / 0
PCM read counts (expected/actual) : 0 / 0
PCM read bytes (expected/actual) : 0 / 0

A2DP aptX State:
Priority: 3001
Encoder interval (ms): 0
Config: Rate=44100 Bits=16 Mode=STEREO
Selectable: Rate=44100|48000 Bits=16 Mode=STEREO
Local capability: Rate=44100|48000 Bits=16 Mode=STEREO
Packet counts (expected/dropped) : 0 / 0
PCM read counts (expected/actual) : 0 / 0
PCM read bytes (expected/actual) : 0 / 0

A2DP AAC State:
Priority: 2001
Encoder interval (ms): 20
Config: Rate=44100 Bits=16 Mode=STEREO
Selectable: Rate=44100|48000 Bits=16 Mode=STEREO
Local capability: Rate=44100|48000|88200|96000 Bits=16 Mode=STEREO
Packet counts (expected/dropped) : 0 / 0
PCM read counts (expected/actual) : 0 / 0
PCM read bytes (expected/actual) : 0 / 0

A2DP SBC State:
Priority: 1001
Encoder interval (ms): 20
Config: Rate=44100 Bits=16 Mode=STEREO
Selectable: Rate=44100 Bits=16 Mode=STEREO
Local capability: Rate=44100 Bits=16 Mode=STEREO
Packet counts (expected/dropped) : 580 / 0
PCM read counts (expected/actual) : 2900 / 2900
PCM read bytes (expected/actual) : 1484800 / 1484800
Frames counts (expected/dropped) : 3724 / 0
---

Bug: 36567128
Test: Stream A2DP and "adb shell dumpsys bluetooth_manager"
Change-Id: Idd86005b842a4e569b7df91b8bbaf0632ed7f7c9

(cherry picked from commit 302113d4e44f06e90f90a5903e33ae830edb58a3)
/system/bt/stack/a2dp/a2dp_aac.cc
302113d4e44f06e90f90a5903e33ae830edb58a3 07-Apr-2017 Pavlin Radoslavov <pavlin@google.com> Add A2DP codec-specific information to dumpsys output

Now we print the following information:
* Current codec name
* Info for each supported codec:
- Priority
- Encoder interval (ms)
- Codec Config: Sampling rate, Bits per sample, Channel mode (MONO/STEREO)
- Selectable codec configuration
- Codec's local capability
- Packet counts (expected/dropped)
- PCM read counts (expected/actual)
- PCM read bytes (expected/actual)
* LDAC codec-specific info:
- LDAC quality mode: HIGH/MID/LOW/ABR
- LDAC saved transmit queue length [used in ABR mode]
* SBC codec-specific info:
- Frames counts (expected/dropped)

Sample of the new format is below:

---
A2DP Codecs State:
Current Codec: LDAC

A2DP LDAC State:
Priority: 1000000
Encoder interval (ms): 20
Config: Rate=96000 Bits=32 Mode=STEREO
Selectable: Rate=44100|48000|88200|96000 Bits=16|24|32 Mode=MONO|STEREO
Local capability: Rate=44100|48000|88200|96000 Bits=16|24|32 Mode=MONO|STEREO
Packet counts (expected/dropped) : 596 / 161
PCM read counts (expected/actual) : 2488 / 2488
PCM read bytes (expected/actual) : 2547712 / 2547712
LDAC quality mode : ABR
LDAC saved transmit queue length : 0

A2DP aptX-HD State:
Priority: 4001
Encoder interval (ms): 0
Config: Invalid
Selectable: Invalid
Local capability: Rate=44100|48000 Bits=24 Mode=STEREO
Packet counts (expected/dropped) : 0 / 0
PCM read counts (expected/actual) : 0 / 0
PCM read bytes (expected/actual) : 0 / 0

A2DP aptX State:
Priority: 3001
Encoder interval (ms): 0
Config: Rate=44100 Bits=16 Mode=STEREO
Selectable: Rate=44100|48000 Bits=16 Mode=STEREO
Local capability: Rate=44100|48000 Bits=16 Mode=STEREO
Packet counts (expected/dropped) : 0 / 0
PCM read counts (expected/actual) : 0 / 0
PCM read bytes (expected/actual) : 0 / 0

A2DP AAC State:
Priority: 2001
Encoder interval (ms): 20
Config: Rate=44100 Bits=16 Mode=STEREO
Selectable: Rate=44100|48000 Bits=16 Mode=STEREO
Local capability: Rate=44100|48000|88200|96000 Bits=16 Mode=STEREO
Packet counts (expected/dropped) : 0 / 0
PCM read counts (expected/actual) : 0 / 0
PCM read bytes (expected/actual) : 0 / 0

A2DP SBC State:
Priority: 1001
Encoder interval (ms): 20
Config: Rate=44100 Bits=16 Mode=STEREO
Selectable: Rate=44100 Bits=16 Mode=STEREO
Local capability: Rate=44100 Bits=16 Mode=STEREO
Packet counts (expected/dropped) : 580 / 0
PCM read counts (expected/actual) : 2900 / 2900
PCM read bytes (expected/actual) : 1484800 / 1484800
Frames counts (expected/dropped) : 3724 / 0
---

Bug: 36567128
Test: Stream A2DP and "adb shell dumpsys bluetooth_manager"
Change-Id: Idd86005b842a4e569b7df91b8bbaf0632ed7f7c9
/system/bt/stack/a2dp/a2dp_aac.cc
dfc02a91a19b2968506140655180b2491ac46a48 15-Mar-2017 fen wang <fen.wang@sonymobile.com> Integration of LDAC Adaptive Bit Rate mechanism

LDAC ABR controls LDAC encoder bit rate based on A2DP transmit queue
length.
It can be used if the LDAC ABR library is installed on the device:
libldacBT_abr.so

Test: manual
Bug: 35381097
Change-Id: Idcc2fabe86acaf441f5a71f5d2bb66ad29252cdb
/system/bt/stack/a2dp/a2dp_aac.cc
f378b2b0f558e79c4d2a418d230cca81771ac141 17-Feb-2017 Pavlin Radoslavov <pavlin@google.com> Ignore AAC bitrate from the A2DP Sink device if below a threshold

Some Sink devices might advertise AAC zero bitrate or a very small
value (e.g., 24576). Ignore values that are below a threshold
(currently set to 64000), because those seem invalid.
For such devices, the actual streaming bitrate will be computed
based on the MTU.

Test: Code compilation
Change-Id: Ibe3de6e53681a618f388b41a01f366ad462b7a1d
/system/bt/stack/a2dp/a2dp_aac.cc
3b8f12614fd2a97332104230cb98a4c13bda93c7 09-Feb-2017 Kenmochi, Chisato <Chisato.Kenmochi@sony.com> Fix AAC bitrate computation and add missing parameters

* Compute the AAC codec bitrate based on the MTU and the AAC
object type such that the AAC frames are not fragmented.
The spec recommendation is to avoid fragmentation, and
some sink devices cannot process fragmented frames.

* Setup/assign AACENC_PEAK_BITRATE as the peak bitrate to
make sure we never go over the MTU frame size.

* Add missing AAC parameter setup for AACENC_AUDIOMUXVER
and AACENC_SIGNALING_MODE

* Add a fix for selecting the bitrate if the sink device reports
capability with zero bitrate - for such devices we negotiate
our bitrate. For the actual AAC codec bitrate we still compute
it based on the MTU and the AAC object type.

Test: Tested with numerous AAC sink devices
Bug: 34953385
Change-Id: I9ca6353b0e1ee107f1242803de4e82d568a3394b
/system/bt/stack/a2dp/a2dp_aac.cc
a6ba5aca4e8c1a200b8cc29fb60d390a7196416a 01-Feb-2017 Pavlin Radoslavov <pavlin@google.com> Add a mechanism to configure the default A2DP codec priorities

Previously, the relative codec priorities were hard-codec internally.
The new mechanism uses the following configurable resources in
packages/apps/Bluetooth/res/values/config.xml to re-assign the
default codec priorities per device, or to explicitly disable a codec.

- a2dp_source_codec_priority_sbc
- a2dp_source_codec_priority_aac
- a2dp_source_codec_priority_aptx
- a2dp_source_codec_priority_aptx_hd
- a2dp_source_codec_priority_ldac

Those values are assigned on startup.
Also, they can be changed per device by using an overlay:
device/<VENDOR>/<DEVICE>/overlay/packages/apps/Bluetooth/res/values/config.xml

Test: Manually streaming to a headset
Change-Id: I5312299aea4a11c92fbe999d521adb39346b9866
/system/bt/stack/a2dp/a2dp_aac.cc
494e53e904e8aecc28178fda5856071776b2caf0 26-Jan-2017 Pavlin Radoslavov <pavlin@google.com> Update the A2DP Codec Config API

Previously, the JNI upcall would contain only the current codec config.
In the new API, the upcall contains:
1. The current codec config
2. The list of codecs containing the local codecs capabilities
3. The list of codecs containing the selectable codecs capabilities.
This list is the intersection of the local codecs capabilities
and the capabilities of the paired device.

Also, updated the codec backend to accomodate the above changes:
* Update all selectable codecs inside bta_av_co_audio_set_codec()
* Changed getCodecConfigAndCapabilities() to return current codec
config, local codecs capabilities, and selectable codecs capabilities.
* Updated each codec to compute and store a copy of the selectable
capabilities, and the local capabilities.
* Updated tA2DP_SBC_CIE to include new field bits_per_sample
(for consistency with the rest of the codecs).
* Replaced usage of codec_priority of 0 with BTAV_A2DP_CODEC_PRIORITY_DEFAULT
* If there is user codec (re)config call, we always send an upcall
to inform the Java layer about the most recent codec info.
Thus, the caller would always know whether the request succeeded or failed.

Test: A2DP streaming with headsets and switching the codecs
Change-Id: Ie7a5cd5c2ab01bb8676032be05bc2ad03baa1e3f
/system/bt/stack/a2dp/a2dp_aac.cc
d5f4960b425ac84cc7a9fd699f39c06869ce2666 04-Jan-2017 Pavlin Radoslavov <pavlin@google.com> Integration of the AAC codec for A2DP source

Also:
- Implemented data fragmentation inside bta_av_data_path()
that is RTP compatible.
- Do not use the codec_type when composing the RTP payload type
per RFC 3016, Section 4.2. That value doesn't have actual meaning
in the context of the Bluetooth supported codecs, and is ambiguous:
all vendor codecs map to the same value 0xFF.
- Updated support function A2DP_BitsSet() so it works for
up to 64-bit integers.
- Updated a log message inside l2c_data_write() to print
packet length and peer MTU on error.

Test: A2DP streaming to AAC headsets
Bug: 30958229
Change-Id: I1b530f1c5c495b8231fd68bed788d4567096683d
/system/bt/stack/a2dp/a2dp_aac.cc