Assert that size of image data matches size of video

Crash with assertion when the size of the graphics is different from the video currently being rendered, instead of causing weirder bugs and a corrupted video file.
This commit is contained in:
Robert Müller 2024-05-04 12:35:49 +02:00
parent a0465b67dd
commit 3a0e2429d1

View file

@ -614,6 +614,8 @@ void CVideo::UpdateVideoBufferFromGraphics(size_t ThreadIndex)
uint32_t Height;
CImageInfo::EImageFormat Format;
m_pGraphics->GetReadPresentedImageDataFuncUnsafe()(Width, Height, Format, m_vVideoBuffers[ThreadIndex].m_vBuffer);
dbg_assert((int)Width == m_Width && (int)Height == m_Height, "Size mismatch between video and graphics");
dbg_assert(Format == CImageInfo::FORMAT_RGBA, "Unexpected image format");
}
AVFrame *CVideo::AllocPicture(enum AVPixelFormat PixFmt, int Width, int Height)