Skip to content

fix hang with ffmpeg5 (ffmpeg_decoder: signal EOF/errors on readPacket)

Dominique Martinet requested to merge martinetd/openmw:ffmpeg5 into master

Hello, I ran into the issues described in #6631 (closed) as well and was too lazy to build a compat ffmpeg (what, I got lazy wrong?)

This fixes the issue for me on ffmpeg 5, but I didn't test with older version of ffmpeg -- please do check I didn't break older versions.
(EDIT: after checking the old ffmpeg 4.4 code, they just converted 0 to EOF error like I've chosen, so I'm pretty confident it should be OK with older ffmpeg as well)

openmw with ffmpeg 5 would hang in an infinite loop trying to read at end of files in avformat_open_input()
avio_read() apparently now no longer handlers 0 as a return value to signal EOF and we need ot explicitly return AVERROR_EOF.

Also fix the exception case to return -1 (generic error), just in case -- I assume we'd otherwise get stuck there too, but I don't know what would trigger this case.

Fixes #6631 (closed)

Edited by Dominique Martinet

Merge request reports

Loading