On Sun, Nov 17, 2019 at 06:37:58PM -0300, gga wrote: > 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;
In principle i dont see why this change would be bad (if it fixes some
use case)
but a few things needs to be corrected
the author of the commit has to be corrected
the indention is inconsistent
the ret variable is unneeded
also this mixes declarations and statements, it should be moved down
and i would move this so ff_check_interrupt() is only called if the loop
iterates and not on the first iteration
thx
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
it is not once nor twice but times without number that the same ideas make
their appearance in the world. -- Aristotle
signature.asc
Description: PGP signature
_______________________________________________ ffmpeg-devel mailing list [email protected] https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email [email protected] with subject "unsubscribe".
