The following patch adds a timeout interrupt to av_read_frame to prevent it from hanging up the application.  This patch was proposed some years ago but was not applied back then.  I believe it is useful and should be considered for approval.

diff --git a/libavformat/utils.c b/libavformat/utils.c
index 8196442dd1..d98ebe46a4 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -1792,6 +1792,12 @@ int av_read_frame(AVFormatContext *s, AVPacket *pkt)
     }
 
     for (;;) {
+        if (ff_check_interrupt(&s->interrupt_callback)) {
+           ret = AVERROR_EXIT;
+           av_log(s, AV_LOG_DEBUG, "interrupted\n");
+           return ret;
+        }
+
         AVPacketList *pktl = s->internal->packet_buffer;
 
         if (pktl) {
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to