Update of /cvsroot/alsa/alsa-kernel/core/oss
In directory sc8-pr-cvs1:/tmp/cvs-serv4481

Modified Files:
        pcm_plugin.c plugin_ops.h rate.c route.c 
Log Message:
- fixed the wrong array size of s16_put table.
- fixed the bad buffer/channel allocation.
- optimized the rate plugin.
- check the validity of format in getput_index().



Index: pcm_plugin.c
===================================================================
RCS file: /cvsroot/alsa/alsa-kernel/core/oss/pcm_plugin.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- pcm_plugin.c        21 Jul 2003 14:12:04 -0000      1.13
+++ pcm_plugin.c        24 Jul 2003 12:59:34 -0000      1.14
@@ -91,12 +91,14 @@
                plugin->buf = vmalloc(size);
                plugin->buf_frames = frames;
        }
-       if (!plugin->buf)
+       if (!plugin->buf) {
+               plugin->buf_frames = 0;
                return -ENOMEM;
+       }
        c = plugin->buf_channels;
        if (plugin->access == SNDRV_PCM_ACCESS_RW_INTERLEAVED) {
                for (channel = 0; channel < format->channels; channel++, c++) {
-                       c->frames = frames / format->channels;
+                       c->frames = frames;
                        c->enabled = 1;
                        c->wanted = 0;
                        c->area.addr = plugin->buf;

Index: plugin_ops.h
===================================================================
RCS file: /cvsroot/alsa/alsa-kernel/core/oss/plugin_ops.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- plugin_ops.h        30 Dec 2001 09:26:45 -0000      1.2
+++ plugin_ops.h        24 Jul 2003 12:59:34 -0000      1.3
@@ -323,7 +323,7 @@
 
 #ifdef PUT_S16_LABELS
 /* dst_wid dst_endswap unsigned */
-static void *put_s16_labels[4 * 2 * 2 * 4 * 2] = {
+static void *put_s16_labels[4 * 2 * 2] = {
        &&put_s16_xx12_xxx1,     /* 16h ->  8h */
        &&put_s16_xx12_xxx9,     /* 16h ^>  8h */
        &&put_s16_xx12_xxx1,     /* 16h ->  8s */

Index: rate.c
===================================================================
RCS file: /cvsroot/alsa/alsa-kernel/core/oss/rate.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- rate.c      21 Jul 2003 14:12:05 -0000      1.8
+++ rate.c      24 Jul 2003 12:59:34 -0000      1.9
@@ -85,11 +85,7 @@
 #undef PUT_S16_LABELS
        void *get = get_s16_labels[data->get];
        void *put = put_s16_labels[data->put];
-       void *get_s16_end = 0;
        signed short sample = 0;
-#define GET_S16_END *get_s16_end
-#include "plugin_ops.h"
-#undef GET_S16_END
        
        for (channel = 0; channel < plugin->src_format.channels; channel++) {
                pos = data->pos;
@@ -108,24 +104,16 @@
                dst_step = dst_channels[channel].area.step / 8;
                src_frames1 = src_frames;
                dst_frames1 = dst_frames;
-               if (pos & ~R_MASK) {
-                       get_s16_end = &&after_get1;
-                       goto *get;
-               after_get1:
-                       pos &= R_MASK;
-                       S1 = S2;
-                       S2 = sample;
-                       src += src_step;
-                       src_frames1--;
-               }
                while (dst_frames1-- > 0) {
                        if (pos & ~R_MASK) {
                                pos &= R_MASK;
                                S1 = S2;
                                if (src_frames1-- > 0) {
-                                       get_s16_end = &&after_get2;
                                        goto *get;
-                               after_get2:
+#define GET_S16_END after_get
+#include "plugin_ops.h"
+#undef GET_S16_END
+                               after_get:
                                        S2 = sample;
                                        src += src_step;
                                }

Index: route.c
===================================================================
RCS file: /cvsroot/alsa/alsa-kernel/core/oss/route.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- route.c     12 Aug 2002 08:43:45 -0000      1.6
+++ route.c     24 Jul 2003 12:59:34 -0000      1.7
@@ -518,6 +518,10 @@
        int sign, width, endian;
        sign = !snd_pcm_format_signed(format);
        width = snd_pcm_format_width(format) / 8 - 1;
+       if (width < 0 || width > 3) {
+               snd_printk(KERN_ERR "snd-pcm-oss: invalid format %d\n", format);
+               width = 0;
+       }
 #ifdef SNDRV_LITTLE_ENDIAN
        endian = snd_pcm_format_big_endian(format);
 #else



-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
_______________________________________________
Alsa-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-cvslog

Reply via email to