Unnecessary check for mmap/trigger in audiolib.c
Martin Samuelsson <[email protected]> Sun, 29 May 2011 02:50:21 +0200
| Newsgroups | gmane.comp.video.mjpeg.devel |
|---|---|
| Message-ID | <20110529025021.652f06da@kvantarell> |
--MP_/oa=CHqiibYXnFuq+5K/OuFo
Content-Type: text/plain; charset=US-ASCII
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
Hi, developers!
Today, I decided to try setting up some tools for a project of mine. It w=
ould involve three lavplays in parallel, and require use of the padsp wra=
pper for the sound, as I don't have OSS on this computer, and only one ha=
rdware channel, anyway.
I was rewarded with a curious message: "Soundcard cant do mmap or trigger=
"
Fair enough, the PA OSS emulation can't do mmap, but that's what lavplay'=
s -U flag is for. Still no cake when using that, though; still the messag=
e about no mmap support (which I already knew, and tried to avoid...).
It turned out that audiolib.c, as far as I can tell, doesn't honor the mm=
ap_io, nor the use_read_write flag, and look for mmap/trigger support eve=
n when it shouldn't. My proposed patch takes care of that, skipping the c=
heck when read/write is requested instead of mmap.
This let me play the audio through padsp, but lavplay will often hang
with the message "Buffer overflow writing audio". I haven't yet tried
to improve that situation, but I have observed the hang occur in either o=
ne of the
audio_errno =3D AUDIO_ERR_BOVFL lines.
Regards,
/Sam
--MP_/oa=CHqiibYXnFuq+5K/OuFo
Content-Type: text/x-patch
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename=skip_mmap_trigger_if_read_write.patch
diff -urN mjpegtools-2.0.0/lavtools/audiolib.c mjpegtools-2.0.0-sam/lavtools/audiolib.c
--- mjpegtools-2.0.0/lavtools/audiolib.c 2006-08-25 06:01:47.000000000 +0200
+++ mjpegtools-2.0.0-sam/lavtools/audiolib.c 2011-05-29 02:21:19.000000000 +0200
@@ -756,11 +756,13 @@
* Check that the device has capability to do mmap and trigger
*/
- ret = ioctl(fd, SNDCTL_DSP_GETCAPS, &caps);
- if(ret<0) system_error("getting audio device capabilities",fd,1);
+ if(mmap_io) {
+ ret = ioctl(fd, SNDCTL_DSP_GETCAPS, &caps);
+ if(ret<0) system_error("getting audio device capabilities",fd,1);
- if (!(caps & DSP_CAP_TRIGGER) || !(caps & DSP_CAP_MMAP))
- system_error("Soundcard cant do mmap or trigger",fd,0);
+ if (!(caps & DSP_CAP_TRIGGER) || !(caps & DSP_CAP_MMAP))
+ system_error("Soundcard cant do mmap or trigger",fd,0);
+ }
/*
* Get the size of the input/output buffer and do the mmap
--MP_/oa=CHqiibYXnFuq+5K/OuFo
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
------------------------------------------------------------------------------
vRanger cuts backup time in half-while increasing security.
With the market-leading solution for virtual backup and recovery,
you get blazing-fast, flexible, and affordable data protection.
Download your free trial now.
http://p.sf.net/sfu/quest-d2dcopy1
--MP_/oa=CHqiibYXnFuq+5K/OuFo
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
Mjpeg-developer mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mjpeg-developer
--MP_/oa=CHqiibYXnFuq+5K/OuFo--