From 3de564258d6b9b6ba2e90c6fe7ffb78aa51c169d Mon Sep 17 00:00:00 2001 From: derrod Date: Thu, 6 Apr 2023 17:01:47 +0200 Subject: [PATCH] obs-outputs: Fix AV1 header parser adding ref count to data The header packets are only used within the rtmp-output and do not need or use the ref counter as the data is manually free'd directly. The presence of this ref counter causes a crash on *nix platforms due to our memory alignment hack attempting to free memory but reading the wrong offset due to the ref counter being there rather than the alignment offset. --- plugins/obs-outputs/rtmp-av1.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/plugins/obs-outputs/rtmp-av1.c b/plugins/obs-outputs/rtmp-av1.c index 42839b848..e4a2ee0c7 100644 --- a/plugins/obs-outputs/rtmp-av1.c +++ b/plugins/obs-outputs/rtmp-av1.c @@ -523,10 +523,8 @@ size_t obs_parse_av1_header(uint8_t **header, const uint8_t *data, size_t size) struct array_output_data output; struct serializer s; - long ref = 1; array_output_serializer_init(&s, &output); - serialize(&s, &ref, sizeof(ref)); s_write(&s, av1header, sizeof(av1header)); if (seq_size) @@ -534,8 +532,8 @@ size_t obs_parse_av1_header(uint8_t **header, const uint8_t *data, size_t size) if (meta_size) s_write(&s, meta, meta_size); - *header = output.bytes.array + sizeof(ref); - return output.bytes.num - sizeof(ref); + *header = output.bytes.array; + return output.bytes.num; } static void serialize_av1_data(struct serializer *s, const uint8_t *data,