alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Jaroslav Kysela <perex@perex.cz>
To: "Alexander E. Patrakov" <patrakov@gmail.com>
Cc: ALSA development <alsa-devel@alsa-project.org>
Subject: Re: [PATCH 2/4] pcm: rate: add rewindable and forwardable callbacks
Date: Fri, 13 Jun 2014 09:13:52 +0200	[thread overview]
Message-ID: <539AA4B0.2050005@perex.cz> (raw)
In-Reply-To: <1402569264-2789-3-git-send-email-patrakov@gmail.com>

Date 12.6.2014 12:34, Alexander E. Patrakov wrote:
> This commit does not fix nonsense values returned by the rewind and
> forward callbacks. E.g., with period_size = 1024 and buffer_size = 4096,
> an attempt to rewind 1024 samples from the nearly-full buffer returns
> 4090.
> 
> Due to these nonsense values, the current rate plugin should be treated
> as non-rewindable. That's why the new callbacks return 0.
> 
> Signed-off-by: Alexander E. Patrakov <patrakov@gmail.com>

I don't agree. The snd_pcm_rate_move_applptr() should be fixed instead
this blocking attempt. Do you have any simple use case?

                                       Jaroslav

> ---
>  src/pcm/pcm_rate.c | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/src/pcm/pcm_rate.c b/src/pcm/pcm_rate.c
> index 2eb4b1b..58ed842 100644
> --- a/src/pcm/pcm_rate.c
> +++ b/src/pcm/pcm_rate.c
> @@ -689,6 +689,16 @@ static int snd_pcm_rate_reset(snd_pcm_t *pcm)
>  	return 0;
>  }
>  
> +static snd_pcm_sframes_t snd_pcm_rate_rewindable(snd_pcm_t *pcm ATTRIBUTE_UNUSED)
> +{
> +	return 0;
> +}
> +
> +static snd_pcm_sframes_t snd_pcm_rate_forwardable(snd_pcm_t *pcm ATTRIBUTE_UNUSED)
> +{
> +	return 0;
> +}
> +
>  static snd_pcm_sframes_t snd_pcm_rate_rewind(snd_pcm_t *pcm, snd_pcm_uframes_t frames)
>  {
>  	snd_pcm_rate_t *rate = pcm->private_data;
> @@ -1221,7 +1231,9 @@ static const snd_pcm_fast_ops_t snd_pcm_rate_fast_ops = {
>  	.drop = snd_pcm_generic_drop,
>  	.drain = snd_pcm_rate_drain,
>  	.pause = snd_pcm_generic_pause,
> +	.rewindable = snd_pcm_rate_rewindable,
>  	.rewind = snd_pcm_rate_rewind,
> +	.forwardable = snd_pcm_rate_forwardable,
>  	.forward = snd_pcm_rate_forward,
>  	.resume = snd_pcm_generic_resume,
>  	.writei = snd_pcm_mmap_writei,
> 


-- 
Jaroslav Kysela <perex@perex.cz>
Linux Kernel Sound Maintainer
ALSA Project; Red Hat, Inc.

  reply	other threads:[~2014-06-13  7:13 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-12 10:34 pcm: Add missing callbacks that cannot be NULL Alexander E. Patrakov
2014-06-12 10:34 ` [PATCH 1/4] pcm:file: add the missing htimestamp callback Alexander E. Patrakov
2014-06-12 10:34 ` [PATCH 2/4] pcm: rate: add rewindable and forwardable callbacks Alexander E. Patrakov
2014-06-13  7:13   ` Jaroslav Kysela [this message]
2014-06-13  8:44     ` Alexander E. Patrakov
2014-06-13  9:19       ` Jaroslav Kysela
2014-06-13  9:46         ` Alexander E. Patrakov
2014-06-12 10:34 ` [PATCH 3/4] pcm: multi: implement " Alexander E. Patrakov
2014-06-12 10:34 ` [PATCH 4/4] pcm: null: add " Alexander E. Patrakov
2014-06-13  7:14 ` pcm: Add missing callbacks that cannot be NULL Jaroslav Kysela

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=539AA4B0.2050005@perex.cz \
    --to=perex@perex.cz \
    --cc=alsa-devel@alsa-project.org \
    --cc=patrakov@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).