From c44c73e3766e640153e2e85778aeff65339baa29 Mon Sep 17 00:00:00 2001 From: itsmattkc Date: Mon, 2 Mar 2020 14:42:20 +1100 Subject: [PATCH] renderer: handle null frame Minor reliability improvement. --- app/render/backend/opengl/openglproxy.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/render/backend/opengl/openglproxy.cpp b/app/render/backend/opengl/openglproxy.cpp index c1e6cf72d..b0244dd91 100644 --- a/app/render/backend/opengl/openglproxy.cpp +++ b/app/render/backend/opengl/openglproxy.cpp @@ -69,7 +69,6 @@ void OpenGLProxy::FrameToValue(DecoderPtr decoder, StreamPtr stream, const TimeR } } - // Since this is a still image, we could likely optimize this if (!footage_tex_ref) { OpenGLColorProcessorPtr color_processor = std::static_pointer_cast(color_cache_.Get(colorspace_match)); @@ -84,6 +83,11 @@ void OpenGLProxy::FrameToValue(DecoderPtr decoder, StreamPtr stream, const TimeR FramePtr frame = decoder->RetrieveVideo(range.in(), video_params_.divider()); + if (!frame) { + // Nothing to be done + return; + } + // OCIO's CPU conversion is more accurate, so for online we render on CPU but offline we render GPU if (ocio_method == ColorManager::kOCIOAccurate) { bool has_alpha = PixelFormat::FormatHasAlphaChannel(frame->format()); @@ -160,6 +164,7 @@ void OpenGLProxy::FrameToValue(DecoderPtr decoder, StreamPtr stream, const TimeR } if (stream->type() == Stream::kImage) { + // Since this is a still image, we could likely optimize this still_image_cache_.Add(stream.get(), {footage_tex_ref, colorspace_match, video_stream->premultiplied_alpha(), video_params_.divider()}); } }