From 36d5affe8eccbb2ceb736e4a64549b08521adce5 Mon Sep 17 00:00:00 2001 From: Martin Pulec Date: Mon, 23 Sep 2024 08:56:50 +0200 Subject: [PATCH] video_decoders: use PADDING not MAX_PADDING But set the padding as the maximum of AV_INPUT_BUFFER_PADDING_SIZE (if there is include) and MAX_PADDING (both are currently 64). Use __has_include() instead of HAVE_LIBAVCODEC_H. --- src/rtp/video_decoders.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/rtp/video_decoders.cpp b/src/rtp/video_decoders.cpp index 0771ca390..81aee31da 100644 --- a/src/rtp/video_decoders.cpp +++ b/src/rtp/video_decoders.cpp @@ -135,8 +135,11 @@ #include #include -#ifdef HAVE_LIBAVCODEC_AVCODEC_H +#if __has_include() #include // AV_INPUT_BUFFER_PADDING_SIZE +constexpr int PADDING = max(MAX_PADDING, AV_INPUT_BUFFER_PADDING_SIZE); +#else +constexpr int PADDING = MAX_PADDING; #endif #define MOD_NAME "[video dec.] " @@ -177,12 +180,6 @@ static int sum_map(map const & m) { } namespace { - -#ifdef HAVE_LIBAVCODEC_AVCODEC_H -constexpr int PADDING = AV_INPUT_BUFFER_PADDING_SIZE; -#else -constexpr int PADDING = 0; -#endif /** * Enumerates 2 possibilities how to decode arriving data. */ @@ -630,7 +627,7 @@ static void *decompress_thread(void *args) { unique_ptr tmp; if (decoder->out_codec == VIDEO_CODEC_END) { - tmp = unique_ptr(new char[tile_height * (tile_width * MAX_BPS + MAX_PADDING)]); + tmp = unique_ptr(new char[tile_height * (tile_width * MAX_BPS + PADDING)]); } if(decoder->decoder_type == EXTERNAL_DECODER) {