X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=ffmpeg_filter.c;h=aacc185059e655586a1057fae97eaf4ae5cf4acc;hb=06ed3768c88cce44ba157ec81676acf96e50a61a;hp=817f48f473d0748dfe8f41afff530da9b0e73468;hpb=cb0eba71f047944ccc1220fca04c50f45f88a8ff;p=ffmpeg diff --git a/ffmpeg_filter.c b/ffmpeg_filter.c index 817f48f473d..aacc185059e 100644 --- a/ffmpeg_filter.c +++ b/ffmpeg_filter.c @@ -1046,9 +1046,15 @@ int configure_filtergraph(FilterGraph *fg) if ((ret = avfilter_graph_parse2(fg->graph, graph_desc, &inputs, &outputs)) < 0) goto fail; - if (hw_device_ctx) { + if (filter_hw_device || hw_device_ctx) { + AVBufferRef *device = filter_hw_device ? filter_hw_device->device_ref + : hw_device_ctx; for (i = 0; i < fg->graph->nb_filters; i++) { - fg->graph->filters[i]->hw_device_ctx = av_buffer_ref(hw_device_ctx); + fg->graph->filters[i]->hw_device_ctx = av_buffer_ref(device); + if (!fg->graph->filters[i]->hw_device_ctx) { + ret = AVERROR(ENOMEM); + goto fail; + } } }