[alsa-devel] [PATCH 1/2] ALSA: core: add hooks for audio timestamps
Clemens Ladisch
clemens at ladisch.de
Fri Sep 28 11:33:50 CEST 2012
Pierre-Louis Bossart wrote:
> @@ -506,8 +512,27 @@ static int snd_pcm_update_hw_ptr0(struct snd_pcm_substream *substream,
> + if (!(runtime->hw.info & SNDRV_PCM_INFO_HAS_WALL_CLOCK)) {
> + /*
> + * no wall clock available, provide audio timestamp
> + * derived from pointer position+delay
> + */
> + u64 audio_frames, audio_nsecs;
> +
> + if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
> + audio_frames = runtime->status->hw_ptr
> + - runtime->delay;
> + else
> + audio_frames = runtime->status->hw_ptr
> + + runtime->delay;
> + audio_nsecs = audio_frames * 1000000000LL /
> + runtime->rate;
This looks like a 64-bit division.
And what happens if audio_frames becomes negative?
Regards,
Clemens
More information about the Alsa-devel
mailing list