diff --git a/xbmc/cores/VideoPlayer/Process/VideoBuffer.cpp b/xbmc/cores/VideoPlayer/Process/VideoBuffer.cpp index beaa4a31d5127..0f8198e86ac4a 100644 --- a/xbmc/cores/VideoPlayer/Process/VideoBuffer.cpp +++ b/xbmc/cores/VideoPlayer/Process/VideoBuffer.cpp @@ -347,18 +347,21 @@ bool CVideoBufferPoolSysMem::IsCompatible(AVPixelFormat format, int width, int h CVideoBufferManager::CVideoBufferManager() { + CSingleLock lock(m_critSection); std::shared_ptr pool = std::make_shared(); RegisterPool(pool); } void CVideoBufferManager::RegisterPool(std::shared_ptr pool) { + CSingleLock lock(m_critSection); // preferred pools are to the front m_pools.push_front(pool); } void CVideoBufferManager::ReleasePools() { + CSingleLock lock(m_critSection); std::list> pools = m_pools; m_pools.clear(); std::shared_ptr pool = std::make_shared(); @@ -372,6 +375,7 @@ void CVideoBufferManager::ReleasePools() CVideoBuffer* CVideoBufferManager::Get(AVPixelFormat format, int width, int height) { + CSingleLock lock(m_critSection); for (auto pool: m_pools) { if (!pool->IsConfigured()) diff --git a/xbmc/cores/VideoPlayer/Process/VideoBuffer.h b/xbmc/cores/VideoPlayer/Process/VideoBuffer.h index ba12ab397f71a..e21d4d8c38469 100644 --- a/xbmc/cores/VideoPlayer/Process/VideoBuffer.h +++ b/xbmc/cores/VideoPlayer/Process/VideoBuffer.h @@ -163,5 +163,6 @@ class CVideoBufferManager CVideoBuffer* Get(AVPixelFormat format, int width, int height); protected: + CCriticalSection m_critSection; std::list> m_pools; };