From d9da7151eef7fc469787e7298196cea291acfd82 Mon Sep 17 00:00:00 2001 From: Diego Biurrun Date: Wed, 24 May 2017 17:59:59 +0200 Subject: [PATCH 1/4] configure: Fix handling of _select dependencies The handling of _select dependencies had two issues: 1) extralibs from _select dependencies of a component were not added to the list of extralibs for that component. 2) extralibs from dependencies were only added to the extralibs of a component if the component was enabled. This led to incorrect results if that component was enabled by another component later in the dependency resolution process. Instead, always generate the full list of component extralibs for use later in the dependency resolution process. Also remove a leftover unused variable. --- configure | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/configure b/configure index 4450ce418d..fd879bc9d1 100755 --- a/configure +++ b/configure @@ -617,7 +617,6 @@ check_deps(){ enabled ${cfg}_checking && die "Circular dependency for $cfg." disabled ${cfg}_checking && continue enable ${cfg}_checking - append allopts $cfg eval dep_all="\$${cfg}_deps" eval dep_any="\$${cfg}_deps_any" @@ -638,15 +637,13 @@ check_deps(){ disabled_all $dep_con || disable $cfg disabled_any $dep_sel && disable $cfg - if enabled $cfg; then - enable_deep $dep_sel - enable_deep_weak $dep_sgs - for dep in $dep_all $dep_any $dep_sgs; do - # filter out library deps, these do not belong in extralibs - is_in $dep $LIBRARY_LIST && continue - enabled $dep && eval append ${cfg}_extralibs ${dep}_extralibs - done - fi + enabled $cfg && enable_deep_weak $dep_sel $dep_sgs + + for dep in $dep_all $dep_any $dep_sel $dep_sgs; do + # filter out library deps, these do not belong in extralibs + is_in $dep $LIBRARY_LIST && continue + enabled $dep && eval append ${cfg}_extralibs ${dep}_extralibs + done disable ${cfg}_checking done From 5635c80bf59d90e63ede473e2c014647850a8446 Mon Sep 17 00:00:00 2001 From: Mark Thompson Date: Fri, 16 Jun 2017 23:08:47 +0100 Subject: [PATCH 2/4] vf_hwmap: Add missing error code --- libavfilter/vf_hwmap.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavfilter/vf_hwmap.c b/libavfilter/vf_hwmap.c index 2983528ea0..48ebbb6bd6 100644 --- a/libavfilter/vf_hwmap.c +++ b/libavfilter/vf_hwmap.c @@ -73,6 +73,7 @@ static int hwmap_config_output(AVFilterLink *outlink) type = av_hwdevice_find_type_by_name(ctx->derive_device_type); if (type == AV_HWDEVICE_TYPE_NONE) { av_log(avctx, AV_LOG_ERROR, "Invalid device type.\n"); + err = AVERROR(EINVAL); goto fail; } From a670eea56087d0ecd4fbeccf3a9beb9110b7031f Mon Sep 17 00:00:00 2001 From: Mark Thompson Date: Fri, 16 Jun 2017 23:11:51 +0100 Subject: [PATCH 3/4] vf_hwmap: Properly free a locally derived device --- libavfilter/vf_hwmap.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/libavfilter/vf_hwmap.c b/libavfilter/vf_hwmap.c index 48ebbb6bd6..b28cb21456 100644 --- a/libavfilter/vf_hwmap.c +++ b/libavfilter/vf_hwmap.c @@ -54,7 +54,7 @@ static int hwmap_config_output(AVFilterLink *outlink) AVHWFramesContext *hwfc; AVBufferRef *device; const AVPixFmtDescriptor *desc; - int err; + int err, device_is_derived; av_log(avctx, AV_LOG_DEBUG, "Configure hwmap %s -> %s.\n", av_get_pix_fmt_name(inlink->format), @@ -63,6 +63,7 @@ static int hwmap_config_output(AVFilterLink *outlink) av_buffer_unref(&ctx->hwframes_ref); device = avctx->hw_device_ctx; + device_is_derived = 0; if (inlink->hw_frames_ctx) { hwfc = (AVHWFramesContext*)inlink->hw_frames_ctx->data; @@ -84,6 +85,7 @@ static int hwmap_config_output(AVFilterLink *outlink) "device context: %d.\n", err); goto fail; } + device_is_derived = 1; } desc = av_pix_fmt_desc_get(outlink->format); @@ -238,9 +240,13 @@ static int hwmap_config_output(AVFilterLink *outlink) outlink->w = inlink->w; outlink->h = inlink->h; + if (device_is_derived) + av_buffer_unref(&device); return 0; fail: + if (device_is_derived) + av_buffer_unref(&device); av_buffer_unref(&ctx->hwframes_ref); return err; } From c2b0bea40f1fd4399ff6184a2df4f397c0f4b3ab Mon Sep 17 00:00:00 2001 From: Mark Thompson Date: Fri, 16 Jun 2017 23:18:55 +0100 Subject: [PATCH 4/4] avconv_hw: Free device on initialisation failure --- avtools/avconv_hw.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/avtools/avconv_hw.c b/avtools/avconv_hw.c index 94be723304..36ef866927 100644 --- a/avtools/avconv_hw.c +++ b/avtools/avconv_hw.c @@ -75,7 +75,7 @@ int hw_device_init_from_string(const char *arg, HWDevice **dev_out) char *type_name = NULL, *name = NULL, *device = NULL; enum AVHWDeviceType type; HWDevice *dev, *src; - AVBufferRef *device_ref; + AVBufferRef *device_ref = NULL; int err; const char *errmsg, *p, *q; size_t k; @@ -208,6 +208,7 @@ invalid: fail: av_log(NULL, AV_LOG_ERROR, "Device creation failed: %d.\n", err); + av_buffer_unref(&device_ref); goto done; }