Linux bluetooth development
 help / color / mirror / Atom feed
From: Szymon Janc <szymon.janc@gmail.com>
To: Andrzej Kaczmarek <andrzej.kaczmarek@tieto.com>
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH 8/9] android/hal-audio: Read fd from Output Stream response
Date: Fri, 17 Jan 2014 19:13:52 +0100	[thread overview]
Message-ID: <1772554.HcRPMI1tWs@athlon> (raw)
In-Reply-To: <1389973213-30251-9-git-send-email-andrzej.kaczmarek@tieto.com>

Hi Andrzej,

On Friday 17 January 2014 16:40:12 Andrzej Kaczmarek wrote:
> ---
>  android/hal-audio.c | 11 +++++++----
>  1 file changed, 7 insertions(+), 4 deletions(-)
> 
> diff --git a/android/hal-audio.c b/android/hal-audio.c
> index f2cb12a..d8438f7 100644
> --- a/android/hal-audio.c
> +++ b/android/hal-audio.c
> @@ -575,7 +575,7 @@ static int ipc_close_cmd(uint8_t endpoint_id)
>  	return result;
>  }
> 
> -static int ipc_open_stream_cmd(uint8_t endpoint_id, uint16_t *mtu,
> +static int ipc_open_stream_cmd(uint8_t endpoint_id, uint16_t *mtu, int *fd,
> struct audio_preset **caps)
>  {
>  	char buf[BLUEZ_AUDIO_MTU];
> @@ -593,7 +593,7 @@ static int ipc_open_stream_cmd(uint8_t endpoint_id,
> uint16_t *mtu, cmd.id = endpoint_id;
> 
>  	result = audio_ipc_cmd(AUDIO_SERVICE_ID, AUDIO_OP_OPEN_STREAM,
> -				sizeof(cmd), &cmd, &rsp_len, rsp, NULL);
> +				sizeof(cmd), &cmd, &rsp_len, rsp, fd);
> 
>  	if (result == AUDIO_STATUS_SUCCESS) {
>  		size_t buf_len = sizeof(struct audio_preset) +
> @@ -990,6 +990,7 @@ static int audio_open_output_stream(struct
> audio_hw_device *dev, struct audio_preset *preset;
>  	const struct audio_codec *codec;
>  	uint16_t mtu;
> +	int fd;
> 
>  	out = calloc(1, sizeof(struct a2dp_stream_out));
>  	if (!out)
> @@ -1017,13 +1018,15 @@ static int audio_open_output_stream(struct
> audio_hw_device *dev, /* TODO: for now we always use endpoint 0 */
>  	out->ep = &audio_endpoints[0];
> 
> -	if (ipc_open_stream_cmd(out->ep->id, &mtu, &preset) !=
> +	if (ipc_open_stream_cmd(out->ep->id, &mtu, &fd, &preset) !=
>  			AUDIO_STATUS_SUCCESS)
>  		goto fail;
> 
> -	if (!preset)
> +	if (!preset || fd < 0)
>  		goto fail;

For sanity, code under fail label should be updated to handle that either 
preset or fd might be valid here.

> 
> +	out->ep->fd = fd;
> +

I might be missing something but fd is never closed. Should this be done in 
audio_close_output_stream() ?

>  	codec = out->ep->codec;
> 
>  	codec->init(preset, mtu, &out->ep->codec_data);

-- 
Szymon K. Janc
szymon.janc@gmail.com

  reply	other threads:[~2014-01-17 18:13 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-17 15:40 [PATCH 0/9] android: Add SBC encoding Andrzej Kaczmarek
2014-01-17 15:40 ` [PATCH 1/9] android: Add MTU data to Open Stream Audio IPC Andrzej Kaczmarek
2014-01-17 15:40 ` [PATCH 2/9] android: Build Audio HAL with SBC Andrzej Kaczmarek
2014-01-17 18:27   ` Marcel Holtmann
2014-01-17 19:09     ` Andrzej Kaczmarek
2014-01-17 19:22       ` Marcel Holtmann
2014-01-17 15:40 ` [PATCH 3/9] android/hal-audio: Rename sbc_init to avoid collision with libsbc Andrzej Kaczmarek
2014-01-17 15:40 ` [PATCH 4/9] android/hal-audio: Initialize SBC encoder Andrzej Kaczmarek
2014-01-17 18:24   ` Marcel Holtmann
2014-01-17 19:26     ` Andrzej Kaczmarek
2014-01-17 19:28       ` Marcel Holtmann
2014-01-17 19:38         ` Luiz Augusto von Dentz
2014-01-17 20:24           ` Marcel Holtmann
2014-01-17 19:36       ` Luiz Augusto von Dentz
2014-01-17 19:33     ` Luiz Augusto von Dentz
2014-01-17 15:40 ` [PATCH 5/9] android/hal-audio: Calculate SBC stream parameters Andrzej Kaczmarek
2014-01-17 18:25   ` Marcel Holtmann
2014-01-17 19:17     ` Andrzej Kaczmarek
2014-01-17 19:42       ` Luiz Augusto von Dentz
2014-01-17 20:25         ` Marcel Holtmann
2014-01-17 15:40 ` [PATCH 6/9] android/hal-audio: Add resume to codec callbacks Andrzej Kaczmarek
2014-01-17 15:40 ` [PATCH 7/9] android/hal-audio: Return proper buffer size to AudioFlinger Andrzej Kaczmarek
2014-01-17 15:40 ` [PATCH 8/9] android/hal-audio: Read fd from Output Stream response Andrzej Kaczmarek
2014-01-17 18:13   ` Szymon Janc [this message]
2014-01-17 19:57     ` Luiz Augusto von Dentz
2014-01-19 10:50       ` Lukasz Rymanowski
2014-01-17 15:40 ` [PATCH 9/9] android/hal-audio: Add proper SBC encoding Andrzej Kaczmarek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1772554.HcRPMI1tWs@athlon \
    --to=szymon.janc@gmail.com \
    --cc=andrzej.kaczmarek@tieto.com \
    --cc=linux-bluetooth@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox