[LAU] cancelling I/O with libsndfile

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: <linux-audio-user@...>
Date: Monday, June 13, 2011 - 11:43 am

Hi,

I'm trying to cancel an ongoing sf_* I/O operation (from another
thread of course). I'm finding this extremely unpleasant to implement.

* libsndfile sf_read_* and sf_write_* loop until the requested number
of frames has been transferred -- so signals are useless, even if I
were to disable SA_RESTART behavior

* a pthread_cancel() in the middle of I/O seems to mess up the
SNDFILE's data structure to the point that it is unusable later on; so
besides having to create a new thread after cancelling, I have to
re-open the SNDFILE (or manage a pool of back-up SNDFILE's, complete
with duplicate fd's)

Also, libsndfile doesn't seem to employ a user-space cache like normal
C streams (FILE *) -- instead it goes directly to read(2) and
write(2). This of course makes it exceedingly inefficient to read 1
frame at a time (due to repetead syscall overhead).

So... it's hard to process low-latency dynamic I/O requests with
libsndfile. It would be nice if libsndfile could allow short reads and
writes via some sf_command parameter.

BTW, I've had trouble sending messages to the sndfile-users mailing
list (I subscribed, then it still rejected my mails). In any case,
since there seems to be no mailing list archive, it doesn't seem like
a very trustworthy mailing list.

-- Dan
_______________________________________________
Linux-audio-user mailing list
Linux-audio-user@lists.linuxaudio.org
http://lists.linuxaudio.org/listinfo/linux-audio-user

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[LAU] cancelling I/O with libsndfile, Dan Muresan, (Mon Jun 13, 11:43 am)
Re: [LAU] cancelling I/O with libsndfile, Dan Muresan, (Mon Jun 13, 9:57 pm)
Re: [LAU] cancelling I/O with libsndfile, Erik de Castro Lopo, (Tue Jun 14, 12:12 am)
Re: [LAU] cancelling I/O with libsndfile, Dan Muresan, (Tue Jun 14, 6:46 am)
Re: [LAU] cancelling I/O with libsndfile, Paul Davis, (Tue Jun 14, 12:17 am)
Re: [LAU] cancelling I/O with libsndfile, Dan Muresan, (Tue Jun 14, 6:29 am)
Re: [LAU] cancelling I/O with libsndfile, Erik de Castro Lopo, (Mon Jun 13, 11:56 am)