diff --git a/libavutil/hwcontext.c b/libavutil/hwcontext.c index 2630087b5d4bb6016d0cb115f438b1ff6f91ff0d..cccbd6234e143d320dc61662278eff5cc900839b 100644 --- a/libavutil/hwcontext.c +++ b/libavutil/hwcontext.c @@ -645,6 +645,10 @@ 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; diff --git a/libavutil/hwcontext_qsv.c b/libavutil/hwcontext_qsv.c index 9270b2258f591f97a990b3af1148febed2f9c495..9fa603c3502a03c8e09b6b73e18c4cc0e02dcdba 100644 --- a/libavutil/hwcontext_qsv.c +++ b/libavutil/hwcontext_qsv.c @@ -989,7 +989,6 @@ static int qsv_device_derive_from_child(AVHWDeviceContext *ctx, int flags) { AVQSVDeviceContext *hwctx = ctx->hwctx; - QSVDeviceContext *s = ctx->internal->priv; mfxVersion ver = { { 3, 1 } }; mfxHDL handle; @@ -1058,16 +1057,6 @@ static int qsv_device_derive_from_child(AVHWDeviceContext *ctx, goto fail; } - ret = qsv_device_init(ctx); - if (ret < 0) - goto fail; - if (s->handle_type != handle_type) { - av_log(ctx, AV_LOG_ERROR, "Error in child device handle setup: " - "type mismatch (%d != %d).\n", s->handle_type, handle_type); - err = AVERROR_UNKNOWN; - goto fail; - } - return 0; fail: