* I/O multiplexing using select()
@ 2006-03-15 1:30 Martin Persson
2006-03-15 1:38 ` Lee Revell
0 siblings, 1 reply; 2+ messages in thread
From: Martin Persson @ 2006-03-15 1:30 UTC (permalink / raw)
To: alsa-devel
[-- Attachment #1: Type: text/plain, Size: 1233 bytes --]
Hello, I'm tinkering with a simple application to stream sound over a
network socket. My application currently uses select() to handle the network
I/O, and I'm trying to use the same method for the read/write calls to ALSA.
I've used snd_pcm_get_poll_descritors() to nab two socket objects which I
add to the read/write fd_set's examined by the select call. I also open the
pcm devices in nonblocking mode.
The problem is that select() is awakended when only 92 bytes (46 frames) are
available, resulting only in noise, since those transfers are too small.
I've tried adjusting the period size with the
snd_pcm_sw_params_set_start_treshold(), but I'm not sure if this is the
correct way to do it (doesn't work now, but I need some more tinkering time
before I can rule out 'problem-exists-between-keyboard-and-chair' as a
reason).
Perhaps I should perform fcntl() calls on the acctual socket objects
instead? Basically, I just want to enable larger transfers while maintaining
nonblocking behaviour. Perhaps there is a better way, like, say, only
attempting to write as much data as you know will fit into the buffer?
Any advice or tips would be greatly appreciated.
Martin Persson - xarragon at gmail dot com
[-- Attachment #2: Type: text/html, Size: 1272 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: I/O multiplexing using select()
2006-03-15 1:30 I/O multiplexing using select() Martin Persson
@ 2006-03-15 1:38 ` Lee Revell
0 siblings, 0 replies; 2+ messages in thread
From: Lee Revell @ 2006-03-15 1:38 UTC (permalink / raw)
To: Martin Persson; +Cc: alsa-devel
On Wed, 2006-03-15 at 02:30 +0100, Martin Persson wrote:
> The problem is that select() is awakended when only 92 bytes (46
> frames) are available
Use snd_pcm_dump() to get all the hw and sw parameters immediately
before you call select() and post the output, a pointer to your code
would help also.
Lee
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2006-03-15 1:38 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-03-15 1:30 I/O multiplexing using select() Martin Persson
2006-03-15 1:38 ` Lee Revell
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.