summaryrefslogtreecommitdiffstats
path: root/video/filter/vf_lavfi.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2017-01-25 08:32:35 +0100
committerwm4 <wm4@nowhere>2017-01-25 08:32:35 +0100
commit39adaf3dcc3a0e03df8048d93324940b5f69df51 (patch)
tree0ffc4af54da81164fca16efa9ade9499de262ff3 /video/filter/vf_lavfi.c
parent04376fa02450dba51fd29a9e49423d57083041c9 (diff)
downloadmpv-39adaf3dcc3a0e03df8048d93324940b5f69df51.tar.bz2
mpv-39adaf3dcc3a0e03df8048d93324940b5f69df51.tar.xz
vf_lavfi: don't crash with VOs without hardware decoding support
When playing with VOs which do not provide mp_hwdec_ctx, vf->hwdec_devs will remain NULL. This would make it crash on hwdec_devices_get_first(), even if no hardware decoding or filters using hardware decoding were involved. Fixes #4064.
Diffstat (limited to 'video/filter/vf_lavfi.c')
-rw-r--r--video/filter/vf_lavfi.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/video/filter/vf_lavfi.c b/video/filter/vf_lavfi.c
index e28d7fbb6f..d79bfd4011 100644
--- a/video/filter/vf_lavfi.c
+++ b/video/filter/vf_lavfi.c
@@ -174,11 +174,13 @@ static bool recreate_graph(struct vf_instance *vf, struct mp_image_params *fmt)
if (graph_parse(graph, p->cfg_graph, inputs, outputs, NULL) < 0)
goto error;
- struct mp_hwdec_ctx *hwdec = hwdec_devices_get_first(vf->hwdec_devs);
- for (int n = 0; n < graph->nb_filters; n++) {
- AVFilterContext *filter = graph->filters[n];
- if (hwdec && hwdec->av_device_ref)
- filter->hw_device_ctx = av_buffer_ref(hwdec->av_device_ref);
+ if (vf->hwdec_devs) {
+ struct mp_hwdec_ctx *hwdec = hwdec_devices_get_first(vf->hwdec_devs);
+ for (int n = 0; n < graph->nb_filters; n++) {
+ AVFilterContext *filter = graph->filters[n];
+ if (hwdec && hwdec->av_device_ref)
+ filter->hw_device_ctx = av_buffer_ref(hwdec->av_device_ref);
+ }
}
if (avfilter_graph_config(graph, NULL) < 0)