mirror of
https://github.com/libretro/Lakka-LibreELEC.git
synced 2024-11-24 07:56:21 +00:00
66e50e96b9
* L4T: Fix/Enable NVV4l2 decoder in libreelec builds. * L4T: LibreELEC: Allow Kodi to run as root * L4T: Small Tree Cleanup * Bluez: Switch: LibreELEC: Fix fast connect on all switch builds, not just lakka. * L4T: Finish ffmpeg 6.0 patchset * L4T: Fix building newer libcec for switch * L4T: switch-bsp: Update dock hotplug to check distro stuff, before integrating CEC and bump version.
62 lines
2.3 KiB
Diff
62 lines
2.3 KiB
Diff
From ac123e70b68b22a99b483ba5b9406e60b35f1519 Mon Sep 17 00:00:00 2001
|
|
From: CTCaer <ctcaer@gmail.com>
|
|
Date: Fri, 18 Mar 2022 21:53:34 +0000
|
|
Subject: [PATCH 13/39] codecs: nvv4l2: use sessions for transformations
|
|
|
|
Some apps use different processes for init and decoding.
|
|
|
|
NvBuffer transformations happen on both pids.
|
|
|
|
So use NvBuffer Session as parameter to id in order to not cause a crash.
|
|
|
|
That's because nvbuffer_utils can't handle gracefully any error. It just segfaults.
|
|
---
|
|
libavcodec/nvv4l2_dec.c | 10 ++++++++--
|
|
1 file changed, 8 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/libavcodec/nvv4l2_dec.c b/libavcodec/nvv4l2_dec.c
|
|
index e242857b2e..05ae7997fc 100644
|
|
--- a/libavcodec/nvv4l2_dec.c
|
|
+++ b/libavcodec/nvv4l2_dec.c
|
|
@@ -472,8 +472,6 @@ static void *dec_capture_thread(void *arg)
|
|
dest_rect.width = ctx->codec_width;
|
|
dest_rect.height = ctx->codec_height;
|
|
|
|
- memset(&transform_params, 0, sizeof(transform_params));
|
|
-
|
|
/* @transform_flag defines the flags for enabling the
|
|
** valid transforms. All the valid parameters are
|
|
** present in the nvv4l2_ext_utils header.
|
|
@@ -484,6 +482,7 @@ static void *dec_capture_thread(void *arg)
|
|
NvBufferTransform_Filter_Smart;
|
|
transform_params.src_rect = src_rect;
|
|
transform_params.dst_rect = dest_rect;
|
|
+ transform_params.session = ctx->buf_session;
|
|
|
|
pthread_mutex_lock(&ctx->queue_lock);
|
|
|
|
@@ -704,6 +703,9 @@ nvv4l2_ctx_t *nvv4l2_create_decoder(AVCodecContext *avctx,
|
|
/* Get NvBuffer pixel format list version */
|
|
ctx->pixfmt_list_ver = nvv4l2_get_pixfmt_list_version(ctx);
|
|
|
|
+ /* Get a NvBuffer session for interprocess transforms */
|
|
+ ctx->buf_session = NvBufferSessionCreate();
|
|
+
|
|
/* Decoder code assumes that the following do not change.
|
|
** If another memory type is wanted, relevant changes should be done
|
|
** to the rest of the code.
|
|
@@ -858,6 +860,10 @@ int nvv4l2_decoder_close(AVCodecContext *avctx, nvv4l2_ctx_t *ctx)
|
|
}
|
|
}
|
|
|
|
+ /* Destroy NvBuffer session. */
|
|
+ if (ctx->buf_session)
|
|
+ NvBufferSessionDestroy(ctx->buf_session);
|
|
+
|
|
NVFREE(ctx->export_pool);
|
|
|
|
/* Close the opened V4L2 device. */
|
|
--
|
|
2.25.1
|
|
|