Browse Source

obs-ffmpeg: Throw on invalid amf_format

Richard Stanway 3 years ago
parent
commit
68415fa08f
1 changed files with 7 additions and 0 deletions
  1. 7 0
      plugins/obs-ffmpeg/texture-amf.cpp

+ 7 - 0
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)