mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-17 01:10:10 +00:00
Avoid possible race in videoplayer
This commit is contained in:
parent
6ead5f9321
commit
8af8f331cb
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 New Issue
Block a user