diff mbox series

[1/2] ALSA: pcm: generate default audio timestamp

Message ID 20230216135928.1974403-1-consult.awy@gmail.com
State New
Headers show
Series [1/2] ALSA: pcm: generate default audio timestamp | expand

Commit Message

Alan Young Feb. 16, 2023, 1:59 p.m. UTC
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: consult.awy@gmail.com
---
 sound/core/pcm_lib.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c
index 8b6aeb8a78f7..943f5396fc60 100644
--- a/sound/core/pcm_lib.c
+++ b/sound/core/pcm_lib.c
@@ -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) {