[LAD] [LAU] cancelling I/O with libsndfile

Erik de Castro Lopo mle+la at mega-nerd.com
Tue Jun 14 10:54:10 UTC 2011

Dan Muresan wrote:

> >  b) Work around it.
> This is what I was trying to do via pthread_cancel + sf_open_fd. It
> seems to work with FLAC.
> However, there could be memory leaks if any decoder / encoder function
> (in sndfile or one of the external libs) allocates temporary memory
> that it expects to free before returning. Do you know if this might be
> the case (e.g. for the native formats, libFLAC, libvorbis)?

No idea. I would be surpised if this works.

> I may need to fall back on the vio stuff. How does a sf_vio_read or
> sf_vio_write signal I/O errors?

I never foresaw the possiblity of anybody doing this. I suspect they
should return -1.

> How does a vio_read signal EOF?

Just like the read() system call, by returning zero.

Erik de Castro Lopo

More information about the Linux-audio-dev mailing list