From: kgv Date: Thu, 9 Sep 2021 19:34:48 +0000 (+0300) Subject: 0032092: Visualization, TKService - Image_VideoRecorder writes garbage from Grayscale... X-Git-Tag: V7_6_0_beta~27 X-Git-Url: http://git.dev.opencascade.org/gitweb/?a=commitdiff_plain;h=cd4977383d1879188990b1dad0e78b5a71e3a90e;p=occt.git 0032092: Visualization, TKService - Image_VideoRecorder writes garbage from Grayscale image Image_VideoRecorder::writeVideoFrame(), added protection from API misuse. --- diff --git a/src/Image/Image_VideoRecorder.cxx b/src/Image/Image_VideoRecorder.cxx index 65ed0383cb..e2a3977721 100644 --- a/src/Image/Image_VideoRecorder.cxx +++ b/src/Image/Image_VideoRecorder.cxx @@ -431,6 +431,11 @@ Standard_Boolean Image_VideoRecorder::openVideoCodec (const Image_VideoParams& t Standard_Boolean Image_VideoRecorder::writeVideoFrame (const Standard_Boolean theToFlush) { #ifdef HAVE_FFMPEG + if (myImgSrcRgba.Format() != Image_Format_RGBA) + { + throw Standard_ProgramError ("Image_VideoRecorder, unsupported image format"); + } + int aResAv = 0; AVCodecContext* aCodecCtx = myVideoStream->codec; if (!theToFlush)