On 19.10.2016 05:29, Michael Niedermayer wrote:
> hmm, i guess the patch is then ok
> alternatively you could use i think:
> @@ -803,7 +803,7 @@ int ff_read_packet(AVFormatContext *s, AVPacket *pkt)
>                  return ret;
>              for (i = 0; i < s->nb_streams; i++) {
>                  st = s->streams[i];
> -                if (st->probe_packets)
> +                if (st->probe_packets || st->request_probe > 0)
>                      if ((err = probe_codec(s, st, NULL)) < 0)
>                          return err;
>                  av_assert0(st->request_probe <= 0);

Yes, this works fine and should guarantee that the assert can't be triggered.
Patch doing it that way is attached.

Best regards,
Andreas

>From 7912c6f200a37130844221a73941a7971afa6455 Mon Sep 17 00:00:00 2001
From: Andreas Cadhalpun <andreas.cadhal...@googlemail.com>
Date: Wed, 19 Oct 2016 19:23:49 +0200
Subject: [PATCH] avformat: prevent triggering request_probe assert in
 ff_read_packet

If probe_codec is called with pkt == NULL, it sets probe_packets to 0
and request_probe to -1.
However, request_probe can change when calling s->iformat->read_packet
and thus a probe_packets value of 0 doesn't guarantee a request_probe
value of -1.
In that case calling probe_codec again is necessary to prevent
triggering the assert.

Signed-off-by: Andreas Cadhalpun <andreas.cadhal...@googlemail.com>
---
 libavformat/utils.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/utils.c b/libavformat/utils.c
index 8a51aea..70dbfa1 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -803,7 +803,7 @@ int ff_read_packet(AVFormatContext *s, AVPacket *pkt)
                 return ret;
             for (i = 0; i < s->nb_streams; i++) {
                 st = s->streams[i];
-                if (st->probe_packets)
+                if (st->probe_packets || st->request_probe > 0)
                     if ((err = probe_codec(s, st, NULL)) < 0)
                         return err;
                 av_assert0(st->request_probe <= 0);
-- 
2.9.3

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

Reply via email to