mirror of
https://github.com/OpenMW/openmw.git
synced 2025-03-01 16:09:55 +00:00
Merge branch 'videostate_lock' into 'master'
Avoid possible race in videoplayer See merge request OpenMW/openmw!3791
This commit is contained in:
commit
c45c2355ae
1 changed files with 11 additions and 2 deletions
13
extern/osg-ffmpeg-videoplayer/videostate.cpp
vendored
13
extern/osg-ffmpeg-videoplayer/videostate.cpp
vendored
|
@ -598,8 +598,17 @@ public:
|
|||
|
||||
if(av_read_frame(pFormatCtx, packet.get()) < 0)
|
||||
{
|
||||
if (self->audioq.nb_packets == 0 && self->videoq.nb_packets == 0 && self->pictq_size == 0)
|
||||
self->mVideoEnded = true;
|
||||
if (self->audioq.nb_packets == 0 && self->videoq.nb_packets == 0)
|
||||
{
|
||||
self->pictq_mutex.lock();
|
||||
bool videoEnded = self->pictq_size == 0;
|
||||
self->pictq_mutex.unlock();
|
||||
if (videoEnded)
|
||||
self->mVideoEnded = true;
|
||||
else
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(10));
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
else
|
||||
|
|
Loading…
Reference in a new issue