MT#55283 remove obsolete version tests

All targeted/supported distributions satisfy these conditions.

Change-Id: I992d354f1900ace1595a58ebb4e8f4b734f011aa
master
Richard Fuchs 2 days ago
parent 9071a84776
commit e4ee1f8106

@ -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);

10
debian/control vendored

@ -10,10 +10,10 @@ Build-Depends:
default-libmysqlclient-dev,
discount,
gperf,
libavcodec-dev (>= 6:10) <!pkg.ngcp-rtpengine.no-transcoding>,
libavfilter-dev (>= 6:10) <!pkg.ngcp-rtpengine.no-transcoding>,
libavformat-dev (>= 6:10) <!pkg.ngcp-rtpengine.no-transcoding>,
libavutil-dev (>= 6:10) <!pkg.ngcp-rtpengine.no-transcoding>,
libavcodec-dev <!pkg.ngcp-rtpengine.no-transcoding>,
libavfilter-dev <!pkg.ngcp-rtpengine.no-transcoding>,
libavformat-dev <!pkg.ngcp-rtpengine.no-transcoding>,
libavutil-dev <!pkg.ngcp-rtpengine.no-transcoding>,
libbcg729-dev <!pkg.ngcp-rtpengine.nobcg729 !pkg.ngcp-rtpengine.no-transcoding>,
libbellesip-dev <pkg.ngcp-rtpengine.pysip-lite>,
libbencode-perl,
@ -41,7 +41,7 @@ Build-Depends:
libsocket6-perl,
libspandsp-dev <!pkg.ngcp-rtpengine.no-transcoding>,
libssl-dev (>= 1.0.1),
libswresample-dev (>= 6:10) <!pkg.ngcp-rtpengine.no-transcoding>,
libswresample-dev <!pkg.ngcp-rtpengine.no-transcoding>,
libsystemd-dev,
libtest2-suite-perl,
liburing-dev (>= 2.3) <!pkg.ngcp-rtpengine.nouring>,

@ -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;

@ -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();

@ -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

@ -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
}

@ -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
}

@ -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;

Loading…
Cancel
Save