diff mbox series

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

Message ID 20230216135928.1974403-1-consult.awy@gmail.com (mailing list archive)
State Superseded
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(-)

Comments

Jaroslav Kysela Feb. 16, 2023, 2:26 p.m. UTC | #1
On 16. 02. 23 14:59, Alan Young wrote:
> 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

It makes sense.

Reviewed-by: Jaroslav Kysela <perex@perex.cz>
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) {