All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] pcm: set the snd_pcm_ioplug_status() tstamp field
@ 2020-11-04 13:49 Jonas Holmberg
  2020-11-05 14:24 ` Jonas Holmberg
  0 siblings, 1 reply; 4+ messages in thread
From: Jonas Holmberg @ 2020-11-04 13:49 UTC (permalink / raw)
  To: tiwai; +Cc: alsa-devel

Set the status tstamp field so that it can be accessed with
snd_pcm_status_get_htstamp().

Signed-off-by: Jonas Holmberg <jonashg@axis.com>
---
 src/pcm/pcm_ioplug.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/pcm/pcm_ioplug.c b/src/pcm/pcm_ioplug.c
index a437ca32..9b1b8ac3 100644
--- a/src/pcm/pcm_ioplug.c
+++ b/src/pcm/pcm_ioplug.c
@@ -115,6 +115,7 @@ static int snd_pcm_ioplug_status(snd_pcm_t *pcm, snd_pcm_status_t * status)
 	snd_pcm_ioplug_hw_ptr_update(pcm);
 	status->state = io->data->state;
 	status->trigger_tstamp = io->trigger_tstamp;
+	gettimestamp(&status->tstamp, pcm->tstamp_type);
 	status->avail = snd_pcm_mmap_avail(pcm);
 	status->avail_max = io->avail_max;
 	return 0;
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] pcm: set the snd_pcm_ioplug_status() tstamp field
  2020-11-04 13:49 [PATCH] pcm: set the snd_pcm_ioplug_status() tstamp field Jonas Holmberg
@ 2020-11-05 14:24 ` Jonas Holmberg
  2020-12-02 14:31   ` Takashi Iwai
  0 siblings, 1 reply; 4+ messages in thread
From: Jonas Holmberg @ 2020-11-05 14:24 UTC (permalink / raw)
  To: tiwai; +Cc: alsa-devel

On Wed, Nov 04, 2020 at 02:49:56PM +0100, Jonas Holmberg wrote:
> Set the status tstamp field so that it can be accessed with
> snd_pcm_status_get_htstamp().
> 
> Signed-off-by: Jonas Holmberg <jonashg@axis.com>
> ---
>  src/pcm/pcm_ioplug.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/src/pcm/pcm_ioplug.c b/src/pcm/pcm_ioplug.c
> index a437ca32..9b1b8ac3 100644
> --- a/src/pcm/pcm_ioplug.c
> +++ b/src/pcm/pcm_ioplug.c
> @@ -115,6 +115,7 @@ static int snd_pcm_ioplug_status(snd_pcm_t *pcm, snd_pcm_status_t * status)
>  	snd_pcm_ioplug_hw_ptr_update(pcm);
>  	status->state = io->data->state;
>  	status->trigger_tstamp = io->trigger_tstamp;
> +	gettimestamp(&status->tstamp, pcm->tstamp_type);
>  	status->avail = snd_pcm_mmap_avail(pcm);
>  	status->avail_max = io->avail_max;
>  	return 0;
> -- 
> 2.26.2
> 

Is there a reason that the tstamp field of snd_pcm_ioplug_status() is 
always 0? I assumed that it was an oversight/bug so this patch sets it 
so that applications can read it with snd_pcm_status_get_htstamp(). I 
have tested it and it seems to work well.

BR
Jonas

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] pcm: set the snd_pcm_ioplug_status() tstamp field
  2020-11-05 14:24 ` Jonas Holmberg
@ 2020-12-02 14:31   ` Takashi Iwai
  0 siblings, 0 replies; 4+ messages in thread
From: Takashi Iwai @ 2020-12-02 14:31 UTC (permalink / raw)
  To: Jonas Holmberg; +Cc: alsa-devel

On Thu, 05 Nov 2020 15:24:37 +0100,
Jonas Holmberg wrote:
> 
> On Wed, Nov 04, 2020 at 02:49:56PM +0100, Jonas Holmberg wrote:
> > Set the status tstamp field so that it can be accessed with
> > snd_pcm_status_get_htstamp().
> > 
> > Signed-off-by: Jonas Holmberg <jonashg@axis.com>
> > ---
> >  src/pcm/pcm_ioplug.c | 1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/src/pcm/pcm_ioplug.c b/src/pcm/pcm_ioplug.c
> > index a437ca32..9b1b8ac3 100644
> > --- a/src/pcm/pcm_ioplug.c
> > +++ b/src/pcm/pcm_ioplug.c
> > @@ -115,6 +115,7 @@ static int snd_pcm_ioplug_status(snd_pcm_t *pcm, snd_pcm_status_t * status)
> >  	snd_pcm_ioplug_hw_ptr_update(pcm);
> >  	status->state = io->data->state;
> >  	status->trigger_tstamp = io->trigger_tstamp;
> > +	gettimestamp(&status->tstamp, pcm->tstamp_type);
> >  	status->avail = snd_pcm_mmap_avail(pcm);
> >  	status->avail_max = io->avail_max;
> >  	return 0;
> > -- 
> > 2.26.2
> > 
> 
> Is there a reason that the tstamp field of snd_pcm_ioplug_status() is 
> always 0? I assumed that it was an oversight/bug so this patch sets it 
> so that applications can read it with snd_pcm_status_get_htstamp(). I 
> have tested it and it seems to work well.

I guess it's an oversight.  It's one of few places where the no real
hardware slave PCM is present, and the other one (null plugin) already
set it.

Also maybe cause snd_pcm_htimestamp() worked without this change; it's
updating the timstamp with a different code path.

In anyway, I applied your patch now.  Thanks!


Takashi

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] pcm: set the snd_pcm_ioplug_status() tstamp field
@ 2020-11-02 12:55 Jonas Holmberg
  0 siblings, 0 replies; 4+ messages in thread
From: Jonas Holmberg @ 2020-11-02 12:55 UTC (permalink / raw)
  To: patch; +Cc: alsa-devel

Signed-off-by: Jonas Holmberg <jonashg@axis.com>
---
 src/pcm/pcm_ioplug.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/pcm/pcm_ioplug.c b/src/pcm/pcm_ioplug.c
index a437ca32..9b1b8ac3 100644
--- a/src/pcm/pcm_ioplug.c
+++ b/src/pcm/pcm_ioplug.c
@@ -115,6 +115,7 @@ static int snd_pcm_ioplug_status(snd_pcm_t *pcm, snd_pcm_status_t * status)
 	snd_pcm_ioplug_hw_ptr_update(pcm);
 	status->state = io->data->state;
 	status->trigger_tstamp = io->trigger_tstamp;
+	gettimestamp(&status->tstamp, pcm->tstamp_type);
 	status->avail = snd_pcm_mmap_avail(pcm);
 	status->avail_max = io->avail_max;
 	return 0;
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-12-02 14:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-04 13:49 [PATCH] pcm: set the snd_pcm_ioplug_status() tstamp field Jonas Holmberg
2020-11-05 14:24 ` Jonas Holmberg
2020-12-02 14:31   ` Takashi Iwai
  -- strict thread matches above, loose matches on Subject: below --
2020-11-02 12:55 Jonas Holmberg

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.