diff options
author | Andrzej Kaczmarek <andrzej.kaczmarek@tieto.com> | 2014-05-26 15:16:42 +0200 |
---|---|---|
committer | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2014-05-30 14:54:56 +0300 |
commit | e1c7dddd0dd2f5e23e4d4cf98a9dde713fe6dd53 (patch) | |
tree | 7e7a38911916bdd9659177fe818ebd00aa1b8d05 /android/avdtp.c | |
parent | d8354e8e635399768a51efb12784d6ee31ff3f7c (diff) | |
download | bluez-e1c7dddd0dd2f5e23e4d4cf98a9dde713fe6dd53.tar.gz |
android/a2dp: Fix SEP selection
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.
Diffstat (limited to 'android/avdtp.c')
-rw-r--r-- | android/avdtp.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/android/avdtp.c b/android/avdtp.c index 3d309b924..89f486024 100644 --- a/android/avdtp.c +++ b/android/avdtp.c @@ -39,8 +39,10 @@ #include <glib.h> +#include "lib/bluetooth.h" #include "src/log.h" #include "avdtp.h" +#include "../profiles/audio/a2dp-codecs.h" #define AVDTP_PSM 25 @@ -317,6 +319,8 @@ struct avdtp_local_sep { struct avdtp_stream *stream; struct seid_info info; uint8_t codec; + uint32_t vndcodec_vendor; + uint16_t vndcodec_codec; gboolean delay_reporting; GSList *caps; struct avdtp_sep_ind *ind; @@ -1089,6 +1093,18 @@ struct avdtp_remote_sep *avdtp_find_remote_sep(struct avdtp *session, if (codec_data->media_codec_type != lsep->codec) continue; + /* FIXME: Add Vendor Specific Codec match to SEP callback */ + if (lsep->codec == A2DP_CODEC_VENDOR) { + a2dp_vendor_codec_t *vndcodec = + (void *) codec_data->data; + + if (btohl(vndcodec->vendor_id) != lsep->vndcodec_vendor) + continue; + + if (btohs(vndcodec->codec_id) != lsep->vndcodec_codec) + continue; + } + if (sep->stream == NULL) return sep; } @@ -3349,6 +3365,13 @@ struct avdtp_local_sep *avdtp_register_sep(uint8_t type, uint8_t media_type, return sep; } +void avdtp_sep_set_vendor_codec(struct avdtp_local_sep *sep, uint32_t vendor_id, + uint16_t codec_id) +{ + sep->vndcodec_vendor = vendor_id; + sep->vndcodec_codec = codec_id; +} + int avdtp_unregister_sep(struct avdtp_local_sep *sep) { if (!sep) |