From alsa-devel-owner@alsa.jcu.cz  Thu Aug 27 19:52:25 1998
Received: from entry.jcu.cz (perex@entry.jcu.cz [160.217.1.111])
	by marvin.jcu.cz (8.8.8/8.8.8) with SMTP id TAA13115;
	Thu, 27 Aug 1998 19:52:07 +0200
Date: Thu, 27 Aug 1998 19:52:06 +0200 (MET DST)
From: Jaroslav Kysela <perex@jcu.cz>
To: Ivan Popov <pin@math.chalmers.se>
cc: alsa-devel@alsa.jcu.cz
Subject: Re: 0.2.0-pre5 - strange behaviour?
In-Reply-To: <Pine.GSO.3.95.980827175411.1683C-100000@morisot.math.chalmers.se>
Message-ID: <Pine.LNX.3.96.980827192211.867A-100000@entry.jcu.cz>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
Reply-To: alsa-devel@alsa.jcu.cz
Sender: alsa-devel-owner@alsa.jcu.cz
Precedence: list

On Thu, 27 Aug 1998, Ivan Popov wrote:

> Hello,
> 
> I've got a question and, sorry, did not find the right place in the code
> to answer myself :)
> 
> What must happen if an application opens reading from say mike,
> then sometimes makes long pauses before it proceeds with reading
> from the filedescriptor.
> 
> My experience was (with speak-freely's "sfmike" that waits for a keypress
> to switch between pause/talk modes) as follows:
> 
> the first time you open audio device it is perfect (you read what you say
> to the mike).
> 
> Then you do something else.
> 
> After 15 seconds you make repeatedly non-blocking read() until it returns
> 0 (zero) and through away the results in the hope to clear the buffer.
> 
> Then you read() and still get sound with 2-6 seconds delay, i.e.
> the buffer becomes not cleared by previous read()-s.

OK. I checked appropriate code and seems that record interrupt ack routine
have overrun bug. Recording should be probably stoped when overrun (not
enough space in buffer to receive next data) than continue. In current
code is problem with updating read pointers after overrun.

This will be fixed in next release of driver.

> Is such behaviour OK and what is the right way to flush the input buffer?
> 
> "close(); open()" does the trick but it is not the appropriate method,
> or is it?

What about RESET ioctl when MIC isn't used? Recording will be stoped and
no overruns will be occured.

						Jaroslav

-----
Jaroslav Kysela <perex@jcu.cz>
Academic Computer Centre, University of South Bohemia
Branisovska 31, C. Budejovice, CZ-370 05 Czech Republic




