Skip to contentSkip to conversation

oss-redir/libaoss doesn't set blocked IO correctly [PATCH]

PATCH Applied Matthew Hodgson 2 participants 2 messages Mar 19, 2005

lore
Share & tools
lore
#0 lore raw

Hi,

I'm investigating switching videolan's OSS-style audio-capture (used to complement streaming from a v4l source) to use the alsa-oss oss-redir abstraction layer. Whilst writing the patch, I came up against the quirk that

i_fd = oss_pcm_open(devname, O_RDONLY | O_NONBLOCK)

doesn't return a non-blocking file descriptor. This is a bit of a showstopper, as vlc relies on the fd being nonblocking in order for the thread to yield to allow interleaved video capture to occur.

The problem appears to be a typo in alsa-oss/alsa/pcm.c:oss_dsp_open(), where the mode parameter rather than the oflags parameter is checked for the O_NONBLOCK flag. I've included a trivial patch to fix it.

cheers;

M.

Signature · 3 lines
______________________________________________________________
Matthew Hodgson   [email protected]   Tel: +44 845 6667778
                Systems Analyst, MX Telecom Ltd.

Index: pcm.c
===================================================================
RCS file: /cvsroot/alsa/alsa-oss/alsa/pcm.c,v
retrieving revision 1.19

pcm.c 19 Mar 2005 14:43:04 -0000 renamed from pcm.c 27 Dec 2004 19:25:47 -0000 1.19 +1 -1
diff -u -r1.19 pcm.c
@@ -534,7 +534,7 @@
                errno = ENOENT;
                return -1;
        }
-       if (mode & O_NONBLOCK)
+       if (oflag & O_NONBLOCK)
                pcm_mode = SND_PCM_NONBLOCK;
        switch (oflag & O_ACCMODE) {
        case O_RDONLY:
#1 lore raw
Quoted 9 lines · Matthew Hodgson

Hi,

I'm investigating switching videolan's OSS-style audio-capture (used to complement streaming from a v4l source) to use the alsa-oss oss-redir abstraction layer. Whilst writing the patch, I came up against the quirk that

i_fd = oss_pcm_open(devname, O_RDONLY | O_NONBLOCK)

Quoted 7 lines

doesn't return a non-blocking file descriptor. This is a bit of a showstopper, as vlc relies on the fd being nonblocking in order for the thread to yield to allow interleaved video capture to occur.

The problem appears to be a typo in alsa-oss/alsa/pcm.c:oss_dsp_open(), where the mode parameter rather than the oflags parameter is checked for the O_NONBLOCK flag. I've included a trivial patch to fix it.

Applied. Thanks.

Jaroslav

-----
Jaroslav Kysela <[email protected]>
Linux Kernel Sound Maintainer
ALSA Project, SUSE Labs

-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click