Avoid wedging VDPAU renderer if mixer creation fails

This commit is contained in:
Cameron Gutman committed 2026-10-24 18:49:46 -05:00
1 parent 8f2e52e540
commit 40f83bd294
1 file changed
+6 -4
@@ -541,11 +541,12 @@ void VDPAURenderer::renderFrame(AVFrame* frame)
// We need to create the mixer on the fly, because we don't know the dimensions // We need to create the mixer on the fly, because we don't know the dimensions
// of our video surfaces in advance of decoding. We also need to recreate it when // of our video surfaces in advance of decoding. We also need to recreate it when
// the frame format or size changes. // the frame format or size changes.
if (hasFrameFormatChanged(frame)) { if (hasFrameFormatChanged(frame) && m_VideoMixer != 0) {
if (m_VideoMixer != 0) { m_VdpVideoMixerDestroy(m_VideoMixer);
m_VdpVideoMixerDestroy(m_VideoMixer); m_VideoMixer = 0;
} }
if (m_VideoMixer == 0) {
VdpChromaType videoSurfaceChroma; VdpChromaType videoSurfaceChroma;
uint32_t videoSurfaceWidth, videoSurfaceHeight; uint32_t videoSurfaceWidth, videoSurfaceHeight;
status = m_VdpVideoSurfaceGetParameters(videoSurface, &videoSurfaceChroma, status = m_VdpVideoSurfaceGetParameters(videoSurface, &videoSurfaceChroma,
@@ -580,6 +581,7 @@ void VDPAURenderer::renderFrame(AVFrame* frame)
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
"VdpVideoMixerCreate() failed: %s", "VdpVideoMixerCreate() failed: %s",
m_VdpGetErrorString(status)); m_VdpGetErrorString(status));
m_VideoMixer = 0;
return; return;
} }
} }