On 25.05.2015 21:38, Michael Niedermayer wrote:
> On Mon, May 25, 2015 at 05:25:18PM +0200, Andreas Cadhalpun wrote:
> [...]
> 
>>  mov.c |    7 +++++++
>>  1 file changed, 7 insertions(+)
>> 7ff306f094f2ecd47b720deb20ea318c24efaf4d  
>> 0002-mov-reject-zero-bytes_per_frame-with-non-zero-sample.patch
>> From 42c8b0c216b39fd2cb8b329669737ce771ecdd20 Mon Sep 17 00:00:00 2001
>> From: Andreas Cadhalpun <andreas.cadhal...@googlemail.com>
>> Date: Mon, 25 May 2015 17:17:39 +0200
>> Subject: [PATCH 2/2] mov: reject zero bytes_per_frame with non-zero
>>  samples_per_frame
>>
>> In this case the mov demuxer can return a large number of empty packets.
> 
> patch should be ok, maybe add avpriv_request_sample()

OK, attached is variant with av_log replaced with avpriv_request_sample.

Best regards,
Andreas

>From 9897fdaf2a714656dbadba6c9f7a813c39aa568e Mon Sep 17 00:00:00 2001
From: Andreas Cadhalpun <andreas.cadhal...@googlemail.com>
Date: Mon, 25 May 2015 17:17:39 +0200
Subject: [PATCH] mov: reject zero bytes_per_frame with non-zero
 samples_per_frame

In this case the mov demuxer can return a large number of empty packets.

Signed-off-by: Andreas Cadhalpun <andreas.cadhal...@googlemail.com>
---
 libavformat/mov.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index e32f7f4..51cdd21 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -2587,6 +2587,13 @@ static void mov_build_index(MOVContext *mov, AVStream *st)
                 AVIndexEntry *e;
                 unsigned size, samples;
 
+                if (sc->samples_per_frame > 1 && !sc->bytes_per_frame) {
+                    avpriv_request_sample(mov->fc,
+                           "Zero bytes per frame, but %d samples per frame",
+                           sc->samples_per_frame);
+                    return;
+                }
+
                 if (sc->samples_per_frame >= 160) { // gsm
                     samples = sc->samples_per_frame;
                     size = sc->bytes_per_frame;
-- 
2.1.4

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Reply via email to