Re: [RFC BlueZ 1/3] audio/a2dp: connect A2DP vendor codec if possible

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Chan-yeol,

On Wed, May 6, 2015 at 6:10 PM,  <chanyeol.park@xxxxxxxxxxx> wrote:
> From: Chan-yeol Park <chanyeol.park@xxxxxxxxxxx>
>
> This patch gives the priority on vendor codec during A2DP codec
> negotiation.

There is already a prioritization based on the sender and in the order
the endpoints are registered, so by doing this you would be breaking
the prioritization instead register the codecs in order of preference
that should have the same results.

> ---
>  profiles/audio/a2dp.c | 13 ++++++++++---
>  1 file changed, 10 insertions(+), 3 deletions(-)
>
> diff --git a/profiles/audio/a2dp.c b/profiles/audio/a2dp.c
> index 31c5086..d9a2f72 100644
> --- a/profiles/audio/a2dp.c
> +++ b/profiles/audio/a2dp.c
> @@ -1751,6 +1751,8 @@ static gboolean check_vendor_codec(struct a2dp_sep *sep, uint8_t *cap,
>  static struct a2dp_sep *a2dp_find_sep(struct avdtp *session, GSList *list,
>                                         const char *sender)
>  {
> +       struct a2dp_sep *selected_sep = NULL;
> +
>         for (; list; list = list->next) {
>                 struct a2dp_sep *sep = list->data;
>                 struct avdtp_remote_sep *rsep;
> @@ -1776,15 +1778,20 @@ static struct a2dp_sep *a2dp_find_sep(struct avdtp *session, GSList *list,
>                 service = avdtp_get_codec(rsep);
>                 cap = (struct avdtp_media_codec_capability *) service->data;
>
> -               if (cap->media_codec_type != A2DP_CODEC_VENDOR)
> -                       return sep;
> +               if (cap->media_codec_type != A2DP_CODEC_VENDOR) {
> +                       selected_sep = sep;
> +                       continue;
> +               }
>
>                 if (check_vendor_codec(sep, cap->data,
>                                         service->length - sizeof(*cap)))
>                         return sep;
>         }
>
> -       return NULL;
> +       if (selected_sep)
> +               return selected_sep;
> +       else
> +               return NULL;
>  }
>
>  static struct a2dp_sep *a2dp_select_sep(struct avdtp *session, uint8_t type,
> --
> 2.1.0
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html



-- 
Luiz Augusto von Dentz
--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux