[LAD] [LAU] cancelling I/O with libsndfile
Dan Muresan
danmbox at gmail.com
Tue Jun 14 12:03:35 UTC 2011
>> 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.
It seems to works for FLAC, but I can't trust it either. Besides
memory leaks, mutexes might remain locked, and indirectly deadlock
sf_free().
>> 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.
Well, forget my cancelling strategy -- errors could occur even if one
writes a trivial layer (vio_read == read). An I/O API *must* specify
error handling. This is not some exotic use case...
>From TFC, psf_fread ():
if (psf->virtual_io)
return psf->vio.read ...
(i.e. no processing), while the non-virtual branch returns the partial
count if an error ever occurs. So I guess I should return some short
count on error.
Anyway, for cancelling requests EOF works -- indeed as long as one can
"get out of the sf_read jail free" anything works.
-- Dan
More information about the Linux-audio-dev
mailing list