summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Ekström <jeebjp@gmail.com>2022-02-06 00:58:59 +0200
committerJan Ekström <jeebjp@gmail.com>2022-02-06 14:45:50 +0200
commit8c4cb84f9ecebb279fc116f19b8d0b322c4de3b4 (patch)
treefc3c592bce0a4ab631dbdc7be8f8d9699246f867
parent240340d60a625db12fb957deadac89a197c50844 (diff)
downloadmpv-8c4cb84f9ecebb279fc116f19b8d0b322c4de3b4.tar.bz2
mpv-8c4cb84f9ecebb279fc116f19b8d0b322c4de3b4.tar.xz
vf_format: simplify frame type checking after addition of DoVi option
We only wish to touch actual video frames, which should have an allocated image attached to them, so just check the frame type early, and exit by passing through such non-video frames to further filters in the chain without attempting to process them. Fixes a crash in case of non-video (EOF/NONE) frames being passed onto the filter when the dovi option was set to false since 05ccc51d53424a771ece5bb818713d474d7874ce .
-rw-r--r--video/filter/vf_format.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/video/filter/vf_format.c b/video/filter/vf_format.c
index 8aea1d5498..9cb7ca87aa 100644
--- a/video/filter/vf_format.c
+++ b/video/filter/vf_format.c
@@ -145,7 +145,10 @@ static void vf_format_process(struct mp_filter *f)
struct mp_frame frame = mp_pin_out_read(priv->conv->f->pins[1]);
struct mp_image *img = frame.data;
- if (!priv->opts->convert && frame.type == MP_FRAME_VIDEO) {
+ if (frame.type != MP_FRAME_VIDEO)
+ goto write_out;
+
+ if (!priv->opts->convert) {
set_params(priv->opts, &img->params, false);
mp_image_params_guess_csp(&img->params);
}
@@ -153,6 +156,7 @@ static void vf_format_process(struct mp_filter *f)
if (!priv->opts->dovi)
av_buffer_unref(&img->dovi);
+write_out:
mp_pin_in_write(f->ppins[1], frame);
}
}