summaryrefslogtreecommitdiff
path: root/libavutil/hwcontext.c
diff options
context:
space:
mode:
authorMark Thompson <sw@jkqxz.net>2018-05-14 22:58:56 +0100
committerMark Thompson <sw@jkqxz.net>2018-05-15 22:16:03 +0100
commit136260eb88e80ed4f4712a341805ec1d0d69bbca (patch)
treeef3ad5822765a620b9ab00daeb80a2f0c5c8bfe0 /libavutil/hwcontext.c
parent1b2471039b23f4edd3b37899b3edd1ae40c01315 (diff)
hwcontext: Do not call device_init again when deriving an existing device
The change in 309d660775e2b47af6723a0477c4d753bc0c54f4 to call device_init when doing derivation missed this case - we should only call it if we actually made a new device.
Diffstat (limited to 'libavutil/hwcontext.c')
-rw-r--r--libavutil/hwcontext.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/libavutil/hwcontext.c b/libavutil/hwcontext.c
index 70c556ecac..745016ed7e 100644
--- a/libavutil/hwcontext.c
+++ b/libavutil/hwcontext.c
@@ -646,6 +646,9 @@ int av_hwdevice_ctx_create_derived(AVBufferRef **dst_ref_ptr,
ret = AVERROR(ENOMEM);
goto fail;
}
+ ret = av_hwdevice_ctx_init(dst_ref);
+ if (ret < 0)
+ goto fail;
goto done;
}
if (ret != AVERROR(ENOSYS))
@@ -658,10 +661,6 @@ int av_hwdevice_ctx_create_derived(AVBufferRef **dst_ref_ptr,
goto fail;
done:
- ret = av_hwdevice_ctx_init(dst_ref);
- if (ret < 0)
- goto fail;
-
*dst_ref_ptr = dst_ref;
return 0;