On Thu, Nov 28, 2019 at 08:58:54PM -0300, ggarr...@gmail.com wrote:
> From: Gonzalo Garramuño <ggarr...@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) {

I would put it at the end of the "if (pktl) {" body
because if a packet gets processed and returned no interrupt check is needed

also, do we have a testcase where this loop hangs ?
if not please provide a testcase

Thanks

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Awnsering whenever a program halts or runs forever is
On a turing machine, in general impossible (turings halting problem).
On any real computer, always possible as a real computer has a finite number
of states N, and will either halt in less than N cycles or never halt.

Attachment: signature.asc
Description: PGP signature

_______________________________________________
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