diff --git a/apps/openmw/mwsound/ffmpeg_decoder.cpp b/apps/openmw/mwsound/ffmpeg_decoder.cpp index 55607b5b7..6a586e81d 100644 --- a/apps/openmw/mwsound/ffmpeg_decoder.cpp +++ b/apps/openmw/mwsound/ffmpeg_decoder.cpp @@ -31,8 +31,8 @@ int FFmpeg_Decoder::readPacket(void *user_data, uint8_t *buf, int buf_size) try { std::istream& stream = *static_cast(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(); diff --git a/extern/osg-ffmpeg-videoplayer/videostate.cpp b/extern/osg-ffmpeg-videoplayer/videostate.cpp index 6a054d99e..72fc82f86 100644 --- a/extern/osg-ffmpeg-videoplayer/videostate.cpp +++ b/extern/osg-ffmpeg-videoplayer/videostate.cpp @@ -173,8 +173,8 @@ int VideoState::istream_read(void *user_data, uint8_t *buf, int buf_size) try { std::istream& stream = *static_cast(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();