diff --git a/Core/VideoDecoder.cpp b/Core/VideoDecoder.cpp index 4acd47ec..7b48ab1b 100644 --- a/Core/VideoDecoder.cpp +++ b/Core/VideoDecoder.cpp @@ -135,6 +135,8 @@ void VideoDecoder::StartThread() _stopFlag = false; _frameChanged = false; _frameCount = 0; + _waitForFrame.Reset(); + _waitForRender.Reset(); Instance->_decodeThread.reset(new thread(&VideoDecoder::DecodeThread, Instance.get())); Instance->_renderThread.reset(new thread(&VideoDecoder::RenderThread, Instance.get())); } diff --git a/Utilities/AutoResetEvent.cpp b/Utilities/AutoResetEvent.cpp index 94abd7f1..329bcf82 100644 --- a/Utilities/AutoResetEvent.cpp +++ b/Utilities/AutoResetEvent.cpp @@ -25,6 +25,12 @@ void AutoResetEvent::Wait(int timeoutDelay) _signaled = false; } +void AutoResetEvent::Reset() +{ + std::unique_lock lock(_mutex); + _signaled = false; +} + void AutoResetEvent::Signal() { std::unique_lock lock(_mutex); diff --git a/Utilities/AutoResetEvent.h b/Utilities/AutoResetEvent.h index 0b8bf7b9..b272f1db 100644 --- a/Utilities/AutoResetEvent.h +++ b/Utilities/AutoResetEvent.h @@ -15,6 +15,7 @@ public: AutoResetEvent(); ~AutoResetEvent(); + void Reset(); void Wait(int timeoutDelay = 0); void Signal(); };