[Libav-user] av_read_frame() hangup (no timeout)

Richard Hussong rhussong at westpond.com
Fri Nov 15 19:37:43 EET 2019

On Thu, Nov 14, 2019 at 5:32 PM gga <ggarra13 at gmail.com> wrote:

> I am implementing rtmp reading into my viewer and have run into the
> unfortunate event that av_read_frame() hangs when reaching the end of
> the video being sent over the protocol.  I was hoping it would return
> AVERROR_EOF or a timeout error, but none of the sort seems to happen.
> Thus, my viewer just hangs at the end of the video.
> I tested with ffplay and the same seems to happen there, where the
> window close button becomes ineffective.
> Is there any way around this?

It sounds like you need to implement your own timeout. You can do that by
setting an interrupt callback in the input format context, and checking in
the callback to see if the timeout interval has passed. Search for
"interrupt_callback" in the documentation for AVFormatContext. It's very
general, and won't give you specific help with timing out, but it isn't
hard to construct a timeout for yourself.

- Richard

> _______________________________________________
> Libav-user mailing list
> Libav-user at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/libav-user
> To unsubscribe, visit link above, or email
> libav-user-request at ffmpeg.org with subject "unsubscribe".
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://ffmpeg.org/pipermail/libav-user/attachments/20191115/5e9ec76f/attachment.html>

More information about the Libav-user mailing list