From mboxrd@z Thu Jan 1 00:00:00 1970 From: Takashi Iwai Subject: Re: snd_pcm_drain() always fails Date: Mon, 01 Aug 2005 20:28:09 +0200 Message-ID: References: <20050801172719.GB10144@brailcom.cz> <20050801181015.GE10144@brailcom.cz> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Return-path: Received: from mx1.suse.de (mail.suse.de [195.135.220.2]) by alsa.jcu.cz (ALSA's E-mail Delivery System) with ESMTP id 16B43196 for ; Mon, 1 Aug 2005 20:28:20 +0200 (MEST) In-Reply-To: <20050801181015.GE10144@brailcom.cz> Sender: alsa-devel-admin@lists.sourceforge.net Errors-To: alsa-devel-admin@lists.sourceforge.net List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , List-Archive: To: Hynek Hanke Cc: alsa-devel@alsa-project.org List-Id: alsa-devel@alsa-project.org At Mon, 1 Aug 2005 20:10:15 +0200, Hynek Hanke wrote: > > > Nothing. If drain() is supposed to wait until all data are played and > > you're using the non-blocking mode, then it's definitely an error (thus > > -EAGAIN is returned - and it means from the driver perspective - I must > > wait and the application does not want this from me). > > The documentation is very unclear about this. My guess was that it should bring > me to the state DRAINING which should remain until all frames are played. Patches are always welcome :) > > Set the blocking mode before drain() is called (and return the mode back > > after it, if you want). > > This is not possible. I'm using the non-blocking mode and poll() specifically > because I need to receive external events (not comming from ALSA) too. > > > The better way might be setting sw_params to wakeup app after all frames are > > played and use the standard poll() call to wait in app. > > How can I do this or where can I read about it? I still need to receive those > external events on other file descriptors. Is it possible with this approach? Set avail_min swparams to the buffer size so that poll() won't return unless the full buffer size becomes free (i.e. all samples are played). If stop_threshold is set to buffer size, the pcm stream will be stopped automatically and set to XRUN state. Takashi ------------------------------------------------------- SF.Net email is sponsored by: Discover Easy Linux Migration Strategies from IBM. Find simple to follow Roadmaps, straightforward articles, informative Webcasts and more! Get everything you need to get up to speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click