ws_snd1: Fix wrong samples count and crash.
authorMichael Niedermayer <michaelni@gmx.at>
Sat, 24 Dec 2011 23:10:27 +0000 (00:10 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Thu, 12 Jan 2012 20:52:10 +0000 (21:52 +0100)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 5257743aee0c3982f0079e6553aabc6aa39401d2)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/ws-snd1.c

index f92c353..c28d1a8 100644 (file)
@@ -100,8 +100,8 @@ static int ws_snd_decode_frame(AVCodecContext *avctx,
 
         /* make sure we don't write more than out_size samples */
         switch (code) {
-        case 0:  smp = 4;                              break;
-        case 1:  smp = 2;                              break;
+        case 0:  smp = 4*(count+1);                    break;
+        case 1:  smp = 2*(count+1);                    break;
         case 2:  smp = (count & 0x20) ? 1 : count + 1; break;
         default: smp = count + 1;                      break;
         }