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

From: Dan Muresan <danmbox@email-addr-hidden>
Date: Tue Jun 14 2011 - 15:03:35 EEST

>> 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
_______________________________________________
Linux-audio-dev mailing list
Linux-audio-dev@email-addr-hidden
http://lists.linuxaudio.org/listinfo/linux-audio-dev
Received on Tue, 14 Jun 2011 15:03:35 +0300

This archive was generated by hypermail 2.1.8 : Tue Jun 14 2011 - 16:15:06 EEST