]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/nvdec_h264.c
avcodec: v4l2_m2m: fix races around freeing data on close
[ffmpeg] / libavcodec / nvdec_h264.c
index 75dd4b2eb8f8c57056571d54daf17379f2f1d6a9..35f54f2ed5f2a07316f8cdf2f8e742124efa7099 100644 (file)
@@ -155,14 +155,15 @@ static int nvdec_h264_decode_slice(AVCodecContext *avctx, const uint8_t *buffer,
     return 0;
 }
 
-static int nvdec_h264_decode_init(AVCodecContext *avctx)
+static int nvdec_h264_frame_params(AVCodecContext *avctx,
+                                   AVBufferRef *hw_frames_ctx)
 {
     const H264Context *h = avctx->priv_data;
     const SPS       *sps = h->ps.sps;
-    return ff_nvdec_decode_init(avctx, sps->ref_frame_count + sps->num_reorder_frames);
+    return ff_nvdec_frame_params(avctx, hw_frames_ctx, sps->ref_frame_count + sps->num_reorder_frames);
 }
 
-AVHWAccel ff_h264_nvdec_hwaccel = {
+const AVHWAccel ff_h264_nvdec_hwaccel = {
     .name                 = "h264_nvdec",
     .type                 = AVMEDIA_TYPE_VIDEO,
     .id                   = AV_CODEC_ID_H264,
@@ -170,7 +171,8 @@ AVHWAccel ff_h264_nvdec_hwaccel = {
     .start_frame          = nvdec_h264_start_frame,
     .end_frame            = ff_nvdec_end_frame,
     .decode_slice         = nvdec_h264_decode_slice,
-    .init                 = nvdec_h264_decode_init,
+    .frame_params         = nvdec_h264_frame_params,
+    .init                 = ff_nvdec_decode_init,
     .uninit               = ff_nvdec_decode_uninit,
     .priv_data_size       = sizeof(NVDECContext),
 };