alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Clemens Ladisch <clemens@ladisch.de>
To: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Cc: alsa-devel@alsa-project.org
Subject: Re: [PATCH 1/2] ALSA: core: add hooks for audio timestamps
Date: Fri, 28 Sep 2012 11:33:50 +0200	[thread overview]
Message-ID: <50656EFE.40407@ladisch.de> (raw)
In-Reply-To: <1348820142-15822-1-git-send-email-pierre-louis.bossart@linux.intel.com>

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

  parent reply	other threads:[~2012-09-28  9:33 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-28  8:15 [PATCH 1/2] ALSA: core: add hooks for audio timestamps Pierre-Louis Bossart
2012-09-28  8:15 ` [PATCH 2/2] ALSA: hda: support for wallclock timestamps Pierre-Louis Bossart
2012-09-28  9:33   ` Clemens Ladisch
2012-09-29 20:12     ` Pierre-Louis Bossart
2012-09-30 10:12       ` Clemens Ladisch
2012-09-29  1:47   ` Raymond Yau
2012-09-28  9:33 ` Clemens Ladisch [this message]
2012-09-29 20:17   ` [PATCH 1/2] ALSA: core: add hooks for audio timestamps Pierre-Louis Bossart
2012-09-30 10:11     ` Clemens Ladisch

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=50656EFE.40407@ladisch.de \
    --to=clemens@ladisch.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=pierre-louis.bossart@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).