From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Clemens Ladisch" Subject: Re: Broken playback Date: Wed, 21 Nov 2007 17:09:35 +0100 Message-ID: <1195661375.18942.1222573455@webmail.messagingengine.com> References: <1195644962.10939.1222529331@webmail.messagingengine.com> <1195658907.11141.1222567701@webmail.messagingengine.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from out1.smtp.messagingengine.com (out1.smtp.messagingengine.com [66.111.4.25]) by alsa0.perex.cz (Postfix) with ESMTP id A863924C3B for ; Wed, 21 Nov 2007 17:09:35 +0100 (CET) Content-Disposition: inline In-Reply-To: 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: Gabriele Melia Cc: alsa-devel@alsa-project.org List-Id: alsa-devel@alsa-project.org Gabriele Melia wrote: > > Try non-blocking mode (see the snd_pcm_nonblock function). In non- > > blocking mode, the writei call will only write as much data as can be > > written without waiting (or returns -EAGAIN if the buffer is already > > full at the moment). > > I'm already in this case Then the problem is not that the writei call takes too long. An underrun can happen only when your code takes too much time between two consecutive calls to writei. > How to set the buffer size of the circular buffer in which i store the > pcm that is then called by alsa? snd_pcm_hw_params_set_buffer_size_near(), but the allowed values are hardware dependent. You might want to add your own circular buffer that is bigger than ALSA's. HTH Clemens