? config.status.lineno
? gst/audioconvert/.audioconvert.c.swp
? gst/audioconvert/.test.c.swp
? gst/audioconvert/test.c
? gst/audioconvert/tset
Index: gst/audioconvert/audioconvert.c
===================================================================
RCS file: /cvs/gstreamer/gst-plugins-base/gst/audioconvert/audioconvert.c,v
retrieving revision 1.16
diff -u -p -r1.16 audioconvert.c
--- gst/audioconvert/audioconvert.c	28 Feb 2007 12:08:27 -0000	1.16
+++ gst/audioconvert/audioconvert.c	19 Mar 2007 20:25:41 -0000
@@ -128,10 +128,25 @@ MAKE_PACK_FUNC_NAME (name) (gint32 *src,
 {                                                                       \
   guint8 *p = (guint8 *)dst;                                            \
   guint32 tmp;                                                          \
-  for (;count; count--) {                                               \
-    tmp = (*src++ ^ (sign)) >> scale;                                   \
-    WRITE_FUNC (p, tmp);                                                \
-    p+=stride;                                                          \
+  if (scale > 0) {                                                      \
+    guint32 bias = 1 << (scale - 1);                                    \
+    gint32 cur;                                                         \
+    for (;count; count--) {                                             \
+      cur = *src++;                                                     \
+      if (cur > 0 && G_MAXINT32 - cur < bias)                           \
+        cur = G_MAXINT32;                                               \
+      else                                                              \
+        cur += bias;                                                    \
+      tmp = (((guint32)cur) ^ (sign)) >> scale;                         \
+      WRITE_FUNC (p, tmp);                                              \
+      p+=stride;                                                        \
+    }                                                                   \
+  } else {                                                              \
+    for (;count; count--) {                                             \
+      tmp = (*src++ ^ (sign));                                          \
+      WRITE_FUNC (p, tmp);                                              \
+      p+=stride;                                                        \
+    }                                                                   \
   }                                                                     \
 }
 
