[MPlayer-dev-eng] [PATCH] prevent breaking up of samples between audio plugin calls

Eric Lammerts eric at lammerts.org
Sun Jun 9 23:55:44 CEST 2002


Hi,
When trying out the resample plugin (with 6-channel output), I noticed that
the channels move around everytime I resume from pause (for example, the
center channel hops between left front, center and left rear).

This is because at that moment, the resample plugin gets a
ao_plugin_data.len of 65536. This is not a multiple of 6 * 2, so one sample
gets broken up between plugin calls. The resample plugin is not designed to
handle that.

Patch below makes sure that all audio plugins always get whole samples.

Eric

Index: libao2/ao_plugin.c
===================================================================
RCS file: /cvsroot/mplayer/main/libao2/ao_plugin.c,v
retrieving revision 1.19
diff -u -r1.19 ao_plugin.c
--- libao2/ao_plugin.c	7 Jun 2002 00:30:32 -0000	1.19
+++ libao2/ao_plugin.c	9 Jun 2002 22:00:50 -0000
@@ -250,6 +250,7 @@
   // Limit length to avoid over flow in plugins
   int tmp = get_space();
   int ret_len =(tmp<len)?tmp:len;
+  ret_len -= ret_len % (ao_plugin_local_data.channels * 2);
   if(ret_len){
     // Filter data
     ao_plugin_data.len=ret_len;



More information about the MPlayer-dev-eng mailing list