On 04/04/2013 02:27 AM, Clemens Ladisch wrote:
Gabriel M. Beddingfield wrote:
In the typical end-of-stream case, you simply write the data that you
have. When the hw pointer catches up to the application pointer, you
get an XRUN and the stream stops immediately.
But that happens only when ALSA actually reads the hardware pointer.
The application could ask for the pointer position for some reason, but
when it is blocked, only the end-of-period interrupt will cause that.
I stand corrected. (Thanks also to Peter Ujfalusi for setting me straight.)
So, if the hardware can detect it then the hardware needs to signal an
interrupt for the XRUN.
Another option... from userspace you can call SYNC_PTR (e.g.
pcm_get_htimestamp() in tinyalsa) to update the hw and application
pointers, then inspect them to detect when all the data is transferred.
When you see all is played, immediately stop the stream. Again, this
presumes that the "hw" side is able to query the state of the pointer.
-gabriel
_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxx
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel