• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

system/bt


Commit MetaInfo

Revision386994eb81029f73055da4cad2093d6add1cc234 (tree)
Time2016-10-03 18:36:39
AuthorLinux Build Service Account <lnxbuild@loca...>
CommiterGerrit - the friendly Code Review server

Log Message

Merge "Bluetooth: split-a2dp: APTx-HD support" into bt.lnx.2.1-dev

Change Summary

Incremental Difference

--- a/audio_a2dp_hw/bthost_ipc.c
+++ b/audio_a2dp_hw/bthost_ipc.c
@@ -421,8 +421,10 @@ static void* a2dp_codec_parser(uint8_t *codec_cfg, audio_format_t *codec_type)
421421 default:
422422 ERROR("Unknown channel mode");
423423 }
424- if (*codec_type == AUDIO_FORMAT_APTX_HD)
424+ if (*codec_type == AUDIO_FORMAT_APTX_HD) {
425+ p_cfg += 4;
425426 len -= 4;//ignore 4 bytes not used
427+ }
426428 if (len == 0)
427429 INFO("Codec config copied");
428430
--- a/bta/av/bta_av_main.c
+++ b/bta/av/bta_av_main.c
@@ -80,7 +80,7 @@ enum
8080 {
8181 APTX = 1,
8282 AAC,
83- APTX_HD
83+ APTXHD
8484 };
8585
8686 /* state machine states */
@@ -709,19 +709,36 @@ static void bta_av_api_register(tBTA_AV_DATA *p_data)
709709 {
710710 if((*bta_av_a2d_cos.cap)(APTX) != TRUE)
711711 {
712+ APPL_TRACE_DEBUG("%s: aptx-Classic offload codec not supported",__func__);
712713 index++;
713714 continue;
714715 }
715716 else
716- APPL_TRACE_DEBUG("%s:codec supported",__func__)
717+ APPL_TRACE_DEBUG("%s:aptx-Classic offload codec supported",__func__)
718+ } else {
719+ if (codecId == A2D_APTX_HD_CODEC_ID_BLUETOOTH &&
720+ vendorId == A2D_APTX_HD_VENDOR_ID ) {
721+ if((*bta_av_a2d_cos.cap)(APTXHD) != TRUE)
722+ {
723+ APPL_TRACE_DEBUG("%s: aptx-HD offload codec not supported",__func__)
724+ index++;
725+ continue;
726+ }
727+ else
728+ APPL_TRACE_DEBUG("%s: aptx-HD offload codec supported",__func__)
729+
730+ }
717731 }
718732 }
719733 else if (codec_type == AAC)
720734 {
721735 if ((*bta_av_a2d_cos.cap)(AAC) != TRUE)
722736 {
737+ APPL_TRACE_DEBUG("%s: AAC offload codec not supported",__func__);
723738 index++;
724739 continue;
740+ } else {
741+ APPL_TRACE_DEBUG("%s: AAC offload codec supported",__func__);
725742 }
726743 }
727744 } else if (codec_type == A2D_NON_A2DP_MEDIA_CT) {
--- a/btif/co/bta_av_co.c
+++ b/btif/co/bta_av_co.c
@@ -122,9 +122,10 @@ const tA2D_SBC_CIE bta_av_co_sbc_sink_caps =
122122 #endif
123123
124124 /* A2dp offload capabilities */
125-#define SBC 0
126-#define APTX 1
127-#define AAC 2
125+#define SBC 0
126+#define APTX 1
127+#define AAC 2
128+#define APTXHD 3
128129 /* Default SBC codec configuration */
129130 const tA2D_SBC_CIE btif_av_sbc_default_config =
130131 {
@@ -170,7 +171,11 @@ const tA2D_APTX_HD_CIE bta_av_co_aptx_hd_caps =
170171 {
171172 A2D_APTX_HD_VENDOR_ID,
172173 A2D_APTX_HD_CODEC_ID_BLUETOOTH,
174+#ifndef BTA_AV_SPLIT_A2DP_DEF_FREQ_48KHZ
173175 A2D_APTX_HD_SAMPLERATE_44100,
176+#else
177+ A2D_APTX_HD_SAMPLERATE_48000,
178+#endif
174179 A2D_APTX_HD_CHANNELS_STEREO,
175180 A2D_APTX_HD_ACL_SPRINT_RESERVED0,
176181 A2D_APTX_HD_ACL_SPRINT_RESERVED1,
@@ -183,7 +188,11 @@ const tA2D_APTX_HD_CIE btif_av_aptx_hd_default_config =
183188 {
184189 A2D_APTX_HD_VENDOR_ID,
185190 A2D_APTX_HD_CODEC_ID_BLUETOOTH,
191+#ifndef BTA_AV_SPLIT_A2DP_DEF_FREQ_48KHZ
186192 A2D_APTX_HD_SAMPLERATE_44100,
193+#else
194+ A2D_APTX_HD_SAMPLERATE_48000,
195+#endif
187196 A2D_APTX_HD_CHANNELS_STEREO,
188197 A2D_APTX_HD_ACL_SPRINT_RESERVED0,
189198 A2D_APTX_HD_ACL_SPRINT_RESERVED1,
@@ -1698,13 +1707,13 @@ static BOOLEAN bta_av_co_audio_peer_supports_codec(tBTA_AV_CO_PEER *p_peer, UINT
16981707 * multicast is not supported for aptX
16991708 */
17001709 if ((!bt_split_a2dp_enabled && isA2dAptXEnabled && (btif_av_is_multicast_supported() == FALSE)) ||
1701- (bt_split_a2dp_enabled && btif_av_is_codec_offload_supported(APTX)))
1710+ (bt_split_a2dp_enabled && (btif_av_is_codec_offload_supported(APTX)|| btif_av_is_codec_offload_supported(APTXHD))))
17021711 {
17031712 UINT16 codecId;
17041713 UINT32 vendorId;
17051714 UINT8* aptx_capabilities;
17061715
1707- if (isA2dAptXHdEnabled) {
1716+ if ((bt_split_a2dp_enabled && btif_av_is_codec_offload_supported(APTXHD)) || isA2dAptXHdEnabled) {
17081717 for (index = 0; index < p_peer->num_sup_snks; index++)
17091718 {
17101719 if (p_peer->snks[index].codec_type == A2D_NON_A2DP_MEDIA_CT)
--- a/btif/src/btif_av.c
+++ b/btif/src/btif_av.c
@@ -117,12 +117,14 @@ typedef struct
117117 BOOLEAN sbc_offload;
118118 BOOLEAN aptx_offload;
119119 BOOLEAN aac_offload;
120+ BOOLEAN aptxhd_offload;
120121 } btif_av_a2dp_offloaded_codec_cap_t;
121122
122123 typedef enum {
123124 SBC,
124125 APTX,
125126 AAC,
127+ APTXHD,
126128 }btif_av_codec_list;
127129
128130 /*****************************************************************************
@@ -299,6 +301,7 @@ const char *dump_av_codec_name(btif_av_codec_list codec)
299301 CASE_RETURN_STR(SBC)
300302 CASE_RETURN_STR(APTX)
301303 CASE_RETURN_STR(AAC)
304+ CASE_RETURN_STR(APTXHD)
302305 default: return "UNKNOWN_CODEC";
303306 }
304307 }
@@ -2247,6 +2250,11 @@ static void a2dp_offload_codec_cap_parser(const char *value)
22472250 BTIF_TRACE_ERROR("%s: AAC offload supported",__func__);
22482251 btif_av_codec_offload.aac_offload = TRUE;
22492252 }
2253+ else if (strcmp(tok,"aptxhd") == 0)
2254+ {
2255+ BTIF_TRACE_ERROR("%s: APTXHD offload supported",__func__);
2256+ btif_av_codec_offload.aptxhd_offload = TRUE;
2257+ }
22502258 tok = strtok_r(NULL, "-", &tmp_token);
22512259 };
22522260 }
@@ -3645,10 +3653,13 @@ BOOLEAN btif_av_is_codec_offload_supported(int codec)
36453653 case AAC:
36463654 ret = btif_av_codec_offload.aac_offload;
36473655 break;
3656+ case APTXHD:
3657+ ret = btif_av_codec_offload.aptxhd_offload;
3658+ break;
36483659 default:
36493660 ret = FALSE;
36503661 }
3651- BTIF_TRACE_DEBUG("btif_av_is_codec_offload_supported %s code supported = %d",dump_av_codec_name(codec),ret);
3662+ BTIF_TRACE_DEBUG("btif_av_is_codec_offload_supported %s codec supported = %d",dump_av_codec_name(codec),ret);
36523663 return ret;
36533664 }
36543665
--- a/btif/src/btif_media_task.c
+++ b/btif/src/btif_media_task.c
@@ -4312,6 +4312,8 @@ static void btif_media_send_aa_frame(uint64_t timestamp_us)
43124312 #define A2DP_CODEC_AAC 2
43134313 /* Below type is not defined in spec, it is for our convenience */
43144314 #define A2DP_CODEC_APTX 8
4315+
4316+#define A2DP_CODEC_APTX_HD 9
43154317 /* Need to check if we need a different type for APTX low latency
43164318 * or just we can handle with reducing the MTU updated in media
43174319 * channel configuration.
@@ -4324,6 +4326,7 @@ static void btif_media_send_aa_frame(uint64_t timestamp_us)
43244326 #define A2DP_TRANSPORT_STREAM_TYPE_SBC 0
43254327 #define A2DP_TRANSPORT_STREAM_TYPE_AAC 2
43264328 #define A2DP_TRANSPORT_STREAM_TYPE_APTX 8
4329+#define A2DP_TRANSPORT_STREAM_TYPE_APTX_HD 9
43274330
43284331 void disconnect_a2dp_on_vendor_start_failure()
43294332 {
@@ -4506,8 +4509,16 @@ BOOLEAN btif_media_send_vendor_selected_codec()
45064509 UINT16 index = 0;
45074510
45084511 codec_type = bta_av_co_get_current_codec();
4509- if (codec_type == A2D_NON_A2DP_MEDIA_CT)
4510- codec_type = A2DP_CODEC_APTX;
4512+ if (codec_type == A2D_NON_A2DP_MEDIA_CT) {
4513+ UINT8* ptr = bta_av_co_get_current_codecInfo();
4514+ if (ptr) {
4515+ tA2D_APTX_CIE* codecInfo = (tA2D_APTX_CIE*) &ptr[BTA_AV_CFG_START_IDX];
4516+ if (codecInfo && codecInfo->vendorId == A2D_APTX_VENDOR_ID && codecInfo->codecId == A2D_APTX_CODEC_ID_BLUETOOTH)
4517+ codec_type = A2DP_CODEC_APTX;
4518+ else if (codecInfo && codecInfo->vendorId == A2D_APTX_HD_VENDOR_ID && codecInfo->codecId == A2D_APTX_HD_CODEC_ID_BLUETOOTH)
4519+ codec_type = A2DP_CODEC_APTX_HD;
4520+ }
4521+ }
45114522
45124523 APPL_TRACE_IMP("btif_media_send_selected_codec: codec: %d", codec_type);
45134524 param[index++] = VS_QHCI_A2DP_SELECTED_CODEC;
@@ -4566,8 +4577,18 @@ BOOLEAN btif_media_send_vendor_transport_cfg()
45664577 UINT8 stream_type;
45674578 APPL_TRACE_IMP("btif_media_send_vendor_transport_cfg: codec: %d", codec_type);
45684579 stream_type = codec_type;
4569- if (codec_type == A2D_NON_A2DP_MEDIA_CT)
4570- stream_type = A2DP_TRANSPORT_STREAM_TYPE_APTX;
4580+
4581+ if (codec_type == A2D_NON_A2DP_MEDIA_CT) {
4582+ UINT8* ptr = bta_av_co_get_current_codecInfo();
4583+ if (ptr) {
4584+ tA2D_APTX_CIE* codecInfo = (tA2D_APTX_CIE*) &ptr[BTA_AV_CFG_START_IDX];
4585+ if (codecInfo && codecInfo->vendorId == A2D_APTX_VENDOR_ID && codecInfo->codecId == A2D_APTX_CODEC_ID_BLUETOOTH)
4586+ stream_type = A2DP_TRANSPORT_STREAM_TYPE_APTX;
4587+ else if (codecInfo && codecInfo->vendorId == A2D_APTX_HD_VENDOR_ID && codecInfo->codecId == A2D_APTX_HD_CODEC_ID_BLUETOOTH)
4588+ stream_type = A2DP_TRANSPORT_STREAM_TYPE_APTX_HD;
4589+ }
4590+ }
4591+
45714592 param[0] = VS_QHCI_A2DP_TRANSPORT_CONFIGURATION;
45724593 param[1] = A2DP_TRANSPORT_TYPE_SLIMBUS;
45734594 param[2] = stream_type;