Skip to contentSkip to conversation

ALSA: pcm: generate default audio timestamp

PATCH In review Alan Young 2 participants 2 messages Feb 16, 2023 Sound

lore
Share & tools
lore

Alan Young

author
#0 lore raw

PATCH 1/2 ALSA: pcm: generate default audio timestamp

If there is no get_time_info() available or the requested audio timestamp type is AUDIO_TSTAMP_TYPE_DEFAULT then need to set audio_tstamp_report.actual_type = AUDIO_TSTAMP_TYPE_DEFAULT (in the else clause near the start of snd_pcm_update_hw_ptr0()) in order for update_audio_tstamp() to generate the audio timestamp from the number of frames.

Fixes 3179f6200188 ("ALSA: core: add .get_time_info")
Signed-off-by [email protected]
---
 sound/core/pcm_lib.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
sound/core/pcm_lib.c +3 -1
index 8b6aeb8a78f7..943f5396fc60 100644
@@ -289,8 +289,10 @@ static int snd_pcm_update_hw_ptr0(struct snd_pcm_substream *substream,
 			/* re-test in case tstamp type is not supported in hardware and was demoted to DEFAULT */
 			if (runtime->audio_tstamp_report.actual_type == SNDRV_PCM_AUDIO_TSTAMP_TYPE_DEFAULT)
 				snd_pcm_gettime(runtime, &curr_tstamp);
-		} else
+		} else {
+			runtime->audio_tstamp_report.actual_type = SNDRV_PCM_AUDIO_TSTAMP_TYPE_DEFAULT;
 			snd_pcm_gettime(runtime, &curr_tstamp);
+		}
 	}
 
 	if (pos == SNDRV_PCM_POS_XRUN) {
Signature · 1 line
2.31.1
maintainer Reviewed-by on v1 1/2
#1 lore raw
Quoted 9 lines · Alan Young

If there is no get_time_info() available or the requested audio timestamp type is AUDIO_TSTAMP_TYPE_DEFAULT then need to set audio_tstamp_report.actual_type = AUDIO_TSTAMP_TYPE_DEFAULT (in the else clause near the start of snd_pcm_update_hw_ptr0()) in order for update_audio_tstamp() to generate the audio timestamp from the number of frames.

Fixes 3179f6200188 ("ALSA: core: add .get_time_info")
Signed-off-by [email protected]

It makes sense.

Signature · 2 lines
Jaroslav Kysela <[email protected]>
Linux Sound Maintainer; ALSA Project; Red Hat, Inc.