mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-30 08:15:37 +00:00
clear stream errors before attempting the read
This commit is contained in:
parent
4ea6d4aa01
commit
c53a56ed6e
2 changed files with 6 additions and 2 deletions
|
@ -31,8 +31,8 @@ int FFmpeg_Decoder::readPacket(void *user_data, uint8_t *buf, int buf_size)
|
|||
try
|
||||
{
|
||||
std::istream& stream = *static_cast<FFmpeg_Decoder*>(user_data)->mDataStream;
|
||||
stream.read((char*)buf, buf_size);
|
||||
stream.clear();
|
||||
stream.read((char*)buf, buf_size);
|
||||
return stream.gcount();
|
||||
}
|
||||
catch (std::exception& )
|
||||
|
@ -52,6 +52,8 @@ int64_t FFmpeg_Decoder::seek(void *user_data, int64_t offset, int whence)
|
|||
|
||||
whence &= ~AVSEEK_FORCE;
|
||||
|
||||
stream.clear();
|
||||
|
||||
if(whence == AVSEEK_SIZE)
|
||||
{
|
||||
size_t prev = stream.tellg();
|
||||
|
|
4
extern/osg-ffmpeg-videoplayer/videostate.cpp
vendored
4
extern/osg-ffmpeg-videoplayer/videostate.cpp
vendored
|
@ -173,8 +173,8 @@ int VideoState::istream_read(void *user_data, uint8_t *buf, int buf_size)
|
|||
try
|
||||
{
|
||||
std::istream& stream = *static_cast<VideoState*>(user_data)->stream;
|
||||
stream.read((char*)buf, buf_size);
|
||||
stream.clear();
|
||||
stream.read((char*)buf, buf_size);
|
||||
return stream.gcount();
|
||||
}
|
||||
catch (std::exception& )
|
||||
|
@ -194,6 +194,8 @@ int64_t VideoState::istream_seek(void *user_data, int64_t offset, int whence)
|
|||
|
||||
whence &= ~AVSEEK_FORCE;
|
||||
|
||||
stream.clear();
|
||||
|
||||
if(whence == AVSEEK_SIZE)
|
||||
{
|
||||
size_t prev = stream.tellg();
|
||||
|
|
Loading…
Reference in a new issue