From 68415fa08f4bfa6a562aa4c0596f3f1bd797cbb2 Mon Sep 17 00:00:00 2001 From: Richard Stanway Date: Sat, 23 Jul 2022 00:33:50 +0200 Subject: [PATCH] obs-ffmpeg: Throw on invalid amf_format --- plugins/obs-ffmpeg/texture-amf.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/plugins/obs-ffmpeg/texture-amf.cpp b/plugins/obs-ffmpeg/texture-amf.cpp index db21494c6..e81f42fcd 100644 --- a/plugins/obs-ffmpeg/texture-amf.cpp +++ b/plugins/obs-ffmpeg/texture-amf.cpp @@ -633,6 +633,8 @@ static buf_t alloc_buf(amf_fallback *enc) size = enc->linesize * enc->cy * 4; } else if (enc->amf_format == AMF_SURFACE_P010) { size = enc->linesize * enc->cy * 2 * 2; + } else { + throw "Invalid amf_format"; } buf.resize(size); @@ -715,6 +717,11 @@ try { amf_trace->GetResultText(err.res)); *received_packet = false; return false; +} catch (const char *err) { + amf_fallback *enc = (amf_fallback *)data; + error("%s: %s", __FUNCTION__, err); + *received_packet = false; + return false; } static bool amf_extra_data(void *data, uint8_t **header, size_t *size)