[MPlayer-dev-eng] Re: ao_plugin play() problems - fix suggestions
Stephen Davies
steve at daviesfam.org
Mon Dec 10 22:48:55 CET 2001
On Mon, 10 Dec 2001, Stephen Davies wrote:
> (2) ao2 drivers should limit value returned from get_space
>
> - ao2 drivers should be adjusted to always return a get_space value that
> is less than MAX_OUTBURST, and that "suits" the driver.
> For instance, ao_oss would take fragment size into account when
> calculating a value to return.
Well - I tried this out in ao_oss and it seems to do the job pretty
smoothly for me.
Patch as so:
Index: libao2/ao_oss.c
===================================================================
RCS file: /cvsroot/mplayer/main/libao2/ao_oss.c,v
retrieving revision 1.15
diff -u -r1.15 ao_oss.c
--- libao2/ao_oss.c 4 Dec 2001 17:54:08 -0000 1.15
+++ libao2/ao_oss.c 10 Dec 2001 21:57:35 -0000
@@ -241,7 +241,10 @@
#ifdef SNDCTL_DSP_GETOSPACE
if(ioctl(audio_fd, SNDCTL_DSP_GETOSPACE, &zz)!=-1){
// calculate exact buffer space:
- return zz.fragments*zz.fragsize;
+ playsize = zz.fragments*zz.fragsize;
+ if (playsize > MAX_OUTBURST)
+ playsize = (MAX_OUTBURST / zz.fragsize) * zz.fragsize;
+ return playsize;
}
#endif
Shall I commit that?
Anders - you will have trouble, though, if you want to add or subtract
some samples in a plugin, that is, move the data length away from a
multiple of a fragment. I reckon buffering in ao_plugin is the only
proper fix for that to work.
Steve
More information about the MPlayer-dev-eng
mailing list