Skip to content

Commit e8b0cfd

Browse files
committed
pixel format error check
1 parent daa649c commit e8b0cfd

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/recorder.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,16 @@ geode::Result<> Recorder::init(const RenderSettings& settings) {
6868
m_codecContext->pix_fmt = AV_PIX_FMT_NONE;
6969
m_videoStream->time_base = m_codecContext->time_base;
7070

71+
if(!m_codecContext->pix_fmt)
72+
return geode::Err("Codec does not have any supported pixel formats.");
73+
7174
if (const AVPixelFormat *pix_fmt = m_codec->pix_fmts) {
7275
while (*pix_fmt != AV_PIX_FMT_NONE) {
7376
if(*pix_fmt == static_cast<AVPixelFormat>(settings.m_pixelFormat))
7477
m_codecContext->pix_fmt = *pix_fmt;
7578
++pix_fmt;
7679
}
7780
}
78-
7981
if(m_codecContext->pix_fmt == AV_PIX_FMT_NONE) {
8082
geode::log::info("Codec {} does not support pixel format, defaulting to codec's format", settings.m_codec);
8183
m_codecContext->pix_fmt = m_codec->pix_fmts[0];

0 commit comments

Comments
 (0)