mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-25 15:35:23 +00:00
ffmpeg_decoder: signal EOF/errors on readPacket
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; their documentation explicitely states "For stream protocols, must never return 0 but rather a proper AVERROR code." for avio_alloc_context's read_context. Also fix the exception case to return AVERROR_UNKNOWN -- I assume we'd otherwise get stuck there too, but I don't know what would trigger this case. Fixes #6631
This commit is contained in:
parent
42718f69dc
commit
c5cdb0c277
@ -109,6 +109,7 @@
|
||||
Bug #6606: Quests with multiple IDs cannot always be restarted
|
||||
Bug #6653: With default settings the in-game console doesn't fit into screen
|
||||
Bug #6655: Constant effect absorb attribute causes the game to break
|
||||
Bug #6631: Fix ffmpeg avio API usage causing hangs in ffmpeg version 5
|
||||
Bug #6667: Pressing the Esc key while resting or waiting causes black screen.
|
||||
Bug #6670: Dialogue order is incorrect
|
||||
Bug #6680: object.cpp handles nodetree unsafely, memory access with dangling pointer
|
||||
|
@ -18,11 +18,14 @@ int FFmpeg_Decoder::readPacket(void *user_data, uint8_t *buf, int buf_size)
|
||||
std::istream& stream = *static_cast<FFmpeg_Decoder*>(user_data)->mDataStream;
|
||||
stream.clear();
|
||||
stream.read((char*)buf, buf_size);
|
||||
return stream.gcount();
|
||||
std::streamsize count = stream.gcount();
|
||||
if (count == 0)
|
||||
return AVERROR_EOF;
|
||||
return count;
|
||||
}
|
||||
catch (std::exception& )
|
||||
{
|
||||
return 0;
|
||||
return AVERROR_UNKNOWN;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user