mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-16 16:29:55 +00:00
Don't break the read_packet contract
This commit is contained in:
parent
b9cb028809
commit
2dcf1f7ed2
1 changed files with 8 additions and 2 deletions
10
extern/osg-ffmpeg-videoplayer/videostate.cpp
vendored
10
extern/osg-ffmpeg-videoplayer/videostate.cpp
vendored
|
@ -236,11 +236,17 @@ int VideoState::istream_read(void *user_data, uint8_t *buf, int buf_size)
|
||||||
std::istream& stream = *static_cast<VideoState*>(user_data)->stream;
|
std::istream& stream = *static_cast<VideoState*>(user_data)->stream;
|
||||||
stream.clear();
|
stream.clear();
|
||||||
stream.read((char*)buf, buf_size);
|
stream.read((char*)buf, buf_size);
|
||||||
return stream.gcount();
|
if (stream.bad())
|
||||||
|
return AVERROR_UNKNOWN;
|
||||||
|
auto count = stream.gcount();
|
||||||
|
// avio_alloc_context says we mustn't return 0 for stream protocols
|
||||||
|
if (!count)
|
||||||
|
return AVERROR_EOF;
|
||||||
|
return count;
|
||||||
}
|
}
|
||||||
catch (std::exception& )
|
catch (std::exception& )
|
||||||
{
|
{
|
||||||
return 0;
|
return AVERROR_UNKNOWN;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue