Your message dated Wed, 18 Dec 2024 18:32:37 +0000
with message-id <[email protected]>
and subject line Re: fix compilation of baresip against ffmpeg 7
has caused the Debian Bug report #1081652,
regarding fix compilation of baresip against ffmpeg 7
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
1081652: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1081652
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
package: baresip
Version: 1.1.0-1

The source code of baresip is incompatible with the current version of FFmpeg 
7, leading to a crash when trying to compile against it.
The attached patch (from upstream) fixes the issues, allowing successful 
compilation.

I am using Ubuntu 24.04 and Debian Unstable.
diff -Nru baresip-1.1.0.orig/modules/avcodec/decode.c 
baresip-1.1.0/modules/avcodec/decode.c
--- baresip-1.1.0.orig/modules/avcodec/decode.c 2024-09-12 17:59:08.067564052 
-0400
+++ baresip-1.1.0/modules/avcodec/decode.c      2024-09-13 10:38:11.763692796 
-0400
@@ -267,8 +267,8 @@
 
        if (got_picture) {
 
-#if LIBAVUTIL_VERSION_MAJOR >= 56
                if (hw_frame) {
+                        av_frame_unref(st->pict); /* cleanup old frame */
                        /* retrieve data from GPU to CPU */
                        ret = av_hwframe_transfer_data(st->pict, hw_frame, 0);
                        if (ret < 0) {
@@ -276,11 +276,14 @@
                                        " the data to system memory\n");
                                goto out;
                        }
-
+#if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(58, 29, 100)
+                       st->pict->flags = hw_frame->flags;
+#else
                        st->pict->key_frame = hw_frame->key_frame;
-               }
 #endif
 
