From: Takashi Iwai Subject: Re: [PATCH v2] ALSA: hda - Apply codec delay to wallclock. Date: Wed, 10 Apr 2013 17:16:01 +0200 Message-ID: References: <1365470430-22292-1-git-send-email-dgreid@chromium.org> <5164E2CF.2050207@linux.intel.com> <5165774C.2000507@linux.intel.com> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mx2.suse.de (cantor2.suse.de [195.135.220.15]) by alsa0.perex.cz (Postfix) with ESMTP id 2A4E9265FA3 for ; Wed, 10 Apr 2013 17:16:02 +0200 (CEST) In-Reply-To: <5165774C.2000507@linux.intel.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org To: Pierre-Louis Bossart Cc: Dylan Reid , alsa-devel@alsa-project.org List-Id: alsa-devel@alsa-project.org At Wed, 10 Apr 2013 07:29:32 -0700, Pierre-Louis Bossart wrote: > > > >> > >>> + return (nsec > codec_nsecs) ? nsec - codec_nsecs : 0; > >> > >> > >> Is this correct? I would think for capture you need to add the delay, and > >> subtract it for playback? > > > > Should the capture timestamp represents the wall time when the sample > > is converted by the A-to-D? If so, would be the correct time be the > > codec delay nsec before what is reported here? > > For playback audio_timestamp = wallclk - codec_delay_in_nsec > for capture audio_timestamp = wallclk + codec_delay_in_nsec Hmm... I'm confused, too. From a pretty generic view, - hwptr = the samples (frames) transferred on the (memory) buffer - hwptr + PCM delay = the point being currently captured Which position does the wall clock correspond? Takashi