changeset 9514:446bc9d714b1 libavcodec

Do not discard truncated packets. Based on a patch by Maksym Veremeyenko verem DOT m1stereo AT tv
author michael
date Sun, 19 Apr 2009 20:40:56 +0000
parents 24532a2d9d2c
children 42da9ff61b3c
files pcm.c
diffstat 1 files changed, 3 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/pcm.c	Sun Apr 19 15:06:13 2009 +0000
+++ b/pcm.c	Sun Apr 19 20:40:56 2009 +0000
@@ -361,8 +361,11 @@
     n = avctx->channels * sample_size;
 
     if(n && buf_size % n){
+        if (buf_size < n) {
         av_log(avctx, AV_LOG_ERROR, "invalid PCM packet\n");
         return -1;
+        }else
+            buf_size -= buf_size % n;
     }
 
     buf_size= FFMIN(buf_size, *data_size/2);