From 8202c49b43621c04e26d4a3aa83a10e1e5cc1836 Mon Sep 17 00:00:00 2001
From: Michael Niedermayer <michaelni@gmx.at>
Date: Sun, 13 Jul 2014 01:07:59 +0200
Subject: [PATCH] avformat/utils: do not wait for packets from discarded
 streams for genpts

Fixes long loop
Fixes Ticket3208

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
---
 libavformat/utils.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavformat/utils.c b/libavformat/utils.c
index be888d85263..140e254f364 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -1634,7 +1634,8 @@ int av_read_frame(AVFormatContext *s, AVPacket *pkt)
             }
 
             /* read packet from packet buffer, if there is data */
-            if (!(next_pkt->pts == AV_NOPTS_VALUE &&
+            st = s->streams[next_pkt->stream_index];
+            if (!(next_pkt->pts == AV_NOPTS_VALUE && st->discard < AVDISCARD_ALL &&
                   next_pkt->dts != AV_NOPTS_VALUE && !eof)) {
                 ret = read_from_packet_buffer(&s->packet_buffer,
                                                &s->packet_buffer_end, pkt);
-- 
GitLab