diff --git a/app/streaming/video/ffmpeg-renderers/sdlvid.cpp b/app/streaming/video/ffmpeg-renderers/sdlvid.cpp index 0ba72ce1..0c681fc3 100644 --- a/app/streaming/video/ffmpeg-renderers/sdlvid.cpp +++ b/app/streaming/video/ffmpeg-renderers/sdlvid.cpp @@ -17,7 +17,6 @@ SdlRenderer::SdlRenderer() m_VideoFormat(0), m_Renderer(nullptr), m_Texture(nullptr), - m_ColorSpace(-1), m_NeedsYuvToRgbConversion(false), m_SwsContext(nullptr), m_RgbFrame(av_frame_alloc()), @@ -286,11 +285,8 @@ ReadbackRetry: } } - // Because the specific YUV color conversion shader is established at - // texture creation for most SDL render backends, we need to recreate - // the texture when the colorspace changes. - int colorspace = getFrameColorspace(frame); - if (colorspace != m_ColorSpace) { + // Recreate the texture if the frame format or size changes + if (hasFrameFormatChanged(frame)) { #ifdef HAVE_CUDA if (m_CudaGLHelper != nullptr) { delete m_CudaGLHelper; @@ -302,17 +298,6 @@ ReadbackRetry: SDL_DestroyTexture(m_Texture); m_Texture = nullptr; } - - m_ColorSpace = colorspace; - } - - // Recreate the texture if the frame changed in size - if (m_Texture != nullptr) { - int width, height; - if (SDL_QueryTexture(m_Texture, nullptr, nullptr, &width, &height) == 0 && (frame->width != width || frame->height != height)) { - SDL_DestroyTexture(m_Texture); - m_Texture = nullptr; - } } if (m_Texture == nullptr) { @@ -400,7 +385,7 @@ ReadbackRetry: } else { // SDL will perform YUV conversion on the GPU - switch (colorspace) + switch (getFrameColorspace(frame)) { case COLORSPACE_REC_709: SDL_assert(!isFrameFullRange(frame)); diff --git a/app/streaming/video/ffmpeg-renderers/sdlvid.h b/app/streaming/video/ffmpeg-renderers/sdlvid.h index 03e40d12..797d050b 100644 --- a/app/streaming/video/ffmpeg-renderers/sdlvid.h +++ b/app/streaming/video/ffmpeg-renderers/sdlvid.h @@ -32,7 +32,6 @@ private: int m_VideoFormat; SDL_Renderer* m_Renderer; SDL_Texture* m_Texture; - int m_ColorSpace; SDL_Texture* m_OverlayTextures[Overlay::OverlayMax]; SDL_Rect m_OverlayRects[Overlay::OverlayMax];