diff --git a/app/streaming/video/ffmpeg-renderers/vdpau.cpp b/app/streaming/video/ffmpeg-renderers/vdpau.cpp index fb2b291e..f6ac822a 100644 --- a/app/streaming/video/ffmpeg-renderers/vdpau.cpp +++ b/app/streaming/video/ffmpeg-renderers/vdpau.cpp @@ -385,9 +385,6 @@ void VDPAURenderer::notifyOverlayUpdated(Overlay::OverlayType type) return; } - // Surface data is no longer needed - SDL_FreeSurface(newSurface); - VdpRect overlayRect; if (type == Overlay::OverlayStatusUpdate) { @@ -404,6 +401,9 @@ void VDPAURenderer::notifyOverlayUpdated(Overlay::OverlayType type) overlayRect.x1 = overlayRect.x0 + newSurface->w; overlayRect.y1 = overlayRect.y0 + newSurface->h; + // Surface data is no longer needed + SDL_FreeSurface(newSurface); + SDL_LockMutex(m_OverlayMutex); m_OverlaySurface[type] = newBitmapSurface; m_OverlayRect[type] = overlayRect;