All of lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Sakamoto <o-takashi@sakamocchi.jp>
To: sutar.mounesh@gmail.com, patch@alsa-project.org
Cc: alsa-devel@alsa-project.org, Andreas Pape <apape@de.adit-jv.com>,
	mounesh_sutar@mentor.com
Subject: Re: [PATCH v5 6/6] pcm:plug: save converter config
Date: Wed, 22 Mar 2017 00:33:11 +0900	[thread overview]
Message-ID: <bdd4af48-6432-734b-44a4-d57d4eb93a40@sakamocchi.jp> (raw)
In-Reply-To: <1490101098-24998-1-git-send-email-sutar.mounesh@gmail.com>

On Mar 21 2017 21:58, sutar.mounesh@gmail.com wrote:
> From: Andreas Pape <apape@de.adit-jv.com>
>
> Passed config is freed after call to open, thus it is invalid when
> trying to extract the converter name. So config entry is saved
> for later usage.
>
> Signed-off-by: Andreas Pape <apape@de.adit-jv.com>
> Signed-off-by: Mounesh Sutar <sutar.mounesh@gmail.com>

Reviewd-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>

Iwa-san, would you please modify indentation of second argument
of 'snd_config_copy()' when applying this patch? One space is
required if we strictly follow coding convention, I think.

> diff --git a/src/pcm/pcm_plug.c b/src/pcm/pcm_plug.c
> index 266707b..c4375ec 100644
> --- a/src/pcm/pcm_plug.c
> +++ b/src/pcm/pcm_plug.c
> @@ -50,7 +50,7 @@ typedef struct {
>  	snd_pcm_format_t sformat;
>  	int schannels;
>  	int srate;
> -	const snd_config_t *rate_converter;
> +	snd_config_t *rate_converter;
>  	enum snd_pcm_plug_route_policy route_policy;
>  	snd_pcm_route_ttable_entry_t *ttable;
>  	int ttable_ok;
> @@ -64,6 +64,10 @@ static int snd_pcm_plug_close(snd_pcm_t *pcm)
>  	snd_pcm_plug_t *plug = pcm->private_data;
>  	int err, result = 0;
>  	free(plug->ttable);
> +        if (plug->rate_converter) {
> +                snd_config_delete(plug->rate_converter);
> +                plug->rate_converter = NULL;
> +        }
>  	assert(plug->gen.slave == plug->req_slave);
>  	if (plug->gen.close_slave) {
>  		snd_pcm_unlink_hw_ptr(pcm, plug->req_slave);
> @@ -1108,7 +1112,6 @@ int snd_pcm_plug_open(snd_pcm_t **pcmp,
>  	plug->sformat = sformat;
>  	plug->schannels = schannels;
>  	plug->srate = srate;
> -	plug->rate_converter = rate_converter;
>  	plug->gen.slave = plug->req_slave = slave;
>  	plug->gen.close_slave = close_slave;
>  	plug->route_policy = route_policy;
> @@ -1125,6 +1128,15 @@ int snd_pcm_plug_open(snd_pcm_t **pcmp,
>  	pcm->ops = &snd_pcm_plug_ops;
>  	pcm->fast_ops = slave->fast_ops;
>  	pcm->fast_op_arg = slave->fast_op_arg;
> +	if (rate_converter) {
> +		err = snd_config_copy(&plug->rate_converter,
> +				     (snd_config_t *)rate_converter);
> +		if (err < 0) {
> +			snd_pcm_free(pcm);
> +			free(plug);
> +			return err;
> +		}
> +	}
>  	pcm->private_data = plug;
>  	pcm->poll_fd = slave->poll_fd;
>  	pcm->poll_events = slave->poll_events;


Thanks

Takashi Sakamoto

  reply	other threads:[~2017-03-21 15:33 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-21 12:58 [PATCH v5 6/6] pcm:plug: save converter config sutar.mounesh
2017-03-21 15:33 ` Takashi Sakamoto [this message]
2017-03-21 15:41   ` Takashi Iwai

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=bdd4af48-6432-734b-44a4-d57d4eb93a40@sakamocchi.jp \
    --to=o-takashi@sakamocchi.jp \
    --cc=alsa-devel@alsa-project.org \
    --cc=apape@de.adit-jv.com \
    --cc=mounesh_sutar@mentor.com \
    --cc=patch@alsa-project.org \
    --cc=sutar.mounesh@gmail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.