[FFmpeg-devel] [PATCH] avformat/utils.c: allows av_read_frame to return after a timeout period.

ggarra13 at gmail.com ggarra13 at gmail.com
Fri Nov 29 01:58:54 EET 2019


From: Gonzalo Garramuño <ggarra13 at gmail.com>

Moved the check inside if (pktl) as per Michael Niedermayer's suggestion.
This patch is based on one from bsenftner at earthlink.net.
---
 libavformat/utils.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/libavformat/utils.c b/libavformat/utils.c
index 8196442dd1..1f5754d7d3 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -1795,6 +1795,11 @@ int av_read_frame(AVFormatContext *s, AVPacket *pkt)
         AVPacketList *pktl = s->internal->packet_buffer;
 
         if (pktl) {
+            if (ff_check_interrupt(&s->interrupt_callback)) {
+                av_log(s, AV_LOG_DEBUG, "interrupted\n");
+                return AVERROR_EXIT;
+            }
+
             AVPacket *next_pkt = &pktl->pkt;
 
             if (next_pkt->dts != AV_NOPTS_VALUE) {
-- 
2.17.0



More information about the ffmpeg-devel mailing list