From: Takashi Iwai Subject: Re: How does ALSA detect underrun in OSS emulation? Date: Mon, 25 Feb 2008 16:45:50 +0100 Message-ID: References: <47C2DD41.9070408@freescale.com> <47C2E0FE.2020207@freescale.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 mx1.suse.de (ns.suse.de [195.135.220.2]) by alsa0.perex.cz (Postfix) with ESMTP id AFFA7243AF for ; Mon, 25 Feb 2008 16:45:50 +0100 (CET) In-Reply-To: <47C2E0FE.2020207@freescale.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: alsa-devel-bounces@alsa-project.org Errors-To: alsa-devel-bounces@alsa-project.org To: Timur Tabi Cc: alsa-devel@alsa-project.org List-Id: alsa-devel@alsa-project.org At Mon, 25 Feb 2008 09:38:38 -0600, Timur Tabi wrote: > > Takashi Iwai wrote: > > > It's just as same as on ALSA native API, checks the validity of the > > current position reported by pointer callback in > > snd_pcm_period_elapsed(). > > Are you talking about this code in snd_pcm_update_hw_ptr_pos? > > pos = substream->ops->pointer(substream); > if (pos == SNDRV_PCM_POS_XRUN) > return pos; /* XRUN */ This is one part that ALSA detects XRUN. > > What if my 'pointer' function never returns SNDRV_PCM_POS_XRUN? How else can I > get an underrun detected? Another part is in snd_pcm_update_hw_ptr_post(). It checks whether the updated empty space (snd_pcm_playback_avail()) is bigger than stop_threshold (usually equal with the buffer size). Takashi