All of lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Dan Hordern <danhordern@gmail.com>
Cc: alsa-devel@alsa-project.org
Subject: Re: ALSA: dmix: pcm status incomplete
Date: Wed, 20 May 2015 08:47:50 +0200	[thread overview]
Message-ID: <s5h382ru4mh.wl-tiwai@suse.de> (raw)
In-Reply-To: <CAECUvW3sTPqpquv_BFr61mnmrL5kRDcsD9spF5FfuGJ4CFO98A@mail.gmail.com>

At Wed, 6 May 2015 14:29:01 +1000,
Dan Hordern wrote:
> 
> I require timestamp information from the soundcard and host for our
> application. However, I noticed that when using "dmix:0,0" instead of
> "hw:0,0", the audio timestamp and delay frames are both zero.
> 
> Looking in to the code, it seems that the 'snd_pcm_dmix_status' function
> does not populate either of these. In order to expose these, I have
> modified this function to get this information from the slave pcm; patch
> below.
> 
> I was hoping for some feedback on this change. I am not sure if the delay
> value makes sense as yet, and whether there are consequences of using the
> hardware trigger timestamp etc. I am guessing the dsnoop and dshare plugins
> may also have this issue, though I have not checked.

The trigger_tstamp needs to be kept because you can't fetch it from
the slave PCM.  (Imagine multiple dmix streams are triggered at
different times on the same slave PCM.)

For the delay value, I think your code is OK.

And yes, please fix dsnoop and dshare similarly, too.

Could you resubmit the patch with the fixes above?


Thanks!

Takashi
> 
> Thanks,
> Dan
> 
> 
> diff --git a/src/pcm/pcm_dmix.c b/src/pcm/pcm_dmix.c
> index babde6a..a4d7fc0 100644
> --- a/src/pcm/pcm_dmix.c
> +++ b/src/pcm/pcm_dmix.c
> @@ -475,12 +475,12 @@ static int snd_pcm_dmix_status(snd_pcm_t *pcm,
> snd_pcm_status_t * status)
>                 break;
>         }
>         memset(status, 0, sizeof(*status));
> +       snd_pcm_status(dmix->spcm, status);
>         status->state = snd_pcm_dmix_state(pcm);
> -       status->trigger_tstamp = dmix->trigger_tstamp;
> -       gettimestamp(&status->tstamp, pcm->tstamp_type);
>         status->avail = snd_pcm_mmap_playback_avail(pcm);
>         status->avail_max = status->avail > dmix->avail_max ? status->avail
> : dmix->avail_max;
>         dmix->avail_max = 0;
> +       status->delay = snd_pcm_mmap_playback_delay(pcm);
>         return 0;
>  }
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel@alsa-project.org
> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
> 

      reply	other threads:[~2015-05-20  6:47 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-06  4:29 ALSA: dmix: pcm status incomplete Dan Hordern
2015-05-20  6:47 ` Takashi Iwai [this message]

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=s5h382ru4mh.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=danhordern@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.