+               }
+
                frame->fmt = avpixfmt_to_vidfmt(st->pict->format);
                if (frame->fmt == (enum vidfmt)-1) {
                        warning("avcodec: decode: bad pixel format"
@@ -297,7 +300,11 @@
                frame->size.w = st->ctx->width;
                frame->size.h = st->ctx->height;
 
+#if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(58, 29, 100)
+               if (st->pict->flags & AV_FRAME_FLAG_KEY) {
+#else
                if (st->pict->key_frame) {
+#endif
 
                        *intra = true;
                        st->got_keyframe = true;
diff -Nru baresip-1.1.0.orig/modules/avcodec/encode.c 
baresip-1.1.0/modules/avcodec/encode.c
--- baresip-1.1.0.orig/modules/avcodec/encode.c 2024-09-12 17:59:08.067564052 
-0400
+++ baresip-1.1.0/modules/avcodec/encode.c      2024-09-13 10:41:16.252176798 
-0400
@@ -544,7 +544,11 @@
 
        if (update) {
                debug("avcodec: encoder picture update\n");
+#if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(58, 29, 100)
+               pict->flags |= AV_FRAME_FLAG_KEY;
+#else
                pict->key_frame = 1;
+#endif
                pict->pict_type = AV_PICTURE_TYPE_I;
        }
 
diff -Nru baresip-1.1.0.orig/modules/avformat/audio.c 
baresip-1.1.0/modules/avformat/audio.c
--- baresip-1.1.0.orig/modules/avformat/audio.c 2024-09-12 17:59:08.067564052 
-0400
+++ baresip-1.1.0/modules/avformat/audio.c      2024-09-13 10:45:45.022881711 
-0400
@@ -100,8 +100,14 @@
 
        avformat_shared_set_audio(st->shared, st);
 
+#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(59, 37, 100)
+       int channels = sh->au.ctx->ch_layout.nb_channels;
+#else
+       int channels = sh->au.ctx->channels;
+#endif
+
        info("avformat: audio: converting %u/%u %s -> %u/%u %s\n",
-            sh->au.ctx->sample_rate, sh->au.ctx->channels,
+            sh->au.ctx->sample_rate, channels,
             av_get_sample_fmt_name(sh->au.ctx->sample_fmt),
             prm->srate, prm->ch, aufmt_name(prm->fmt));
 
@@ -154,13 +160,19 @@
 
                const AVRational tb = st->au.time_base;
                struct auframe af;
+               int channels = st->ausrc_st->prm.ch;
 
+#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(59, 37, 100)
+               av_channel_layout_default(&frame2.ch_layout, channels);
+#else
                frame.channel_layout =
                        av_get_default_channel_layout(frame.channels);
 
-               frame2.channels       = st->ausrc_st->prm.ch;
+               frame2.channels       = channels;
                frame2.channel_layout =
                        av_get_default_channel_layout(st->ausrc_st->prm.ch);
+#endif
+
                frame2.sample_rate    = st->ausrc_st->prm.srate;
                frame2.format         =
                        aufmt_to_avsampleformat(st->ausrc_st->prm.fmt);
@@ -173,7 +185,7 @@
                }
 
                auframe_init(&af, st->ausrc_st->prm.fmt, frame2.data[0],
-                            frame2.nb_samples * frame2.channels);
+                            frame2.nb_samples * channels);
                af.timestamp = frame.pts * AUDIO_TIMEBASE * tb.num / tb.den;
 
                st->ausrc_st->readh(&af, st->ausrc_st->arg);
diff -Nru baresip-1.1.0.orig/modules/avformat/avformat.c 
baresip-1.1.0/modules/avformat/avformat.c
--- baresip-1.1.0.orig/modules/avformat/avformat.c      2024-09-12 
17:59:08.067564052 -0400
+++ baresip-1.1.0/modules/avformat/avformat.c   2024-09-13 10:46:07.842941552 
-0400
@@ -44,7 +44,7 @@
 static enum AVHWDeviceType avformat_hwdevice = AV_HWDEVICE_TYPE_NONE;
 #endif
 static char avformat_inputformat[64];
-static AVCodec *avformat_decoder;
+static const AVCodec *avformat_decoder;
 
 static void shared_destructor(void *arg)
 {
@@ -56,12 +56,10 @@
        }
 
        if (st->au.ctx) {
-               avcodec_close(st->au.ctx);
                avcodec_free_context(&st->au.ctx);
        }
 
        if (st->vid.ctx) {
-               avcodec_close(st->vid.ctx);
                avcodec_free_context(&st->vid.ctx);
        }
 
@@ -170,7 +168,7 @@
 static int open_codec(struct stream *s, const struct AVStream *strm, int i,
                      AVCodecContext *ctx)
 {
-       AVCodec *codec = avformat_decoder;
+       const AVCodec *codec = avformat_decoder;
        int ret;
 
        if (s->idx >= 0 || s->ctx)
@@ -226,7 +224,11 @@
        struct shared *st;
        struct pl pl_fmt, pl_dev;
        char *device = NULL;
+#if LIBAVUTIL_VERSION_MAJOR >= 57
+       const AVInputFormat *input_format = NULL;
+#else
        AVInputFormat *input_format = NULL;
+#endif
        AVDictionary *format_opts = NULL;
        char buf[16];
        unsigned i;

--- End Message ---
--- Begin Message ---
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Format: 1.8
Date: Thu, 07 Nov 2024 19:56:49 +0100
Source: baresip
Architecture: source
Version: 1.1.0-2
Distribution: unstable
Urgency: medium
Maintainer: Debian VoIP Team <[email protected]>
Changed-By: Victor Seva <[email protected]>
Closes: 1072401
Changes:
  baresip (1.1.0-2) unstable; urgency=medium
  .
    * fix ffmpeg 7 build (Closes: #1072401)
    * add myself to Uploaders
    * pkg-config => pkgconf
Checksums-Sha1:
  887d5e9afd6b4ed8df31694327b413d1dde64f8c 2411 baresip_1.1.0-2.dsc
  d7066ce3c2f5e9c0e81e6b520d18f187ec120248 18632 baresip_1.1.0-2.debian.tar.xz
  a27632d2e15d91b57346cd0880da6077f5ebe77a 22969 baresip_1.1.0-2_amd64.buildinfo
Checksums-Sha256:
  a4c49623116e745f4f893775bac184db712c6b5fd664209cdbefcac9641e0eea 2411 
baresip_1.1.0-2.dsc
  c9a4943b06cbecdc3ea7de6fc9c664680ef76b640c68172316d79421c358624e 18632 
baresip_1.1.0-2.debian.tar.xz
  61a0609f460a20139fbeb1013ab09ac28cf6b15017a46a87da456d53fe06f4d1 22969 
baresip_1.1.0-2_amd64.buildinfo
Files:
  62fe53af5b20c7915e93ef53ce5c71ce 2411 comm optional baresip_1.1.0-2.dsc
  d95e765d02bfef397ffe29b4d7be7a68 18632 comm optional 
baresip_1.1.0-2.debian.tar.xz
  c5a511f43863e7f5a2ce187683b450ea 22969 comm optional 
baresip_1.1.0-2_amd64.buildinfo

-----BEGIN PGP SIGNATURE-----

iIcEARYKAC8WIQQq6AO8RS0zF4SC1vh9e2XEKg7IsgUCZy0OPxEcdnNldmFAZGVi
aWFuLm9yZwAKCRB9e2XEKg7IsrN9AP0c7RnTsHSjsv2A7PxmntE+wpBxSBmVT79T
ZABp/C0XHwEAlRvewNF4LUwtQZA9qMUNNJNAcI62zFW5hkcMy7mVQw8=
=xg/E
-----END PGP SIGNATURE-----

-- 
-----------------------------------------------------------------
| ⢀⣴⠾⠻⢶⣦⠀                                            Victor Seva |
| ⣾⠁⢠⠒⠀⣿⡁                     [email protected] |
| ⢿⡄⠘⠷⠚⠋⠀PGP: 8F19 CADC D42A 42D4 5563  730C 51A0 9B18 CF5A 5068 |
| ⠈⠳⣄⠀⠀⠀                                        Debian Developer |
  -----------------------------------------------------------------

--- End Message ---

Reply via email to