Skip to contentSkip to conversation

pcm: set the snd_pcm_ioplug_status() tstamp field

PATCH In review Jonas Holmberg 2 participants 3 messages Nov 4, 2020 – Dec 2, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pcm: set the snd_pcm_ioplug_status() tstamp field

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

---
 src/pcm/pcm_ioplug.c | 1 +
 1 file changed, 1 insertion(+)
src/pcm/pcm_ioplug.c +1 -0
index a437ca32..9b1b8ac3 100644
@@ -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;
Signature · 1 line
2.26.2
#1 lore raw
Quoted 23 lines · Jonas Holmberg

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

---
 src/pcm/pcm_ioplug.c | 1 +
 1 file changed, 1 insertion(+)
src/pcm/pcm_ioplug.c +1 -0
index a437ca32..9b1b8ac3 100644
@@ -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;
Signature · 1 line
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

#2 lore raw
Quoted 22 lines · Jonas Holmberg
Quoted 20 lines · Jonas Holmberg

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

---
 src/pcm/pcm_ioplug.c | 1 +
 1 file changed, 1 insertion(+)
src/pcm/pcm_ioplug.c +1 -0
index a437ca32..9b1b8ac3 100644
@@ -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;
Quoted 8 lines
Quoted 3 lines
Signature · 1 line
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