mirror of
https://github.com/jellyfin/jellyfin-ffmpeg.git
synced 2026-09-03 05:09:58 +03:00
Backport fixes for vaapi and qsv from upstream
Signed-off-by: nyanmisaka <nst799610810@gmail.com>
This commit is contained in:
@@ -1,3 +1,31 @@
|
||||
Index: FFmpeg/libavutil/hwcontext_vaapi.c
|
||||
===================================================================
|
||||
--- FFmpeg.orig/libavutil/hwcontext_vaapi.c
|
||||
+++ FFmpeg/libavutil/hwcontext_vaapi.c
|
||||
@@ -1813,6 +1813,7 @@ static int vaapi_device_create(AVHWDevic
|
||||
"Failed to get DRM device info for device %d.\n", n);
|
||||
close(priv->drm_fd);
|
||||
priv->drm_fd = -1;
|
||||
+ drmFreeVersion(info);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -1824,6 +1825,7 @@ static int vaapi_device_create(AVHWDevic
|
||||
drmFreeDevice(&device);
|
||||
close(priv->drm_fd);
|
||||
priv->drm_fd = -1;
|
||||
+ drmFreeVersion(info);
|
||||
continue;
|
||||
}
|
||||
av_log(ctx, AV_LOG_VERBOSE, "Trying to use "
|
||||
@@ -1831,6 +1833,7 @@ static int vaapi_device_create(AVHWDevic
|
||||
"with matching vendor id (%s).\n",
|
||||
n, vendor_id->value);
|
||||
drmFreeDevice(&device);
|
||||
+ drmFreeVersion(info);
|
||||
break;
|
||||
}
|
||||
drmFreeVersion(info);
|
||||
Index: FFmpeg/libavcodec/vaapi_encode.c
|
||||
===================================================================
|
||||
--- FFmpeg.orig/libavcodec/vaapi_encode.c
|
||||
|
||||
@@ -1,3 +1,29 @@
|
||||
Index: FFmpeg/libavcodec/qsvdec.c
|
||||
===================================================================
|
||||
--- FFmpeg.orig/libavcodec/qsvdec.c
|
||||
+++ FFmpeg/libavcodec/qsvdec.c
|
||||
@@ -202,6 +202,7 @@ static int qsv_init_session(AVCodecConte
|
||||
MFXClose(q->internal_qs.session);
|
||||
q->internal_qs.session = NULL;
|
||||
}
|
||||
+ ff_refstruct_unref(&q->frames_ctx.mids);
|
||||
av_buffer_unref(&q->frames_ctx.hw_frames_ctx);
|
||||
|
||||
q->frames_ctx.hw_frames_ctx = av_buffer_ref(hw_frames_ref);
|
||||
Index: FFmpeg/libavcodec/qsvenc.c
|
||||
===================================================================
|
||||
--- FFmpeg.orig/libavcodec/qsvenc.c
|
||||
+++ FFmpeg/libavcodec/qsvenc.c
|
||||
@@ -1842,6 +1842,9 @@ int ff_qsv_enc_init(AVCodecContext *avct
|
||||
return ret;
|
||||
}
|
||||
|
||||
+ // Update AVCodecContext with actual encoding parameters
|
||||
+ avctx->has_b_frames = q->param.mfx.GopRefDist > 1 ? q->param.mfx.GopRefDist - 1 : 0;
|
||||
+
|
||||
q->avctx = avctx;
|
||||
|
||||
return 0;
|
||||
Index: FFmpeg/libavfilter/qsvvpp.c
|
||||
===================================================================
|
||||
--- FFmpeg.orig/libavfilter/qsvvpp.c
|
||||
|
||||
Reference in New Issue
Block a user