[FFmpeg-cvslog] lavf/brstm: if the file lies about the last block's size, correct it

Rodger Combs git at videolan.org
Sat Jun 27 15:37:19 CEST 2015


ffmpeg | branch: master | Rodger Combs <rodger.combs at gmail.com> | Tue Jun 23 12:35:35 2015 -0500| [68f00fb40bb3cfc354f6295e8a96b07600aa72a9] | committer: Michael Niedermayer

lavf/brstm: if the file lies about the last block's size, correct it

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=68f00fb40bb3cfc354f6295e8a96b07600aa72a9
---

 libavformat/brstm.c |    9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/libavformat/brstm.c b/libavformat/brstm.c
index f5a4a82..291a462 100644
--- a/libavformat/brstm.c
+++ b/libavformat/brstm.c
@@ -369,6 +369,15 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
         size    = b->last_block_used_bytes;
         samples = b->last_block_samples;
         skip    = b->last_block_size - b->last_block_used_bytes;
+
+        if (samples < size * 14 / 8) {
+            uint32_t adjusted_size = samples / 14 * 8;
+            if (samples % 14)
+                adjusted_size += (samples % 14 + 1) / 2 + 1;
+
+            skip += size - adjusted_size;
+            size = adjusted_size;
+        }
     } else if (b->current_block < b->block_count) {
         size    = b->block_size;
         samples = b->samples_per_block;



More information about the ffmpeg-cvslog mailing list