X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavutil%2Fhwcontext_qsv.c;h=8e43420e7042608edd7061fd92e8e40df8a6c523;hb=0525722ca03aa6c3c8d828ad278e1870731bfafc;hp=f1d16d8bf92c6eb896cb7411b3106bb8d3340bb8;hpb=95a52ca884ce7d7e0a0653c558bd56039ffdc8c4;p=ffmpeg diff --git a/libavutil/hwcontext_qsv.c b/libavutil/hwcontext_qsv.c index f1d16d8bf92..8e43420e704 100644 --- a/libavutil/hwcontext_qsv.c +++ b/libavutil/hwcontext_qsv.c @@ -1029,6 +1029,23 @@ static int qsv_device_derive_from_child(AVHWDeviceContext *ctx, goto fail; } + err = MFXQueryVersion(hwctx->session, &ver); + if (err != MFX_ERR_NONE) { + av_log(ctx, AV_LOG_ERROR, "Error querying an MFX session: %d.\n", err); + ret = AVERROR_UNKNOWN; + goto fail; + } + + MFXClose(hwctx->session); + + err = MFXInit(implementation, &ver, &hwctx->session); + if (err != MFX_ERR_NONE) { + av_log(ctx, AV_LOG_ERROR, + "Error initializing an MFX session: %d.\n", err); + ret = AVERROR_UNKNOWN; + goto fail; + } + err = MFXVideoCORE_SetHandle(hwctx->session, handle_type, handle); if (err != MFX_ERR_NONE) { av_log(ctx, AV_LOG_ERROR, "Error setting child device handle: "