summaryrefslogtreecommitdiff
path: root/android/a2dp.c
diff options
context:
space:
mode:
authorAndrzej Kaczmarek <andrzej.kaczmarek@tieto.com>2014-05-26 15:16:34 +0200
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2014-06-01 10:17:16 +0300
commit27f17d4083f725c150f310186ca7d73d29064ccc (patch)
treea81f7d06de45d5b05b4a869522c8383ce1ec5064 /android/a2dp.c
parent5dab4aaafaeff8d3a71e8e03eecbe62392075d19 (diff)
downloadbluez-27f17d4083f725c150f310186ca7d73d29064ccc.tar.gz
android/hal-audio: Allow to autoselect endpoint in open_stream IPC
audio_open_output_stream always tries to open 1st registered endpoint based on assumption that there is only one endpoint registered anyway (due to support for only one codec). With more endpoints available in future we need to be able to retrieve endpoint id which is connected and use it for streaming. This patch adds special case for id=0 in open_stream IPC to return 1st opened endpoint on BlueZ side which is enough for now since only one headset can be connected at any time (i.e. we should not have more than 1 endpoint opened).
Diffstat (limited to 'android/a2dp.c')
-rw-r--r--android/a2dp.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/android/a2dp.c b/android/a2dp.c
index 3ba743407..dd8bcb8d8 100644
--- a/android/a2dp.c
+++ b/android/a2dp.c
@@ -1470,7 +1470,10 @@ static void bt_stream_open(const void *buf, uint16_t len)
DBG("");
- setup = find_setup(cmd->id);
+ if (cmd->id)
+ setup = find_setup(cmd->id);
+ else
+ setup = setups ? setups->data : NULL;
if (!setup) {
error("Unable to find stream for endpoint %u", cmd->id);
ipc_send_rsp(audio_ipc, AUDIO_SERVICE_ID, AUDIO_OP_OPEN_STREAM,
@@ -1489,6 +1492,7 @@ static void bt_stream_open(const void *buf, uint16_t len)
len = sizeof(struct audio_rsp_open_stream) +
sizeof(struct audio_preset) + setup->preset->len;
rsp = g_malloc0(len);
+ rsp->id = setup->endpoint->id;
rsp->mtu = omtu;
rsp->preset->len = setup->preset->len;
memcpy(rsp->preset->data, setup->preset->data, setup->preset->len);