[FFmpeg-devel] [PATCH 2/6] lavc/adpcm: THP: handle trailing padding

Rodger Combs rodger.combs at gmail.com
Wed Jun 17 00:28:14 CEST 2015


---
 libavcodec/adpcm.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavcodec/adpcm.c b/libavcodec/adpcm.c
index 22b5468..07ebce8 100644
--- a/libavcodec/adpcm.c
+++ b/libavcodec/adpcm.c
@@ -637,7 +637,7 @@ static int get_nb_samples(AVCodecContext *avctx, GetByteContext *gb,
     }
     case AV_CODEC_ID_ADPCM_THP:
         if (avctx->extradata) {
-            nb_samples = buf_size / (8 * ch) * 14;
+            nb_samples = buf_size * 14 / (8 * ch);
             break;
         }
         has_coded_samples = 1;
@@ -1472,6 +1472,9 @@ static int adpcm_decode_frame(AVCodecContext *avctx, void *data,
                 }
             }
         }
+
+        // Consume trailing padding
+        bytestream2_skip(&gb, bytestream2_get_bytes_left(&gb));
         break;
     }
     case AV_CODEC_ID_ADPCM_DTK:
-- 
2.4.1



More information about the ffmpeg-devel mailing list