summaryrefslogtreecommitdiff
path: root/android/a2dp.c
Commit message (Collapse)AuthorAgeFilesLines
* build: Replace use of g_memdup with util_memdupLuiz Augusto von Dentz2022-01-061-4/+5
| | | | | | | | | | | This replaces the uses of g_memdup with util_memdup since the former has been deprecated: warning: ‘g_memdup’ is deprecated: Use 'g_memdup2' instead [-Wdeprecated-declarations] g_memdup2 requires bumping glib version which would likely have its own problems thus why util_memdup was introduced.
* btio: Inclusive language changesArchie Pusaka2021-09-211-1/+1
| | | | | | | BT core spec 5.3 promotes the usage of inclusive languages. This CL uses "central" as it is deemed to be more appropriate. Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
* android: Add SPDX License IdentifierTedd Ho-Jeong An2020-09-211-14/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds SPDX License Identifier and removes the license text. ------------------------------------- License COUNT ------------------------------------- Apache-2.0 : 80 LGPL-2.1-or-later : 42 GPL-2.0-or-later : 9 License: Apache-2.0 android/bluetoothd-wrapper.c android/tester-hidhost.c android/tester-map-client.c android/hal-audio-aptx.c android/hal-audio.c android/hal-handsfree-client.c android/tester-gatt.c android/hal-pan.c android/hal-socket.c android/tester-hdp.c android/tester-pan.c android/tester-avrcp.c android/hal-a2dp-sink.c android/hal-gatt.c android/hal-avrcp.c android/tester-a2dp.c android/hal-audio.h android/hal-bluetooth.c android/tester-socket.c android/hal-health.c android/hal-a2dp.c android/hal-ipc.c android/hal-avrcp-ctrl.c android/hal-sco.c android/hal-ipc.h android/tester-main.c android/hal-audio-sbc.c android/hal-utils.c android/hal-map-client.c android/hal-handsfree.c android/hal-log.h android/hal.h android/hal-utils.h android/tester-bluetooth.c android/hal-hidhost.c android/audio_utils/resampler.h android/audio_utils/resampler.c android/system/audio.h android/hardware/bt_sock.h android/hardware/bt_gatt_client.h android/hardware/bt_hh.h android/hardware/bluetooth.h android/hardware/hardware.h android/hardware/bt_hf_client.h android/hardware/bt_rc.h android/hardware/bt_hf.h android/hardware/bt_pan.h android/hardware/bt_gatt_types.h android/hardware/hardware.c android/hardware/audio_effect.h android/hardware/audio.h android/hardware/bt_gatt_server.h android/hardware/bt_gatt.h android/hardware/bt_hl.h android/hardware/bt_mce.h android/hardware/bt_av.h android/client/if-hh.c android/client/if-sco.c android/client/pollhandler.h android/client/haltest.c android/client/tabcompletion.c android/client/if-hf-client.c android/client/history.h android/client/if-audio.c android/client/terminal.h android/client/if-av.c android/client/if-main.h android/client/if-av-sink.c android/client/terminal.c android/client/if-mce.c android/client/if-hf.c android/client/pollhandler.c android/client/if-sock.c android/client/if-rc-ctrl.c android/client/if-rc.c android/client/history.c android/client/if-pan.c android/client/if-gatt.c android/client/if-bt.c android/client/if-hl.c License: LGPL-2.1-or-later android/sco.h android/socket.c android/tester-main.h android/hidhost.h android/map-client.h android/utils.h android/hal-msg.h android/health.h android/avrcp-lib.c android/bluetoothd-snoop.c android/a2dp.c android/bluetooth.h android/a2dp-sink.c android/handsfree-client.c android/audio-msg.h android/main.c android/pan.c android/ipc-tester.c android/health.c android/socket.h android/handsfree.h android/avrcp-lib.h android/a2dp-sink.h android/system-emulator.c android/gatt.c android/avrcp.h android/pan.h android/test-ipc.c android/hidhost.c android/a2dp.h android/avrcp.c android/sco-msg.h android/bluetooth.c android/map-client.c android/handsfree-client.h android/ipc.c android/handsfree.c android/gatt.h android/ipc.h android/ipc-common.h android/compat/wordexp.h android/cutils/properties.h License: GPL-2.0-or-later android/avdtp.h android/avctp.c android/avdtptest.c android/sco.c android/log.c android/avdtp.c android/avctp.h android/compat/readline/history.h android/compat/readline/readline.h
* a2dp-codecs: Define a2dp_vendor_codec_t struct in endian neutral wayPali Rohár2018-12-281-4/+4
| | | | | | And define new macros A2DP_GET_VENDOR_ID(), A2DP_GET_CODEC_ID() and A2DP_SET_VENDOR_ID_CODEC_ID() for easily filling a2dp_vendor_codec_t struct.
* android/avdtp: Refactor local SEP list handlingAndrei Emeltchenko2015-02-221-4/+14
| | | | | | In order to deduplicate similar code in android/ and profiles/ we need to handle local SEP queue outside of avdtp.c. GSList is transformed to queue.
* android/avdtp: Move PSM definition to AVDTP headerSzymon Janc2014-08-281-3/+2
|
* android/hal-audio: Allow to autoselect endpoint in open_stream IPCAndrzej Kaczmarek2014-06-011-1/+5
| | | | | | | | | | | | | 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).
* android/a2dp: Add support to check aptX capabilitiesAndrzej Kaczmarek2014-05-301-0/+37
|
* android/a2dp: Add support to check MPEG-2,4 AAC capsAndrzej Kaczmarek2014-05-301-0/+72
|
* android/a2dp: Fix SEP selectionAndrzej Kaczmarek2014-05-301-0/+8
| | | | | | | | | | | When matching remote SEP to local SEP we do not match vendor codecs properly, i.e. neither vendor ID not codec ID are checked, which may cause wrong endpoint to be selected in case there are more that one endpoints using vendor codec on remote. This patch fixes this by assinging vendor codec indentification to local SEP after it's registered and uses this information when matching SEPs.
* android/a2dp: Fix removing device on incoming connectionAndrzej Kaczmarek2014-05-301-5/+4
| | | | | | | | | | | | | | | | | | Connection state is not changed for incoming connection, i.e. during discovery device is still in disconnected state and in case connection fails for some reason, device won't be removed due to triggered state change disconnected->disconnected which is silently ignored. This patch fixes this problem by changing device state to connecting immediately after signalling channel is connected. This allows device to be removed properly in case something fails and is also consistent with behaviour of Bluedroid. In addition there's new flag added to device which stores information whether we're initiator of connection. This is required because before fix this property was decided based on HAL state which we can't now use since it will be always connecting for both incoming and outgoing connections.
* android/a2dp: Remove unused local variableSzymon Janc2014-04-231-2/+1
|
* android/a2dp: Prefer master role on incoming connectionsAndrzej Kaczmarek2014-04-171-0/+1
|
* android: Pass mode parameter to registered servicesSzymon Janc2014-03-041-1/+1
|
* android: Create comon header for IPCSzymon Janc2014-02-281-0/+1
| | | | | | | | | This header contains IPC specific structures and code not related to BT and audio HAL protocols. This allows to fully decouple IPC from HAL messages. This is first step to make HAL part of IPC unit-testable and reusable between BT HAL and audio HAL.
* android/a2dp: Use common IPC for audio socketSzymon Janc2014-02-281-26/+47
| | | | This makes audio HAL to use same code for IPC as BT HAL.
* android: Refactor IPC initSzymon Janc2014-02-281-10/+17
| | | | | This allows to pass socket path and max service ID while initializaing IPC. This is first step to allow use it both for BT and Audio HALs.
* android: Update copyright and license detailsMarcel Holtmann2014-02-111-10/+10
|
* android/a2dp: Fix audio deregistrationAndrzej Kaczmarek2014-02-101-3/+3
| | | | | | Unregistering a SEP can trigger abort_cfm callback if some device is connected thus we should free setups list after all endpoints are unregistered to avoid error in abort_cfm due to non-existing setup.
* android/a2dp: Disconnect headset on IPC failureAndrzej Kaczmarek2014-02-101-0/+7
| | | | | | In case audio IPC is suddenly disconnected (most likely due to crash of mediaserver process) we should disconnect headset since it is no longer associated with valid setup and cannot be used properly.
* android/a2dp: Notify audio state on SEP closeAndrzej Kaczmarek2014-02-101-1/+13
|
* android/A2DP: Fix invalid readLuiz Augusto von Dentz2014-02-061-3/+8
| | | | | | | | | | | | | | | | | Invalid read of size 8 at 0x30EE465A78: g_slice_free_chain_with_offset (in /usr/lib64/libglib-2.0.so.0.3800.2) by 0x418209: bt_a2dp_unregister (a2dp.c:1576) by 0x4039E6: main (main.c:347) Address 0x4f2d248 is 8 bytes inside a block of size 16 free'd at 0x4A07577: free (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) by 0x30EE44EF7E: g_free (in /usr/lib64/libglib-2.0.so.0.3800.2) by 0x30EE4655CA: g_slice_free1 (in /usr/lib64/libglib-2.0.so.0.3800.2) by 0x30EE465F0C: g_slist_remove (in /usr/lib64/libglib-2.0.so.0.3800.2) by 0x41645F: a2dp_device_free (a2dp.c:174) by 0x30EE466477: g_slist_foreach (in /usr/lib64/libglib-2.0.so.0.3800.2) by 0x30EE46649A: g_slist_free_full (in /usr/lib64/libglib-2.0.so.0.3800.2) by 0x418209: bt_a2dp_unregister (a2dp.c:1576) by 0x4039E6: main (main.c:347)
* android: Disconnect AVRCP once A2DP is disconnectedLuiz Augusto von Dentz2014-02-051-0/+2
| | | | If A2DP is disconnected also disconnect AVRCP.
* android: Connect AVRCP once A2DP is connectedLuiz Augusto von Dentz2014-02-051-0/+2
| | | | | In case of being the initiator of the A2DP connection also attempt to connect AVRCP.
* android/a2dp: Fix crash on remote disconnectionSzymon Janc2014-01-291-16/+33
| | | | | | | | | | | | | | | | | | | | | | | | | Remove setups when a2dp device is removed. This fix following: Invalid read of size 4 at 0x115E32: bt_stream_close (a2dp.c:1352) by 0x111DFB: ipc_handle_msg (ipc.c:95) by 0x11234B: audio_watch_cb (audio-ipc.c:67) by 0x48BD9C7: ??? (in /system/lib/libglib.so) Address 0x4a590f4 is 12 bytes inside a block of size 20 free'd at 0x4897E6C: free (in /system/lib/valgrind/vgpreload_memcheck-arm-linux.so) by 0x48C5E2B: g_free (in /system/lib/libglib.so) Invalid read of size 4 at 0x113638: avdtp_close (avdtp.c:3201) by 0x115E39: bt_stream_close (a2dp.c:1352) by 0x111DFB: ipc_handle_msg (ipc.c:95) by 0x11234B: audio_watch_cb (audio-ipc.c:67) by 0x48BD9C7: ??? (in /system/lib/libglib.so) Address 0x4a594a4 is 28 bytes inside a block of size 1,100 free'd at 0x4897E6C: free (in /system/lib/valgrind/vgpreload_memcheck-arm-linux.so) by 0x48C5E2B: g_free (in /system/lib/libglib.so)
* android: Use src/log.h include instead of just log.hMarcel Holtmann2014-01-261-1/+1
|
* android/a2dp: Fix audio resume on started streamAndrzej Kaczmarek2014-01-241-4/+6
| | | | | | | In case stream is started from remote we'll receive Resume Stream IPC when audio is already considered as started (i.e. on first write from AudioFlinger). In such case we should not try to send AVDTP_START since this will fail but just reply success over IPC instead.
* android/A2DP: Fix invalid read after unregistering an endpointLuiz Augusto von Dentz2014-01-231-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | The endpoint is unregistered but it was still accessible via endpoints list causing the following trace when audio HAL is closed: Invalid read of size 8 at 0x414A49: unregister_endpoint (a2dp.c:114) by 0x3862466477: g_slist_foreach (in /usr/lib64/libglib-2.0.so.0.3800.2) by 0x386246649A: g_slist_free_full (in /usr/lib64/libglib-2.0.so.0.3800.2) by 0x414985: audio_disconnected (a2dp.c:1446) by 0x40FD5C: audio_watch_cb (audio-ipc.c:79) by 0x38624492A5: g_main_context_dispatch (in /usr/lib64/libglib-2.0.so.0.3800.2) by 0x3862449627: ??? (in /usr/lib64/libglib-2.0.so.0.3800.2) by 0x3862449A39: g_main_loop_run (in /usr/lib64/libglib-2.0.so.0.3800.2) by 0x4034D5: main (main.c:449) Address 0x4cd5e68 is 8 bytes inside a block of size 32 free'd at 0x4A07577: free (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) by 0x386244EF7E: g_free (in /usr/lib64/libglib-2.0.so.0.3800.2) by 0x4159FD: bt_audio_close (a2dp.c:1296) by 0x40F629: ipc_handle_msg (ipc.c:95) by 0x40FD9F: audio_watch_cb (audio-ipc.c:67) by 0x38624492A5: g_main_context_dispatch (in /usr/lib64/libglib-2.0.so.0.3800.2) by 0x3862449627: ??? (in /usr/lib64/libglib-2.0.so.0.3800.2) by 0x3862449A39: g_main_loop_run (in /usr/lib64/libglib-2.0.so.0.3800.2) by 0x4034D5: main (main.c:449)
* android: Add MTU data to Open Stream Audio IPCAndrzej Kaczmarek2014-01-231-2/+6
| | | | | | | | | MTU value for transport channel is sent in Open Stream response, which is required to calculate number of frames which can be packed into single media packet. This is to avoid including GPLv2 licensed headers in Audio HAL implementation.
* android/A2DP: Add retry logic to Audio IPCLuiz Augusto von Dentz2014-01-211-3/+65
| | | | | In case the audio HAL disconnects without cleaning up its endpoints treat it as unclean disconnection and attempt to reconnect.
* android/A2DP: Fix sending notification on bt_a2dp_unregisterLuiz Augusto von Dentz2014-01-211-9/+4
| | | | At this point IPC might have been closed already.
* android/A2DP: Notify when audio state change to suspendLuiz Augusto von Dentz2014-01-181-0/+2
|
* android/A2DP: Notify when audio state change to stoppedLuiz Augusto von Dentz2014-01-181-2/+12
|
* android/A2DP: Notify when audio state change to startedLuiz Augusto von Dentz2014-01-181-2/+35
|
* android/a2dp: Fix typo in conditionAndrzej Kaczmarek2014-01-161-1/+1
|
* android/A2DP: Add timeout to setup stream if remote becomes idleLuiz Augusto von Dentz2014-01-161-1/+30
| | | | | If remote initiate the connection but do not setup any stream take over the role and initiate the stream setup procedure.
* android/A2DP: Send stream fd in open stream responseLuiz Augusto von Dentz2014-01-161-1/+8
| | | | This adds support of sending stream fd within open stream response.
* android/A2DP: Fix selecting invalid bitpool range for SBCLuiz Augusto von Dentz2014-01-161-2/+59
| | | | | | For SBC bitpool range may not strictly match with presets so it needs to be adjusted to fit within remote capabilities otherwise the remote device may reject the configuration.
* android/A2DP: Change to connected state when a transport openLuiz Augusto von Dentz2014-01-161-2/+2
| | | | | | | This changes the connected state to be only sent once a transport is open, before this was done right after the signalling was connected but this reflect in the audio HAL side attempting to open a stream while with possible no transport available.
* android/a2dp: Fix memory leakAndrzej Kaczmarek2014-01-161-0/+2
| | | | | | | | | | | | | | | | | | | audio_ipc_send_rsp_full() does not free buffer passed as parameter thus it should be freed by caller. This fixes following Valgrind report: ==1238== 5 bytes in 1 blocks are definitely lost in loss record 22 of 54 ==1238== at 0x4896DC8: calloc (in /system/lib/valgrind/vgpreload_memcheck-arm-linux.so) ==1238== by 0x48C5DB7: g_malloc0 (gmem.c:189) ==1238== by 0x1150EF: bt_stream_open (a2dp.c:1177) ==1238== by 0x1116A7: ipc_handle_msg (ipc.c:95) ==1238== by 0x111C11: audio_watch_cb (audio-ipc.c:66) ==1238== by 0x48BD9C7: g_io_unix_dispatch (giounix.c:166) ==1238== by 0x48C2CCB: g_main_context_dispatch (gmain.c:2539) ==1238== by 0x48C2ED9: g_main_context_iterate.isra.19 (gmain.c:3146) ==1238== by 0x48C3167: g_main_loop_run (gmain.c:3340) ==1238== by 0x10B207: main (main.c:436)
* android/a2dp: Fix memory leakAndrzej Kaczmarek2014-01-161-0/+2
| | | | | | | | | | | | | | | | | | | avdtp_service_cap_new() makes own copy of data stored in "codec" thus it should be freed by caller. This fixes following Valgrind report: ==1238== 6 bytes in 1 blocks are definitely lost in loss record 27 of 54 ==1238== at 0x4896DC8: calloc (in /system/lib/valgrind/vgpreload_memcheck-arm-linux.so) ==1238== by 0x48C5DB7: g_malloc0 (gmem.c:189) ==1238== by 0x115B4B: discover_cb (a2dp.c:303) ==1238== by 0x111DE7: finalize_discovery (avdtp.c:933) ==1238== by 0x114441: session_cb (avdtp.c:2556) ==1238== by 0x48BD9C7: g_io_unix_dispatch (giounix.c:166) ==1238== by 0x48C2CCB: g_main_context_dispatch (gmain.c:2539) ==1238== by 0x48C2ED9: g_main_context_iterate.isra.19 (gmain.c:3146) ==1238== by 0x48C3167: g_main_loop_run (gmain.c:3340) ==1238== by 0x10B207: main (main.c:436)
* android/A2DP: Connect transport channel when initiatorLuiz Augusto von Dentz2014-01-151-12/+39
| | | | This connects transport channel when initiator of open request.
* android/A2DP: Add handling of incoming transport connectionLuiz Augusto von Dentz2014-01-151-4/+60
| | | | This adds handling of incoming transport connection attempt.
* android/a2dp: Fix freeing preset on SEP closeAndrzej Kaczmarek2014-01-151-1/+3
| | | | | | | In case SEP was opened from local side, corresponding a2dp_setup structure has just reference to a2dp_preset which is stored on presets list. As a result, when closing SEP such preset will be freed leaving dangling pointer on presets list.
* android/a2dp: Fix IPC response length calculationAndrzej Kaczmarek2014-01-151-2/+2
| | | | | | struct audio_rsp_open_stream has only zero-length array member thus its size equals to 0. We need to explicitly specify size of array element type here.
* audio/A2DP: Add implemention of SEP abort confirmationLuiz Augusto von Dentz2014-01-141-0/+15
|
* audio/A2DP: Add implemention of SEP close confirmationLuiz Augusto von Dentz2014-01-141-0/+15
|
* audio/A2DP: Add implemention of SEP suspend confirmationLuiz Augusto von Dentz2014-01-141-0/+15
|
* audio/A2DP: Add implemention of SEP start confirmationLuiz Augusto von Dentz2014-01-141-0/+15
|
* audio/A2DP: Add implemention of SEP open confirmationLuiz Augusto von Dentz2014-01-141-14/+42
|