From e4ee1f81063e13b29a169f5dc272635128b091aa Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Tue, 11 Aug 2026 12:06:08 -0400 Subject: [PATCH] MT#55283 remove obsolete version tests All targeted/supported distributions satisfy these conditions. Change-Id: I992d354f1900ace1595a58ebb4e8f4b734f011aa --- daemon/media_player.c | 23 ++++++---------- debian/control | 10 +++---- lib/avc.c | 45 ------------------------------- lib/codeclib.c | 6 ----- lib/evrc.c | 4 --- lib/fix_frame_channel_layout-01.h | 8 ------ lib/fix_frame_channel_layout-02.h | 8 ------ recording-daemon/output.c | 16 ----------- 8 files changed, 13 insertions(+), 107 deletions(-) diff --git a/daemon/media_player.c b/daemon/media_player.c index cb4d5141b..0ef899a62 100644 --- a/daemon/media_player.c +++ b/daemon/media_player.c @@ -484,13 +484,6 @@ void send_timer_push(struct send_timer *st, struct codec_packet *cp) { #ifdef WITH_TRANSCODING -#if LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(57, 26, 0) -#define CODECPAR codecpar -#else -#define CODECPAR codec -#endif - - typedef union { struct media_player_cache_entry *entry; struct media_player *mp; @@ -501,9 +494,9 @@ static void media_player_coder_add_packet(struct media_player_coder *c, int64_t us_dur, unsigned long long pts), media_player_coder_add_packet_arg p) { // scale pts and duration according to sample rate - int64_t duration_scaled = c->pkt->duration * c->avstream->CODECPAR->sample_rate + int64_t duration_scaled = c->pkt->duration * c->avstream->codecpar->sample_rate * c->avstream->time_base.num / c->avstream->time_base.den; - unsigned long long pts_scaled = c->pkt->pts * c->avstream->CODECPAR->sample_rate + unsigned long long pts_scaled = c->pkt->pts * c->avstream->codecpar->sample_rate * c->avstream->time_base.num / c->avstream->time_base.den; int64_t us_dur = c->pkt->duration * 1000000LL * c->avstream->time_base.num @@ -515,7 +508,7 @@ static void media_player_coder_add_packet(struct media_player_coder *c, pts_scaled, duration_scaled, us_dur, - c->avstream->CODECPAR->sample_rate, + c->avstream->codecpar->sample_rate, c->avstream->time_base.num, c->avstream->time_base.den); fn(p, (char *) c->pkt->data, c->pkt->size, us_dur, pts_scaled); @@ -1039,23 +1032,23 @@ static int __ensure_codec_handler(struct media_player *mp, const rtp_payload_typ // synthesise rtp payload type rtp_payload_type src_pt = { .payload_type = -1 }; - src_pt.codec_def = codec_def_make_generic_av(mp->coder.avstream->CODECPAR->codec_id); + src_pt.codec_def = codec_def_make_generic_av(mp->coder.avstream->codecpar->codec_id); if (!src_pt.codec_def || !src_pt.codec_def->support_decoding) { ilog(LOG_ERR, "Attempting to play media from an unsupported file format/codec"); return -1; } - if (!GET_CHANNELS(mp->coder.avstream->CODECPAR) || !mp->coder.avstream->CODECPAR->sample_rate) + if (!GET_CHANNELS(mp->coder.avstream->codecpar) || !mp->coder.avstream->codecpar->sample_rate) __probe_format(mp); - if (!GET_CHANNELS(mp->coder.avstream->CODECPAR) || !mp->coder.avstream->CODECPAR->sample_rate) { + if (!GET_CHANNELS(mp->coder.avstream->codecpar) || !mp->coder.avstream->codecpar->sample_rate) { ilog(LOG_ERR, "Unrecognised audio format, cannot do playback"); return -1; } src_pt.encoding = src_pt.codec_def->rtpname_str; - src_pt.channels = GET_CHANNELS(mp->coder.avstream->CODECPAR); - src_pt.clock_rate = mp->coder.avstream->CODECPAR->sample_rate; + src_pt.channels = GET_CHANNELS(mp->coder.avstream->codecpar); + src_pt.clock_rate = mp->coder.avstream->codecpar->sample_rate; codec_init_payload_type(&src_pt, MT_AUDIO); diff --git a/debian/control b/debian/control index 7cd23ddbe..c09602dcd 100644 --- a/debian/control +++ b/debian/control @@ -10,10 +10,10 @@ Build-Depends: default-libmysqlclient-dev, discount, gperf, - libavcodec-dev (>= 6:10) , - libavfilter-dev (>= 6:10) , - libavformat-dev (>= 6:10) , - libavutil-dev (>= 6:10) , + libavcodec-dev , + libavfilter-dev , + libavformat-dev , + libavutil-dev , libbcg729-dev , libbellesip-dev , libbencode-perl, @@ -41,7 +41,7 @@ Build-Depends: libsocket6-perl, libspandsp-dev , libssl-dev (>= 1.0.1), - libswresample-dev (>= 6:10) , + libswresample-dev , libsystemd-dev, libtest2-suite-perl, liburing-dev (>= 2.3) , diff --git a/lib/avc.c b/lib/avc.c index 074031c28..204aab4c5 100644 --- a/lib/avc.c +++ b/lib/avc.c @@ -63,12 +63,7 @@ const char *avc_decoder_init(decoder_t *dec, const str *extra_opts) { void avc_decoder_close(decoder_t *dec) { -#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(56, 1, 0) avcodec_free_context(&dec->avc.avcctx); -#else - avcodec_close(dec->avc.avcctx); - av_free(dec->avc.avcctx); -#endif av_packet_free(&dec->avc.avpkt); } @@ -96,7 +91,6 @@ int avc_decoder_input(decoder_t *dec, const str *data, frame_q *out) { if (!frame) goto err; -#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(57, 36, 0) if (dec->avc.avpkt->size) { av_ret = avcodec_send_packet(dec->avc.avcctx, dec->avc.avpkt); ilogs(internals, LOG_DEBUG, "send packet ret %i", av_ret); @@ -128,36 +122,11 @@ int avc_decoder_input(decoder_t *dec, const str *data, frame_q *out) { else goto err; } -#else - // only do this if we have any input left - if (dec->avc.avpkt->size == 0) - break; - - av_ret = avcodec_decode_audio4(dec->avc.avcctx, frame, &got_frame, dec->avc.avpkt); - ilogs(internals, LOG_DEBUG, "decode frame ret %i, got frame %i", av_ret, got_frame); - err = "failed to decode audio packet"; - if (av_ret < 0) - goto err; - if (av_ret > 0) { - // consumed some input - err = "invalid return value"; - if (av_ret > dec->avc.avpkt->size) - goto err; - dec->avc.avpkt->size -= av_ret; - dec->avc.avpkt->data += av_ret; - keep_going = 1; - } - if (got_frame) - keep_going = 1; -#endif if (got_frame) { ilogs(internals, LOG_DEBUG, "raw frame from decoder pts %llu samples %u", (unsigned long long) frame->pts, frame->nb_samples); -#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(57, 36, 0) - frame->pts = frame->pkt_pts; -#endif if (G_UNLIKELY(frame->pts == AV_NOPTS_VALUE)) frame->pts = dec->avc.avpkt->pts; dec->avc.avpkt->pts += frame->nb_samples; @@ -280,7 +249,6 @@ int avc_encoder_input(encoder_t *enc, AVFrame **frame) { if (!enc->avc.avcctx) return -1; -#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(57, 36, 0) if (*frame) { av_ret = avcodec_send_frame(enc->avc.avcctx, *frame); ilogs(internals, LOG_DEBUG, "send frame ret %i", av_ret); @@ -310,19 +278,6 @@ int avc_encoder_input(encoder_t *enc, AVFrame **frame) { else goto err; } -#else - if (!*frame) - return 0; - - av_ret = avcodec_encode_audio2(enc->avc.avcctx, enc->avpkt, *frame, &got_packet); - ilogs(internals, LOG_DEBUG, "encode frame ret %i, got packet %i", av_ret, got_packet); - if (av_ret == 0) - *frame = NULL; // consumed - else - goto err; - if (got_packet) - keep_going = 1; -#endif if (!got_packet) return keep_going; diff --git a/lib/codeclib.c b/lib/codeclib.c index 8525e9168..076455ad7 100644 --- a/lib/codeclib.c +++ b/lib/codeclib.c @@ -380,12 +380,6 @@ void codeclib_register_codec(const codec_def_t *c) { void codeclib_init(int print) { -#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(58, 9, 100) - av_register_all(); - avcodec_register_all(); - avfilter_register_all(); -#endif - codecs_by_name_ht = codecs_by_name_new(); avc_init(); cc_init(); diff --git a/lib/evrc.c b/lib/evrc.c index cae58218e..58c4f9e27 100644 --- a/lib/evrc.c +++ b/lib/evrc.c @@ -1,8 +1,6 @@ #include "codecmod.h" -#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(57, 0, 0) - static const codec_def_t evrc = { .rtpname = "EVRC", .avcodec_id = AV_CODEC_ID_EVRC, @@ -49,5 +47,3 @@ static void init(void) { codeclib_register_codec(&evrc0); codeclib_register_codec(&evrc1); } - -#endif diff --git a/lib/fix_frame_channel_layout-01.h b/lib/fix_frame_channel_layout-01.h index cf3a32e0a..315779b47 100644 --- a/lib/fix_frame_channel_layout-01.h +++ b/lib/fix_frame_channel_layout-01.h @@ -36,16 +36,8 @@ INLINE void fix_frame_channel_layout(AVFrame *frame) { return; #else if (frame->channel_layout) { -#if LIBAVUTIL_VERSION_MAJOR < 56 - if (!frame->channels) - frame->channels = av_frame_get_channels(frame); -#endif return; } -#if LIBAVUTIL_VERSION_MAJOR < 56 - frame->channel_layout = av_get_default_channel_layout(av_frame_get_channels(frame)); -#else frame->channel_layout = av_get_default_channel_layout(frame->channels); #endif -#endif } diff --git a/lib/fix_frame_channel_layout-02.h b/lib/fix_frame_channel_layout-02.h index 9511460c6..ae61f4c9d 100644 --- a/lib/fix_frame_channel_layout-02.h +++ b/lib/fix_frame_channel_layout-02.h @@ -17,15 +17,7 @@ INLINE void fix_frame_channel_layout(AVFrame *frame) { if (frame->channel_layout) { -#if LIBAVUTIL_VERSION_MAJOR < 56 - if (!frame->channels) - frame->channels = av_frame_get_channels(frame); -#endif return; } -#if LIBAVUTIL_VERSION_MAJOR < 56 - frame->channel_layout = av_get_default_channel_layout(av_frame_get_channels(frame)); -#else frame->channel_layout = av_get_default_channel_layout(frame->channels); -#endif } diff --git a/recording-daemon/output.c b/recording-daemon/output.c index 615c415a8..926a5ab7c 100644 --- a/recording-daemon/output.c +++ b/recording-daemon/output.c @@ -431,18 +431,7 @@ static const char *output_setup(output_t *output, const format_t *requested_form return "failed to alloc output stream"; output->avst->time_base = output->encoder->avc.avcctx->time_base; -#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(57, 0, 0) - // move the avcctx to avst as we already have an initialized avcctx - if (output->avst->codec) { - avcodec_close(output->avst->codec); - avcodec_free_context(&output->avst->codec); - } - output->avst->codec = output->encoder->avc.avcctx; -#endif - -#if LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(57, 26, 0) // exact version? present in 57.56 avcodec_parameters_from_context(output->avst->codecpar, output->encoder->avc.avcctx); -#endif if (!(output_storage & OUTPUT_STORAGE_MEMORY)) { const char *err = output_open_file(output); @@ -649,11 +638,6 @@ static bool output_shutdown(output_t *output) { } avformat_free_context(output->fmtctx); -#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(57, 0, 0) - // avoid double free - avcctx already freed - output->encoder->avc.avcctx = NULL; -#endif - encoder_close(output->encoder); output->fmtctx = NULL;