From 562891c391433133511d4df72abb004ed827cffb Mon Sep 17 00:00:00 2001 From: itsmattkc Date: Mon, 20 Jan 2020 04:07:42 +1100 Subject: [PATCH] renderer: handle ffmpeg returning a zero aspect ratio We try to handle aspect ratios in metadata (e.g. stretching 1440x1080 videos out to 1920x1080 when requested), and FFmpeg will usually return a 1/1 aspect ratio even if it can't determine an aspect ratio. However, as mentioned in the documentation, sometimes it returns a 0/0 aspect ratio when it can't determine an aspect ratio, which we didn't handle and would lead to the code allocating a buffer with a 0px height. This commit handles both 1/1 and 0/0 aspect ratios in accordance with the FFmpeg documentation. Reference: https://www.ffmpeg.org/doxygen/4.0/structAVFrame.html#a62f9c20541a83d37db7072126ff0060d --- app/render/backend/opengl/openglworker.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/render/backend/opengl/openglworker.cpp b/app/render/backend/opengl/openglworker.cpp index 4df2850f1..8e9e85c19 100644 --- a/app/render/backend/opengl/openglworker.cpp +++ b/app/render/backend/opengl/openglworker.cpp @@ -104,7 +104,7 @@ void OpenGLWorker::FrameToValue(StreamPtr stream, FramePtr frame, NodeValueTable } // Check frame aspect ratio - if (frame->sample_aspect_ratio() != 1) { + if (frame->sample_aspect_ratio() != 1 && frame->sample_aspect_ratio() != 0) { int new_width = frame->width(); int new_height = frame->height();