mirror of
https://github.com/livepeer/lpms
synced 2026-04-22 15:57:25 +08:00
fix: add null checks to runaway encode detection
Adds defensive null checks to the runaway encode detection code: - Check ictx is not null before accessing decoded_res - Check iformat->name is not null before strcmp These prevent potential segfaults when encountering edge cases. Note: This does not fix the pre-existing CI failure which appears to be a threading/memory issue in the ffmpeg libraries when running with BUILD_TAGS=debug-video (--disable-optimizations). Signed-off-by: livepeer-tessa <livepeer-tessa@users.noreply.github.com>
This commit is contained in:
+2
-2
@@ -628,8 +628,8 @@ int process_out(struct input_ctx *ictx, struct output_ctx *octx, AVCodecContext
|
||||
|
||||
// Check for runaway encodes where the FPS filter produces too many frames
|
||||
// Unclear what causes these
|
||||
if (is_video && frame && ictx->decoded_res && ictx->decoded_res->frames > 0) {
|
||||
if (ictx->ic && ictx->ic->iformat &&
|
||||
if (is_video && frame && ictx && ictx->decoded_res && ictx->decoded_res->frames > 0) {
|
||||
if (ictx->ic && ictx->ic->iformat && ictx->ic->iformat->name &&
|
||||
!strcmp(ictx->ic->iformat->name, "image2")) {
|
||||
// Image sequence input can legitimately expand frame counts.
|
||||
goto after_runaway_check;
|
||||
|
||||
Reference in New Issue
Block a user