summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPavlin Radoslavov <pavlin@google.com>2017-01-31 22:02:49 -0800
committerPavlin Radoslavov <pavlin@google.com>2017-02-06 13:10:38 -0800
commit310d0f5979c6d0be7915c42b686fec0eea586a64 (patch)
tree1bd3404520267da333b0b28d8168d59cf9828a3a
parent451a32cb56253d7baf9b5d956346c219da9b48c4 (diff)
downloadlibhardware-310d0f5979c6d0be7915c42b686fec0eea586a64.tar.gz
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: I432174975d7afbecb8f27cb0e55f5aa816c6e64e
-rw-r--r--include/hardware/bt_av.h15
1 files changed, 12 insertions, 3 deletions
diff --git a/include/hardware/bt_av.h b/include/hardware/bt_av.h
index 66a8643d..91ae2ace 100644
--- a/include/hardware/bt_av.h
+++ b/include/hardware/bt_av.h
@@ -69,7 +69,15 @@ typedef enum {
} btav_a2dp_codec_index_t;
typedef enum {
+ // Disable the codec.
+ // NOTE: This value can be used only during initialization when
+ // function btav_source_interface_t::init() is called.
+ BTAV_A2DP_CODEC_PRIORITY_DISABLED = -1,
+
+ // Reset the codec priority to its default value.
BTAV_A2DP_CODEC_PRIORITY_DEFAULT = 0,
+
+ // Highest codec priority.
BTAV_A2DP_CODEC_PRIORITY_HIGHEST = 1000 * 1000
} btav_a2dp_codec_priority_t;
@@ -156,7 +164,7 @@ typedef struct {
btav_audio_source_config_callback audio_config_cb;
} btav_source_callbacks_t;
-/** BT-AV A2DP Source callback structure. */
+/** BT-AV A2DP Sink callback structure. */
typedef struct {
/** set to sizeof(btav_sink_callbacks_t) */
size_t size;
@@ -183,9 +191,10 @@ typedef struct {
/** set to sizeof(btav_source_interface_t) */
size_t size;
/**
- * Register the BtAv callbacks
+ * Register the BtAv callbacks.
*/
- bt_status_t (*init)( btav_source_callbacks_t* callbacks );
+ bt_status_t (*init)(btav_source_callbacks_t* callbacks,
+ std::vector<btav_a2dp_codec_config_t> codec_priorities);
/** connect to headset */
bt_status_t (*connect)( bt_bdaddr_t *bd_addr );