Skip to content

Commit

Permalink
Merge branch 'thismoviesucks' into 'master'
Browse files Browse the repository at this point in the history
Don't break the read_packet contract

Closes #8153

See merge request OpenMW/openmw!4378
  • Loading branch information
AnyOldName3 committed Sep 20, 2024
2 parents 879c23b + 2dcf1f7 commit 224b9f0
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions extern/osg-ffmpeg-videoplayer/videostate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
stream.clear();
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& )
{
return 0;
return AVERROR_UNKNOWN;
}
}

Expand Down

0 comments on commit 224b9f0

Please sign in to comment.