Control: tags 1037842 + patch
Control: tags 1037842 + pending


Dear maintainer,

I've prepared an NMU for ring (versioned as 20230206.0~ds2-1.3) and
uploaded it.

Regards.
From: Gianfranco Costamagna <locutusofb...@debian.org>
To:   1037...@bugs.debian.org
Cc:
Bcc: 
Subject: ring: diff for NMU version 20230206.0~ds2-1.3
Date: Sat, 02 Sep 2023 11:57:01 +0200
X-NMUDIFF-Version: 2.22.1ubuntu1

Control: tags 1037842 + patch
Control: tags 1037842 + pending

[Replace XX with correct value]

Dear maintainer,

I've prepared an NMU for ring (versioned as 20230206.0~ds2-1.3) and
uploaded it to DELAYED/XX. Please feel free to tell me if I
should delay it longer.

Regards.

diff -Nru ring-20230206.0~ds2/debian/changelog ring-20230206.0~ds2/debian/changelog
--- ring-20230206.0~ds2/debian/changelog	2023-07-01 23:23:01.000000000 +0200
+++ ring-20230206.0~ds2/debian/changelog	2023-09-02 10:00:03.000000000 +0200
@@ -1,3 +1,14 @@
+ring (20230206.0~ds2-1.3) unstable; urgency=medium
+
+  * Non-maintainer upload.
+  * debian/patches/d5e6509975bfaa67f7b3c54db72336b810454fc2.patch:
+    - gcc-13 upstream build fix (Closes: #1037842)
+  * debian/patches/bfa5a93114266caf791ff62c84918249c6d75bdf.patch:
+  * debian/patches/fc975f0cacde4b06c6adde3d7f0c02f71abfb38c.patch:
+    - ffmpeg 6.0 upstream build fix.
+
+ -- Gianfranco Costamagna <locutusofb...@debian.org>  Sat, 02 Sep 2023 10:00:03 +0200
+
 ring (20230206.0~ds2-1.2) unstable; urgency=medium
 
   * Non-maintainer upload.
diff -Nru ring-20230206.0~ds2/debian/patches/bfa5a93114266caf791ff62c84918249c6d75bdf.patch ring-20230206.0~ds2/debian/patches/bfa5a93114266caf791ff62c84918249c6d75bdf.patch
--- ring-20230206.0~ds2/debian/patches/bfa5a93114266caf791ff62c84918249c6d75bdf.patch	1970-01-01 01:00:00.000000000 +0100
+++ ring-20230206.0~ds2/debian/patches/bfa5a93114266caf791ff62c84918249c6d75bdf.patch	2023-09-02 10:00:03.000000000 +0200
@@ -0,0 +1,256 @@
+From bfa5a93114266caf791ff62c84918249c6d75bdf Mon Sep 17 00:00:00 2001
+From: Adrien Beraud <adrien.ber...@savoirfairelinux.com>
+Date: Sun, 5 Mar 2023 11:05:25 -0500
+Subject: [PATCH] debug utils: use ffmpeg for WavWriter
+
+The previous writer was not working, the format was not
+recognized by most players.
+The new version uses ffmpeg APIs to produce working wav files
+(tested stereo s16 and mono f32).
+The API remains the same and it should be a drop-in
+replacement for existing code.
+
+Change-Id: I328e32427d94a44085ddb1567b5a1bbee5a6a8bc
+---
+ contrib/src/ffmpeg/rules.mak |   9 +-
+ src/debug_utils.h            | 211 +++++++++++++++++------------------
+ 2 files changed, 111 insertions(+), 109 deletions(-)
+
+diff --git a/daemon/src/debug_utils.h b/daemon/src/debug_utils.h
+index 8572790599..3e519b7e7e 100644
+--- a/daemon/src/debug_utils.h
++++ b/daemon/src/debug_utils.h
+@@ -75,127 +75,122 @@ private:
+ };
+ 
+ /**
+- * Minimally invasive audio logger. Writes a wav file from raw PCM or AVFrame. Helps debug what goes
+- * wrong with audio.
++ * Audio logger. Writes a wav file from raw PCM or AVFrame. Helps debug what goes wrong with audio.
+  */
+-class WavWriter
+-{
++class WavWriter {
+ public:
+-    WavWriter(std::string filename, AVFrame* frame)
+-        : format_(static_cast<AVSampleFormat>(frame->format))
+-        , channels_(frame->channels)
+-        , planar_(av_sample_fmt_is_planar(format_))
+-        , depth_(av_get_bytes_per_sample(format_))
+-        , stepPerSample_(planar_ ? depth_ : depth_ * channels_)
++    WavWriter(const char* filename, AVFrame* frame)
+     {
+-        std::vector<AVSampleFormat> v {AV_SAMPLE_FMT_FLT,
+-                                       AV_SAMPLE_FMT_FLTP,
+-                                       AV_SAMPLE_FMT_DBL,
+-                                       AV_SAMPLE_FMT_DBLP};
+-        f_ = std::ofstream(filename, std::ios_base::out | std::ios_base::binary);
+-        f_.imbue(std::locale::classic());
+-        f_ << "RIFF----WAVEfmt ";
+-        if (std::find(v.begin(), v.end(), format_) == v.end()) {
+-            write(16, 4); // Chunk size
+-            write(1, 2);  // WAVE_FORMAT_PCM
+-            write(frame->channels, 2);
+-            write(frame->sample_rate, 4);
+-            write(frame->sample_rate * depth_ * frame->channels, 4); // Bytes per second
+-            write(depth_ * frame->channels, 2);                      // Multi-channel sample size
+-            write(8 * depth_, 2);                                    // Bits per sample
+-            f_ << "data";
+-            dataChunk_ = f_.tellp();
+-            f_ << "----";
+-        } else {
+-            write(18, 4); // Chunk size
+-            write(3, 2);  // Non PCM data
+-            write(frame->channels, 2);
+-            write(frame->sample_rate, 4);
+-            write(frame->sample_rate * depth_ * frame->channels, 4); // Bytes per second
+-            write(depth_ * frame->channels, 2);                      // Multi-channel sample size
+-            write(8 * depth_, 2);                                    // Bits per sample
+-            write(0, 2);                                             // Extension size
+-            f_ << "fact";
+-            write(4, 4); // Chunk size
+-            factChunk_ = f_.tellp();
+-            f_ << "----";
+-            f_ << "data";
+-            dataChunk_ = f_.tellp();
+-            f_ << "----";
+-        }
+-    }
++        JAMI_WARNING("WavWriter(): {} ({}, {})", filename, av_get_sample_fmt_name((AVSampleFormat)frame->format), frame->sample_rate);
++        avformat_alloc_output_context2(&format_ctx_, nullptr, "wav", filename);
++        if (!format_ctx_)
++            throw std::runtime_error("Failed to allocate output format context");
+ 
+-    ~WavWriter()
+-    {
+-        length_ = f_.tellp();
+-        f_.seekp(dataChunk_);
+-        write(length_ - dataChunk_ + 4, 4); // bytes_per_sample * channels * nb_samples
+-        f_.seekp(4);
+-        write(length_ - 8, 4);
+-        if (factChunk_) {
+-            f_.seekp(factChunk_);
+-            write((length_ - dataChunk_ + 4) / depth_, 4); // channels * nb_samples
++        AVCodecID codec_id = AV_CODEC_ID_NONE;
++        switch (frame->format) {
++            case AV_SAMPLE_FMT_U8:
++                codec_id = AV_CODEC_ID_PCM_U8;
++                break;
++            case AV_SAMPLE_FMT_S16:
++            case AV_SAMPLE_FMT_S16P:
++                codec_id = AV_CODEC_ID_PCM_S16LE;
++                break;
++            case AV_SAMPLE_FMT_S32:
++            case AV_SAMPLE_FMT_S32P:
++                codec_id = AV_CODEC_ID_PCM_S32LE;
++                break;
++            case AV_SAMPLE_FMT_S64:
++            case AV_SAMPLE_FMT_S64P:
++                codec_id = AV_CODEC_ID_PCM_S64LE;
++                break;
++            case AV_SAMPLE_FMT_FLT:
++            case AV_SAMPLE_FMT_FLTP:
++                codec_id = AV_CODEC_ID_PCM_F32LE;
++                break;
++            case AV_SAMPLE_FMT_DBL:
++                codec_id = AV_CODEC_ID_PCM_F64LE;
++                break;
++            default:
++                throw std::runtime_error("Unsupported audio format");
+         }
+-        f_.flush();
+-    }
+ 
+-    template<typename Word>
+-    void write(Word value, unsigned size = sizeof(Word))
+-    {
+-        auto p = reinterpret_cast<unsigned char const*>(&value);
+-        for (int i = 0; size; --size, ++i)
+-            f_.put(p[i]);
++        auto codec = avcodec_find_encoder(codec_id);
++        if (!codec)
++            throw std::runtime_error("Failed to find audio codec");
++
++        codec_ctx_ = avcodec_alloc_context3(codec);
++        if (!codec_ctx_)
++            throw std::runtime_error("Failed to allocate audio codec context");
++
++        codec_ctx_->sample_fmt = (AVSampleFormat)frame->format;
++        codec_ctx_->channel_layout = frame->channel_layout;
++        codec_ctx_->sample_rate = frame->sample_rate;
++        codec_ctx_->channels = frame->channels;
++        if (format_ctx_->oformat->flags & AVFMT_GLOBALHEADER)
++            codec_ctx_->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;
++
++        if (avcodec_open2(codec_ctx_, codec, nullptr) < 0)
++            throw std::runtime_error("Failed to open audio codec");
++
++        stream_ = avformat_new_stream(format_ctx_, codec);
++        if (!stream_)
++            throw std::runtime_error("Failed to create audio stream");
++
++        if (avcodec_parameters_from_context(stream_->codecpar, codec_ctx_) < 0)
++            throw std::runtime_error("Failed to copy codec parameters to stream");
++
++        if (!(format_ctx_->oformat->flags & AVFMT_NOFILE)) {
++            if (avio_open(&format_ctx_->pb, filename, AVIO_FLAG_WRITE) < 0) {
++                throw std::runtime_error("Failed to open output file for writing");
++            }
++        }
++        if (avformat_write_header(format_ctx_, nullptr) < 0)
++            throw std::runtime_error("Failed to write header to output file");
+     }
+ 
+-    void write(AVFrame* frame)
+-    {
+-        for (int c = 0; c < frame->channels; ++c) {
+-            int offset = planar_ ? 0 : depth_ * c;
+-            for (int i = 0; i < frame->nb_samples; ++i) {
+-                uint8_t* p = &frame->extended_data[planar_ ? c : 0][i + offset];
+-                switch (format_) {
+-                case AV_SAMPLE_FMT_U8:
+-                case AV_SAMPLE_FMT_U8P:
+-                    write<uint8_t>(*(uint8_t*) p);
+-                    break;
+-                case AV_SAMPLE_FMT_S16:
+-                case AV_SAMPLE_FMT_S16P:
+-                    write<int16_t>(*(int16_t*) p);
+-                    break;
+-                case AV_SAMPLE_FMT_S32:
+-                case AV_SAMPLE_FMT_S32P:
+-                    write<int32_t>(*(int32_t*) p);
+-                    break;
+-                case AV_SAMPLE_FMT_S64:
+-                case AV_SAMPLE_FMT_S64P:
+-                    write<int64_t>(*(int64_t*) p);
+-                    break;
+-                case AV_SAMPLE_FMT_FLT:
+-                case AV_SAMPLE_FMT_FLTP:
+-                    write<float>(*(float*) p);
+-                    break;
+-                case AV_SAMPLE_FMT_DBL:
+-                case AV_SAMPLE_FMT_DBLP:
+-                    write<double>(*(double*) p);
+-                    break;
+-                default:
+-                    break;
+-                }
++    void write(AVFrame* frame) {
++        int ret = avcodec_send_frame(codec_ctx_, frame);
++        if (ret < 0)
++            JAMI_ERROR("Error sending a frame to the encoder");
++        while (ret >= 0) {
++            AVPacket *pkt = av_packet_alloc();
++            ret = avcodec_receive_packet(codec_ctx_, pkt);
++            if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF)
++                break;
++            else if (ret < 0) {
++                JAMI_ERROR("Error encoding a frame");
++                break;
+             }
++            pkt->stream_index = stream_->index;
++            pkt->pts = lastPts;
++            pkt->dts = lastPts;
++            lastPts += frame->nb_samples * (int64_t)stream_->time_base.den / (stream_->time_base.num * (int64_t)frame->sample_rate);
++            ret = av_write_frame(format_ctx_, pkt);
++            if (ret < 0) {
++                JAMI_ERROR("Error while writing output packet");
++                break;
++            }
++            av_packet_free(&pkt);
+         }
+-        f_.flush();
+     }
+ 
++    ~WavWriter() {
++        if (codec_ctx_) {
++            avcodec_close(codec_ctx_);
++            avcodec_free_context(&codec_ctx_);
++        }
++        if (format_ctx_) {
++            av_write_trailer(format_ctx_);
++            if (!(format_ctx_->oformat->flags & AVFMT_NOFILE))
++                avio_closep(&format_ctx_->pb);
++            avformat_free_context(format_ctx_);
++        }
++    }
+ private:
+-    std::ofstream f_;
+-    size_t dataChunk_ {0};
+-    size_t factChunk_ {0};
+-    size_t length_ {0};
+-    AVSampleFormat format_ {AV_SAMPLE_FMT_NONE};
+-    size_t channels_ {0};
+-    bool planar_ {false};
+-    int depth_ {0};
+-    int stepPerSample_ {0};
++    AVFormatContext* format_ctx_ {nullptr};
++    AVCodecContext* codec_ctx_ {nullptr};
++    AVStream* stream_ {nullptr};
++    int64_t lastPts {0};
+ };
+ 
+ /**
+-- 
+GitLab
+
diff -Nru ring-20230206.0~ds2/debian/patches/d5e6509975bfaa67f7b3c54db72336b810454fc2.patch ring-20230206.0~ds2/debian/patches/d5e6509975bfaa67f7b3c54db72336b810454fc2.patch
--- ring-20230206.0~ds2/debian/patches/d5e6509975bfaa67f7b3c54db72336b810454fc2.patch	1970-01-01 01:00:00.000000000 +0100
+++ ring-20230206.0~ds2/debian/patches/d5e6509975bfaa67f7b3c54db72336b810454fc2.patch	2023-09-02 10:00:03.000000000 +0200
@@ -0,0 +1,65 @@
+From d5e6509975bfaa67f7b3c54db72336b810454fc2 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?S=C3=A9bastien=20Blin?=
+ <sebastien.b...@savoirfairelinux.com>
+Date: Wed, 26 Apr 2023 12:38:01 -0400
+Subject: [PATCH] misc: fix build on gcc13
+
+Change-Id: I2a42352cd560ea8f48d8f052e2819d121da1057c
+---
+ src/archiver.h           | 1 +
+ src/jami/trace-tools.h   | 1 +
+ src/scheduled_executor.h | 1 +
+ src/string_utils.h       | 1 +
+ 4 files changed, 4 insertions(+)
+
+diff --git a/daemon/src/archiver.h b/daemon/src/archiver.h
+index cba983ec9d..ccf7faa88a 100644
+--- a/daemon/src/archiver.h
++++ b/daemon/src/archiver.h
+@@ -22,6 +22,7 @@
+ 
+ #include "noncopyable.h"
+ 
++#include <cstdint>
+ #include <string>
+ #include <vector>
+ #include <map>
+diff --git a/daemon/src/jami/trace-tools.h b/daemon/src/jami/trace-tools.h
+index 6155a46c41..ccd65cdf83 100644
+--- a/daemon/src/jami/trace-tools.h
++++ b/daemon/src/jami/trace-tools.h
+@@ -34,6 +34,7 @@
+ 
+ #ifdef HAVE_CXXABI_H
+ #include <cxxabi.h>
++#include <string>
+ 
+ template<typename T>
+ std::string demangle()
+diff --git a/daemon/src/scheduled_executor.h b/daemon/src/scheduled_executor.h
+index b1fd34f04d..4802d3bcf9 100644
+--- a/daemon/src/scheduled_executor.h
++++ b/daemon/src/scheduled_executor.h
+@@ -29,6 +29,7 @@
+ #include <mutex>
+ #include <condition_variable>
+ #include <ciso646>
++#include <string>
+ 
+ #include "noncopyable.h"
+ 
+diff --git a/daemon/src/string_utils.h b/daemon/src/string_utils.h
+index 695e431c36..04f3133ef1 100644
+--- a/daemon/src/string_utils.h
++++ b/daemon/src/string_utils.h
+@@ -21,6 +21,7 @@
+ 
+ #pragma once
+ 
++#include <cstdint>
+ #include <string>
+ #include <vector>
+ #include <set>
+-- 
+GitLab
+
diff -Nru ring-20230206.0~ds2/debian/patches/fc975f0cacde4b06c6adde3d7f0c02f71abfb38c.patch ring-20230206.0~ds2/debian/patches/fc975f0cacde4b06c6adde3d7f0c02f71abfb38c.patch
--- ring-20230206.0~ds2/debian/patches/fc975f0cacde4b06c6adde3d7f0c02f71abfb38c.patch	1970-01-01 01:00:00.000000000 +0100
+++ ring-20230206.0~ds2/debian/patches/fc975f0cacde4b06c6adde3d7f0c02f71abfb38c.patch	2023-09-02 10:00:03.000000000 +0200
@@ -0,0 +1,594 @@
+From fc975f0cacde4b06c6adde3d7f0c02f71abfb38c Mon Sep 17 00:00:00 2001
+From: Aline Gondim Santos <aline.gondimsan...@savoirfairelinux.com>
+Date: Wed, 1 Mar 2023 11:44:22 -0300
+Subject: [PATCH] contrib: ffmpeg 6.0
+
+Change-Id: Ib5ff688d4ad6127e97d15ddcdd28368a3eb5d5cc
+---
+ contrib/daemon/src/ffmpeg/SHA512SUMS                 |  2 +-
+ .../src/ffmpeg/libopusdec-enable-FEC.patch    | 24 +++--
+ .../nvenc-fix-reorderqueueflush-crash.patch   | 21 ++++
+ contrib/daemon/src/ffmpeg/package.json               |  6 +-
+ contrib/daemon/src/ffmpeg/rules.mak                  |  3 +-
+ .../ffmpeg/windows-configure-ffnvcodec.patch  |  8 +-
+ contrib/daemon/src/ffnvcodec/package.json            |  2 +-
+ contrib/daemon/src/ffnvcodec/rules.mak               |  2 +-
+ contrib/daemon/src/media-sdk/package.json            |  6 +-
+ .../media-sdk/windows-static-lib-build.patch  | 99 ++++++++++---------
+ contrib/daemon/src/x264/package.json                 |  2 +-
+ src/client/videomanager.cpp                   | 17 ++--
+ src/debug_utils.h                             |  3 +-
+ src/media/audio/audio_frame_resizer.cpp       |  4 +-
+ src/media/audio/audiobuffer.cpp               |  4 +-
+ src/media/audio/coreaudio/ios/corelayer.mm    |  2 +-
+ src/media/audio/jack/jacklayer.cpp            |  2 +-
+ src/media/audio/opensl/opensllayer.cpp        |  4 +-
+ src/media/audio/portaudio/portaudiolayer.cpp  |  2 +-
+ src/media/audio/resampler.cpp                 | 21 ++--
+ src/media/audio/resampler.h                   |  2 +-
+ src/media/libav_utils.cpp                     |  2 +-
+ src/media/media_decoder.cpp                   | 18 ++--
+ src/media/media_encoder.cpp                   |  9 +-
+ src/media/media_filter.cpp                    |  4 +-
+ src/media/media_recorder.cpp                  |  2 +-
+ src/media/media_stream.h                      |  4 +-
+ src/media/video/accel.cpp                     |  1 -
+ .../media/audio/test_audio_frame_resizer.cpp  |  3 +-
+ test/unitTest/media/audio/test_resampler.cpp  |  3 +-
+ test/unitTest/media/test_media_decoder.cpp    |  2 +-
+ test/unitTest/media/test_media_encoder.cpp    |  3 +-
+ test/unitTest/media/test_media_filter.cpp     | 26 +++--
+ 33 files changed, 168 insertions(+), 145 deletions(-)
+ create mode 100644 contrib/daemon/src/ffmpeg/nvenc-fix-reorderqueueflush-crash.patch
+
+diff --git a/daemon/src/client/videomanager.cpp b/daemon/src/client/videomanager.cpp
+index 93ee6a051f..7fd72eeabb 100644
+--- a/daemon/src/client/videomanager.cpp
++++ b/daemon/src/client/videomanager.cpp
+@@ -111,8 +111,7 @@ void
+ AudioFrame::setFormat(const jami::AudioFormat& format)
+ {
+     auto d = pointer();
+-    d->channels = format.nb_channels;
+-    d->channel_layout = av_get_default_channel_layout(format.nb_channels);
++    av_channel_layout_default(&d->ch_layout, format.nb_channels);
+     d->sample_rate = format.sample_rate;
+     d->format = format.sampleFormat;
+ }
+@@ -121,7 +120,7 @@ jami::AudioFormat
+ AudioFrame::getFormat() const
+ {
+     return {(unsigned) frame_->sample_rate,
+-            (unsigned) frame_->channels,
++            (unsigned) frame_->ch_layout.nb_channels,
+             (AVSampleFormat) frame_->format};
+ }
+ 
+@@ -149,7 +148,7 @@ AudioFrame::mix(const AudioFrame& frame)
+ {
+     auto& f = *pointer();
+     auto& fIn = *frame.pointer();
+-    if (f.channels != fIn.channels || f.format != fIn.format || f.sample_rate != fIn.sample_rate) {
++    if (f.ch_layout.nb_channels != fIn.ch_layout.nb_channels || f.format != fIn.format || f.sample_rate != fIn.sample_rate) {
+         throw std::invalid_argument("Can't mix frames with different formats");
+     }
+     if (f.nb_samples == 0) {
+@@ -160,8 +159,8 @@ AudioFrame::mix(const AudioFrame& frame)
+     }
+     AVSampleFormat fmt = (AVSampleFormat) f.format;
+     bool isPlanar = av_sample_fmt_is_planar(fmt);
+-    unsigned samplesPerChannel = isPlanar ? f.nb_samples : f.nb_samples * f.channels;
+-    unsigned channels = isPlanar ? f.channels : 1;
++    unsigned samplesPerChannel = isPlanar ? f.nb_samples : f.nb_samples * f.ch_layout.nb_channels;
++    unsigned channels = isPlanar ? f.ch_layout.nb_channels : 1;
+     if (fmt == AV_SAMPLE_FMT_S16 || fmt == AV_SAMPLE_FMT_S16P) {
+         for (unsigned i = 0; i < channels; i++) {
+             auto c = (int16_t*) f.extended_data[i];
+@@ -192,8 +191,8 @@ AudioFrame::calcRMS() const
+     double rms = 0.0;
+     auto fmt = static_cast<AVSampleFormat>(frame_->format);
+     bool planar = av_sample_fmt_is_planar(fmt);
+-    int perChannel = planar ? frame_->nb_samples : frame_->nb_samples * frame_->channels;
+-    int channels = planar ? frame_->channels : 1;
++    int perChannel = planar ? frame_->nb_samples : frame_->nb_samples * frame_->ch_layout.nb_channels;
++    int channels = planar ? frame_->ch_layout.nb_channels : 1;
+     if (fmt == AV_SAMPLE_FMT_S16 || fmt == AV_SAMPLE_FMT_S16P) {
+         for (int c = 0; c < channels; ++c) {
+             auto buf = reinterpret_cast<int16_t*>(frame_->extended_data[c]);
+@@ -216,7 +215,7 @@ AudioFrame::calcRMS() const
+         return 0.0;
+     }
+     // divide by the number of multi-byte samples
+-    return sqrt(rms / (frame_->nb_samples * frame_->channels));
++    return sqrt(rms / (frame_->nb_samples * frame_->ch_layout.nb_channels));
+ }
+ 
+ #ifdef ENABLE_VIDEO
+diff --git a/daemon/src/debug_utils.h b/daemon/src/debug_utils.h
+index 3e519b7e7e..1ddcfd8457 100644
+--- a/daemon/src/debug_utils.h
++++ b/daemon/src/debug_utils.h
+@@ -123,9 +123,8 @@ public:
+             throw std::runtime_error("Failed to allocate audio codec context");
+ 
+         codec_ctx_->sample_fmt = (AVSampleFormat)frame->format;
+-        codec_ctx_->channel_layout = frame->channel_layout;
++        codec_ctx_->ch_layout = frame->ch_layout;
+         codec_ctx_->sample_rate = frame->sample_rate;
+-        codec_ctx_->channels = frame->channels;
+         if (format_ctx_->oformat->flags & AVFMT_GLOBALHEADER)
+             codec_ctx_->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;
+ 
+diff --git a/daemon/src/media/audio/audio_frame_resizer.cpp b/daemon/src/media/audio/audio_frame_resizer.cpp
+index a6eac9864e..0fc4bad937 100644
+--- a/daemon/src/media/audio/audio_frame_resizer.cpp
++++ b/daemon/src/media/audio/audio_frame_resizer.cpp
+@@ -95,10 +95,10 @@ AudioFrameResizer::enqueue(std::shared_ptr<AudioFrame>&& frame)
+ 
+     int ret = 0;
+     auto f = frame->pointer();
+-    AudioFormat format(f->sample_rate, f->channels, (AVSampleFormat) f->format);
++    AudioFormat format(f->sample_rate, f->ch_layout.nb_channels, (AVSampleFormat) f->format);
+     if (format != format_) {
+         JAMI_ERR() << "Expected " << format_ << ", but got "
+-                   << AudioFormat(f->sample_rate, f->channels, (AVSampleFormat) f->format);
++                   << AudioFormat(f->sample_rate, f->ch_layout.nb_channels, (AVSampleFormat) f->format);
+         setFormat(format, frameSize_);
+     }
+ 
+diff --git a/daemon/src/media/audio/audiobuffer.cpp b/daemon/src/media/audio/audiobuffer.cpp
+index 9ef33c8f1e..d3481b2f1a 100644
+--- a/daemon/src/media/audio/audiobuffer.cpp
++++ b/daemon/src/media/audio/audiobuffer.cpp
+@@ -348,9 +348,9 @@ AudioBuffer::append(const AudioFrame& audioFrame)
+ {
+     auto frame = audioFrame.pointer();
+     // FIXME we assume frame is s16 interleaved
+-    if (channels() != static_cast<unsigned>(frame->channels)
++    if (channels() != static_cast<unsigned>(frame->ch_layout.nb_channels)
+         || getSampleRate() != frame->sample_rate) {
+-        auto newFormat = AudioFormat {(unsigned) frame->sample_rate, (unsigned) frame->channels};
++        auto newFormat = AudioFormat {(unsigned) frame->sample_rate, (unsigned) frame->ch_layout.nb_channels};
+         setFormat(newFormat);
+     }
+ 
+diff --git a/daemon/src/media/audio/coreaudio/ios/corelayer.mm b/daemon/src/media/audio/coreaudio/ios/corelayer.mm
+index d6006de701..b58b712c3e 100644
+--- a/daemon/src/media/audio/coreaudio/ios/corelayer.mm
++++ b/daemon/src/media/audio/coreaudio/ios/corelayer.mm
+@@ -401,7 +401,7 @@ CoreLayer::write(AudioUnitRenderActionFlags* ioActionFlags,
+ 
+     if (auto toPlay = getPlayback(currentOutFormat, inNumberFrames)) {
+         const auto& frame = *toPlay->pointer();
+-        for (unsigned i = 0; i < frame.channels; ++i) {
++        for (unsigned i = 0; i < frame.ch_layout.nb_channels; ++i) {
+             std::copy_n((Float32*)frame.extended_data[i], inNumberFrames, (Float32*)ioData->mBuffers[i].mData);
+         }
+     } else {
+diff --git a/daemon/src/media/audio/jack/jacklayer.cpp b/daemon/src/media/audio/jack/jacklayer.cpp
+index a9d64a5172..a0cdfa5d4c 100644
+--- a/daemon/src/media/audio/jack/jacklayer.cpp
++++ b/daemon/src/media/audio/jack/jacklayer.cpp
+@@ -110,7 +110,7 @@ JackLayer::write(const AudioFrame& buffer)
+ {
+     auto num_samples = buffer.pointer()->nb_samples;
+     auto num_bytes = num_samples * sizeof(float);
+-    auto channels = std::min<size_t>(out_ringbuffers_.size(), buffer.pointer()->channels);
++    auto channels = std::min<size_t>(out_ringbuffers_.size(), buffer.pointer()->ch_layout.nb_channels);
+     for (size_t i = 0; i < channels; ++i) {
+         jack_ringbuffer_write(out_ringbuffers_[i],
+                               (const char*) buffer.pointer()->extended_data[i],
+diff --git a/daemon/src/media/audio/opensl/opensllayer.cpp b/daemon/src/media/audio/opensl/opensllayer.cpp
+index 0ee84fa464..e0d11b32b7 100644
+--- a/daemon/src/media/audio/opensl/opensllayer.cpp
++++ b/daemon/src/media/audio/opensl/opensllayer.cpp
+@@ -267,7 +267,7 @@ OpenSLLayer::engineServicePlay()
+     sample_buf* buf;
+     while (player_ and freePlayBufQueue_.front(&buf)) {
+         if (auto dat = getToPlay(hardwareFormat_, hardwareBuffSize_)) {
+-            buf->size_ = dat->pointer()->nb_samples * dat->pointer()->channels
++            buf->size_ = dat->pointer()->nb_samples * dat->pointer()->ch_layout.nb_channels
+                          * sizeof(AudioSample);
+             if (buf->size_ > buf->cap_) {
+                 JAMI_ERR("buf->size_(%zu) > buf->cap_(%zu)", buf->size_, buf->cap_);
+@@ -300,7 +300,7 @@ OpenSLLayer::engineServiceRing()
+     sample_buf* buf;
+     while (ringtone_ and freeRingBufQueue_.front(&buf)) {
+         if (auto dat = getToRing(hardwareFormat_, hardwareBuffSize_)) {
+-            buf->size_ = dat->pointer()->nb_samples * dat->pointer()->channels
++            buf->size_ = dat->pointer()->nb_samples * dat->pointer()->ch_layout.nb_channels
+                          * sizeof(AudioSample);
+             if (buf->size_ > buf->cap_) {
+                 JAMI_ERR("buf->size_(%zu) > buf->cap_(%zu)", buf->size_, buf->cap_);
+diff --git a/daemon/src/media/audio/portaudio/portaudiolayer.cpp b/daemon/src/media/audio/portaudio/portaudiolayer.cpp
+index 40c9e2cdc1..81f23bd37e 100644
+--- a/daemon/src/media/audio/portaudio/portaudiolayer.cpp
++++ b/daemon/src/media/audio/portaudio/portaudiolayer.cpp
+@@ -736,7 +736,7 @@ PortAudioLayer::PortAudioLayerImpl::paOutputCallback(PortAudioLayer& parent,
+         return paContinue;
+     }
+ 
+-    auto nFrames = toPlay->pointer()->nb_samples * toPlay->pointer()->channels;
++    auto nFrames = toPlay->pointer()->nb_samples * toPlay->pointer()->ch_layout.nb_channels;
+     std::copy_n((AudioSample*) toPlay->pointer()->extended_data[0], nFrames, outputBuffer);
+     return paContinue;
+ }
+diff --git a/daemon/src/media/audio/resampler.cpp b/daemon/src/media/audio/resampler.cpp
+index bce9eaa84c..211fc135fa 100644
+--- a/daemon/src/media/audio/resampler.cpp
++++ b/daemon/src/media/audio/resampler.cpp
+@@ -50,13 +50,11 @@ Resampler::reinit(const AVFrame* in, const AVFrame* out)
+         throw std::bad_alloc();
+     }
+ 
+-    av_opt_set_int(swrCtx, "ich", in->channels, 0);
+-    av_opt_set_int(swrCtx, "icl", in->channel_layout, 0);
++    av_opt_set_chlayout(swrCtx, "ichl", &in->ch_layout, 0);
+     av_opt_set_int(swrCtx, "isr", in->sample_rate, 0);
+     av_opt_set_sample_fmt(swrCtx, "isf", static_cast<AVSampleFormat>(in->format), 0);
+ 
+-    av_opt_set_int(swrCtx, "och", out->channels, 0);
+-    av_opt_set_int(swrCtx, "ocl", out->channel_layout, 0);
++    av_opt_set_chlayout(swrCtx, "ochl", &out->ch_layout, 0);
+     av_opt_set_int(swrCtx, "osr", out->sample_rate, 0);
+     av_opt_set_sample_fmt(swrCtx, "osf", static_cast<AVSampleFormat>(out->format), 0);
+ 
+@@ -71,10 +69,10 @@ Resampler::reinit(const AVFrame* in, const AVFrame* out)
+      * LFE downmixing is optional, so any coefficient can be used, we use +6dB for mono and
+      * +0dB in each channel for stereo.
+      */
+-    if (in->channel_layout == AV_CH_LAYOUT_5POINT1
+-        || in->channel_layout == AV_CH_LAYOUT_5POINT1_BACK) {
++    if (in->ch_layout.u.mask == AV_CH_LAYOUT_5POINT1
++        || in->ch_layout.u.mask == AV_CH_LAYOUT_5POINT1_BACK) {
+         // NOTE MSVC can't allocate dynamic size arrays on the stack
+-        if (out->channels == 2) {
++        if (out->ch_layout.nb_channels == 2) {
+             double matrix[2][6];
+             // L = 1.0*FL + 0.707*FC + 0.707*BL + 1.0*LFE
+             matrix[0][0] = 1;
+@@ -152,8 +150,7 @@ Resampler::resample(const AudioBuffer& dataIn, AudioBuffer& dataOut)
+     AudioFrame resampled;
+     auto output = resampled.pointer();
+     output->sample_rate = dataOut.getSampleRate();
+-    output->channel_layout = av_get_default_channel_layout(dataOut.channels());
+-    output->channels = dataOut.channels();
++    av_channel_layout_default(&output->ch_layout, dataOut.channels());
+     output->format = AV_SAMPLE_FMT_S16;
+ 
+     if (resample(input, output) < 0)
+@@ -162,14 +159,14 @@ Resampler::resample(const AudioBuffer& dataIn, AudioBuffer& dataOut)
+     dataOut.resize(output->nb_samples);
+     dataOut.deinterleave(reinterpret_cast<const AudioSample*>(output->extended_data[0]),
+                          output->nb_samples,
+-                         output->channels);
++                         output->ch_layout.nb_channels);
+ }
+ 
+ std::unique_ptr<AudioFrame>
+ Resampler::resample(std::unique_ptr<AudioFrame>&& in, const AudioFormat& format)
+ {
+     if (in->pointer()->sample_rate == (int) format.sample_rate
+-        && in->pointer()->channels == (int) format.nb_channels
++        && in->pointer()->ch_layout.nb_channels == (int) format.nb_channels
+         && (AVSampleFormat) in->pointer()->format == format.sampleFormat) {
+         return std::move(in);
+     }
+@@ -191,7 +188,7 @@ Resampler::resample(std::shared_ptr<AudioFrame>&& in, const AudioFormat& format)
+     }
+ 
+     if (inPtr->sample_rate == (int) format.sample_rate
+-        && inPtr->channels == (int) format.nb_channels
++        && inPtr->ch_layout.nb_channels == (int) format.nb_channels
+         && (AVSampleFormat) inPtr->format == format.sampleFormat) {
+         return std::move(in);
+     }
+diff --git a/daemon/src/media/audio/resampler.h b/daemon/src/media/audio/resampler.h
+index 3a5bad17e3..4b798f4a2c 100644
+--- a/daemon/src/media/audio/resampler.h
++++ b/daemon/src/media/audio/resampler.h
+@@ -47,7 +47,7 @@ public:
+      *
+      * Resample from @input format to @output format.
+      *
+-     * NOTE: sample_rate, channel_layout, and format should be set on @output
++     * NOTE: sample_rate, ch_layout, and format should be set on @output
+      */
+     int resample(const AVFrame* input, AVFrame* output);
+ 
+diff --git a/daemon/src/media/libav_utils.cpp b/daemon/src/media/libav_utils.cpp
+index 3e45b1cd0e..60cee22898 100644
+--- a/daemon/src/media/libav_utils.cpp
++++ b/daemon/src/media/libav_utils.cpp
+@@ -267,7 +267,7 @@ fillWithSilence(AVFrame* frame)
+     int ret = av_samples_set_silence(frame->extended_data,
+                                      0,
+                                      frame->nb_samples,
+-                                     frame->channels,
++                                     frame->ch_layout.nb_channels,
+                                      (AVSampleFormat) frame->format);
+     if (ret < 0)
+         JAMI_ERR() << "Failed to fill frame with silence";
+diff --git a/daemon/src/media/media_decoder.cpp b/daemon/src/media/media_decoder.cpp
+index 64ce3d1ad1..1bece6d987 100644
+--- a/daemon/src/media/media_decoder.cpp
++++ b/daemon/src/media/media_decoder.cpp
+@@ -595,8 +595,6 @@ MediaDecoder::prepareDecoderContext()
+     if (avStream_->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) {
+         if (decoderCtx_->framerate.num == 0 || decoderCtx_->framerate.den == 0)
+             decoderCtx_->framerate = inputParams_.framerate;
+-        if (decoderCtx_->framerate.num == 0 || decoderCtx_->framerate.den == 0)
+-            decoderCtx_->framerate = av_inv_q(decoderCtx_->time_base);
+         if (decoderCtx_->framerate.num == 0 || decoderCtx_->framerate.den == 0)
+             decoderCtx_->framerate = {30, 1};
+     }
+@@ -643,6 +641,15 @@ MediaDecoder::decode(AVPacket& packet)
+ #endif
+     auto frame = f->pointer();
+     ret = avcodec_receive_frame(decoderCtx_, frame);
++    // time_base is not set in AVCodecContext for decoding
++    // fail to set it causes pts to be incorrectly computed down in the function
++    if (inputDecoder_->type == AVMEDIA_TYPE_VIDEO) {
++        decoderCtx_->time_base.num = decoderCtx_->framerate.den;
++        decoderCtx_->time_base.den = decoderCtx_->framerate.num;
++    } else {
++        decoderCtx_->time_base.num = 1;
++        decoderCtx_->time_base.den = decoderCtx_->sample_rate;
++    }
+     frame->time_base = decoderCtx_->time_base;
+     if (resolutionChangedCallback_) {
+         if (decoderCtx_->width != width_ or decoderCtx_->height != height_) {
+@@ -663,11 +670,8 @@ MediaDecoder::decode(AVPacket& packet)
+         frameFinished = 1;
+ 
+     if (frameFinished) {
+-        // channel layout is needed if frame will be resampled
+-        if (!frame->channel_layout)
+-            frame->channel_layout = av_get_default_channel_layout(frame->channels);
+-
+-        frame->format = (AVPixelFormat) correctPixFmt(frame->format);
++        if (inputDecoder_->type == AVMEDIA_TYPE_VIDEO)
++            frame->format = (AVPixelFormat) correctPixFmt(frame->format);
+         auto packetTimestamp = frame->pts; // in stream time base
+         frame->pts = av_rescale_q_rnd(av_gettime() - startTime_,
+                                       {1, AV_TIME_BASE},
+diff --git a/daemon/src/media/media_encoder.cpp b/daemon/src/media/media_encoder.cpp
+index 1316ac442d..b767e2f123 100644
+--- a/daemon/src/media/media_encoder.cpp
++++ b/daemon/src/media/media_encoder.cpp
+@@ -641,14 +641,11 @@ MediaEncoder::prepareEncoderContext(const AVCodec* outputCodec, bool is_video)
+         encoderCtx->sample_rate = std::max(8000, audioOpts_.sampleRate);
+         encoderCtx->time_base = AVRational {1, encoderCtx->sample_rate};
+         if (audioOpts_.nbChannels > 2 || audioOpts_.nbChannels < 1) {
+-            encoderCtx->channels = std::clamp(audioOpts_.nbChannels, 1, 2);
++            audioOpts_.nbChannels = std::clamp(audioOpts_.nbChannels, 1, 2);
+             JAMI_ERR() << "[" << encoderName
+-                       << "] Clamping invalid channel count: " << audioOpts_.nbChannels << " -> "
+-                       << encoderCtx->channels;
+-        } else {
+-            encoderCtx->channels = audioOpts_.nbChannels;
++                       << "] Clamping invalid channel count: " << audioOpts_.nbChannels;
+         }
+-        encoderCtx->channel_layout = av_get_default_channel_layout(encoderCtx->channels);
++        av_channel_layout_default(&encoderCtx->ch_layout, audioOpts_.nbChannels);
+         if (audioOpts_.frameSize) {
+             encoderCtx->frame_size = audioOpts_.frameSize;
+             JAMI_DBG() << "[" << encoderName << "] Frame size " << encoderCtx->frame_size;
+diff --git a/daemon/src/media/media_filter.cpp b/daemon/src/media/media_filter.cpp
+index cb5023732b..8ad3799593 100644
+--- a/daemon/src/media/media_filter.cpp
++++ b/daemon/src/media/media_filter.cpp
+@@ -171,7 +171,7 @@ MediaFilter::feedInput(AVFrame* frame, const std::string& inputName)
+         if (ms.format != frame->format
+             || (ms.isVideo && (ms.width != frame->width || ms.height != frame->height))
+             || (!ms.isVideo
+-                && (ms.sampleRate != frame->sample_rate || ms.nbChannels != frame->channels))) {
++                && (ms.sampleRate != frame->sample_rate || ms.nbChannels != frame->ch_layout.nb_channels))) {
+             ms.update(frame);
+             if ((ret = reinitialize()) < 0)
+                 return fail("Failed to reinitialize filter with new input parameters", ret);
+@@ -283,7 +283,7 @@ MediaFilter::initInputFilter(AVFilterInOut* in, const MediaStream& msp)
+         buffersrc = avfilter_get_by_name("buffer");
+     } else {
+         params->sample_rate = msp.sampleRate;
+-        params->channel_layout = av_get_default_channel_layout(msp.nbChannels);
++        av_channel_layout_default(&params->ch_layout, msp.nbChannels);
+         buffersrc = avfilter_get_by_name("abuffer");
+     }
+ 
+diff --git a/daemon/src/media/media_recorder.cpp b/daemon/src/media/media_recorder.cpp
+index efa8b0d53e..58fec39906 100644
+--- a/daemon/src/media/media_recorder.cpp
++++ b/daemon/src/media/media_recorder.cpp
+@@ -576,7 +576,7 @@ std::string
+ MediaRecorder::buildAudioFilter(const std::vector<MediaStream>& peers,
+                                 const MediaStream& local) const
+ {
+-    std::string baseFilter = "aresample=osr=48000:ocl=stereo:osf=s16";
++    std::string baseFilter = "aresample=osr=48000:ochl=stereo:osf=s16";
+     std::stringstream a;
+ 
+     switch (peers.size()) {
+diff --git a/daemon/src/media/media_stream.h b/daemon/src/media/media_stream.h
+index 1ede1c6026..34c0ef7578 100644
+--- a/daemon/src/media/media_stream.h
++++ b/daemon/src/media/media_stream.h
+@@ -112,7 +112,7 @@ struct MediaStream
+                 format = c->sample_fmt;
+                 isVideo = false;
+                 sampleRate = c->sample_rate;
+-                nbChannels = c->channels;
++                nbChannels = c->ch_layout.nb_channels;
+                 frameSize = c->frame_size;
+                 break;
+             default:
+@@ -144,7 +144,7 @@ struct MediaStream
+             height = f->height;
+         } else {
+             sampleRate = f->sample_rate;
+-            nbChannels = f->channels;
++            nbChannels = f->ch_layout.nb_channels;
+             timeBase = rational<int>(1, f->sample_rate);
+             if (!frameSize)
+                 frameSize = f->nb_samples;
+diff --git a/daemon/src/media/video/accel.cpp b/daemon/src/media/video/accel.cpp
+index 344bfbd008..bf206e39c4 100644
+--- a/daemon/src/media/video/accel.cpp
++++ b/daemon/src/media/video/accel.cpp
+@@ -313,7 +313,6 @@ HardwareAccel::setDetails(AVCodecContext* codecCtx)
+     if (type_ == CODEC_DECODER) {
+         codecCtx->hw_device_ctx = av_buffer_ref(deviceCtx_);
+         codecCtx->get_format = getFormatCb;
+-        codecCtx->thread_safe_callbacks = 1;
+     } else if (type_ == CODEC_ENCODER) {
+         if (framesCtx_)
+             // encoder doesn't need a device context, only a frame context
+diff --git a/daemon/test/unitTest/media/audio/test_audio_frame_resizer.cpp b/daemon/test/unitTest/media/audio/test_audio_frame_resizer.cpp
+index 5e783f264d..7209a4b49b 100644
+--- a/daemon/test/unitTest/media/audio/test_audio_frame_resizer.cpp
++++ b/daemon/test/unitTest/media/audio/test_audio_frame_resizer.cpp
+@@ -74,8 +74,7 @@ AudioFrameResizerTest::getFrame(int n)
+     auto frame = std::make_shared<AudioFrame>();
+     frame->pointer()->format = format_.sampleFormat;
+     frame->pointer()->sample_rate = format_.sample_rate;
+-    frame->pointer()->channels = format_.nb_channels;
+-    frame->pointer()->channel_layout = av_get_default_channel_layout(format_.nb_channels);
++    av_channel_layout_default(&frame->pointer()->ch_layout, format_.nb_channels);
+     frame->pointer()->nb_samples = n;
+     CPPUNIT_ASSERT(av_frame_get_buffer(frame->pointer(), 0) >= 0);
+     return frame;
+diff --git a/daemon/test/unitTest/media/audio/test_resampler.cpp b/daemon/test/unitTest/media/audio/test_resampler.cpp
+index 3869ab3024..ad5e4d911d 100644
+--- a/daemon/test/unitTest/media/audio/test_resampler.cpp
++++ b/daemon/test/unitTest/media/audio/test_resampler.cpp
+@@ -98,8 +98,7 @@ ResamplerTest::testAudioFrame()
+     auto output = out.pointer();
+     output->format = AV_SAMPLE_FMT_FLT;
+     output->sample_rate = 48000;
+-    output->channel_layout = AV_CH_LAYOUT_STEREO;
+-    output->channels = 2;
++    av_channel_layout_from_mask(&output->ch_layout, AV_CH_LAYOUT_STEREO);
+ 
+     int ret = resampler_->resample(input->pointer(), output);
+     CPPUNIT_ASSERT_MESSAGE(libav_utils::getError(ret).c_str(), ret >= 0);
+diff --git a/daemon/test/unitTest/media/test_media_decoder.cpp b/daemon/test/unitTest/media/test_media_decoder.cpp
+index 0ce268d728..1cb2ed3481 100644
+--- a/daemon/test/unitTest/media/test_media_decoder.cpp
++++ b/daemon/test/unitTest/media/test_media_decoder.cpp
+@@ -81,7 +81,7 @@ MediaDecoderTest::testAudioFile()
+ 
+     decoder_.reset(new MediaDecoder([this](const std::shared_ptr<MediaFrame>&& f) mutable {
+         CPPUNIT_ASSERT(f->pointer()->sample_rate == decoder_->getStream().sampleRate);
+-        CPPUNIT_ASSERT(f->pointer()->channels == decoder_->getStream().nbChannels);
++        CPPUNIT_ASSERT(f->pointer()->ch_layout.nb_channels == decoder_->getStream().nbChannels);
+     }));
+     DeviceParams dev;
+     dev.input = filename_;
+diff --git a/daemon/test/unitTest/media/test_media_encoder.cpp b/daemon/test/unitTest/media/test_media_encoder.cpp
+index b077bdfa67..483af9927c 100644
+--- a/daemon/test/unitTest/media/test_media_encoder.cpp
++++ b/daemon/test/unitTest/media/test_media_encoder.cpp
+@@ -115,8 +115,7 @@ getAudioFrame(int sampleRate, int nbSamples, int nbChannels)
+         return nullptr;
+ 
+     frame->format = AV_SAMPLE_FMT_S16;
+-    frame->channels = nbChannels;
+-    frame->channel_layout = av_get_default_channel_layout(nbChannels);
++    av_channel_layout_default(&frame->ch_layout, nbChannels);
+     frame->nb_samples = nbSamples;
+     frame->sample_rate = sampleRate;
+ 
+diff --git a/daemon/test/unitTest/media/test_media_filter.cpp b/daemon/test/unitTest/media/test_media_filter.cpp
+index 1b2767c395..8d09b2c660 100644
+--- a/daemon/test/unitTest/media/test_media_filter.cpp
++++ b/daemon/test/unitTest/media/test_media_filter.cpp
+@@ -116,13 +116,12 @@ static void
+ fillAudioFrameProps(AVFrame* frame, const MediaStream& ms)
+ {
+     frame->format = ms.format;
+-    frame->channel_layout = av_get_default_channel_layout(ms.nbChannels);
++    av_channel_layout_default(&frame->ch_layout, ms.nbChannels);
+     frame->nb_samples = ms.frameSize;
+     frame->sample_rate = ms.sampleRate;
+-    frame->channels = ms.nbChannels;
+     CPPUNIT_ASSERT(frame->format > AV_SAMPLE_FMT_NONE);
+     CPPUNIT_ASSERT(frame->nb_samples > 0);
+-    CPPUNIT_ASSERT(frame->channel_layout != 0);
++    CPPUNIT_ASSERT(frame->ch_layout.u.mask != 0);
+ }
+ 
+ void
+@@ -132,7 +131,6 @@ MediaFilterTest::testAudioFilter()
+ 
+     // constants
+     const constexpr int nbSamples = 100;
+-    const constexpr int64_t channelLayout = AV_CH_LAYOUT_STEREO;
+     const constexpr int sampleRate = 44100;
+     const constexpr enum AVSampleFormat format = AV_SAMPLE_FMT_S16;
+ 
+@@ -140,17 +138,16 @@ MediaFilterTest::testAudioFilter()
+     AudioFrame af;
+     auto frame = af.pointer();
+     frame->format = format;
+-    frame->channel_layout = channelLayout;
++    av_channel_layout_from_mask(&frame->ch_layout, AV_CH_LAYOUT_STEREO);
+     frame->nb_samples = nbSamples;
+     frame->sample_rate = sampleRate;
+-    frame->channels = av_get_channel_layout_nb_channels(channelLayout);
+ 
+     // construct the filter parameters
+-    auto params = MediaStream("in1", format, rational<int>(1, sampleRate), sampleRate, frame->channels, nbSamples);
++    auto params = MediaStream("in1", format, rational<int>(1, sampleRate), sampleRate, frame->ch_layout.nb_channels, nbSamples);
+ 
+     // allocate and fill frame buffers
+     CPPUNIT_ASSERT(av_frame_get_buffer(frame, 0) >= 0);
+-    fill_samples(reinterpret_cast<uint16_t*>(frame->data[0]), sampleRate, nbSamples, frame->channels, 440.0);
++    fill_samples(reinterpret_cast<uint16_t*>(frame->data[0]), sampleRate, nbSamples, frame->ch_layout.nb_channels, 440.0);
+ 
+     // prepare filter
+     std::vector<MediaStream> vec;
+@@ -190,17 +187,17 @@ MediaFilterTest::testAudioMixing()
+         fillAudioFrameProps(frame1, vec[0]);
+         frame1->pts = i * frame1->nb_samples;
+         CPPUNIT_ASSERT(av_frame_get_buffer(frame1, 0) >= 0);
+-        fill_samples(reinterpret_cast<uint16_t*>(frame1->data[0]), frame1->sample_rate, frame1->nb_samples, frame1->channels, 440.0, t1);
++        fill_samples(reinterpret_cast<uint16_t*>(frame1->data[0]), frame1->sample_rate, frame1->nb_samples, frame1->ch_layout.nb_channels, 440.0, t1);
+ 
+         fillAudioFrameProps(frame2, vec[1]);
+         frame2->pts = i * frame2->nb_samples;
+         CPPUNIT_ASSERT(av_frame_get_buffer(frame2, 0) >= 0);
+-        fill_samples(reinterpret_cast<uint16_t*>(frame2->data[0]), frame2->sample_rate, frame2->nb_samples, frame2->channels, 329.6276, t2);
++        fill_samples(reinterpret_cast<uint16_t*>(frame2->data[0]), frame2->sample_rate, frame2->nb_samples, frame2->ch_layout.nb_channels, 329.6276, t2);
+ 
+         fillAudioFrameProps(frame3, vec[2]);
+         frame3->pts = i * frame3->nb_samples;
+         CPPUNIT_ASSERT(av_frame_get_buffer(frame3, 0) >= 0);
+-        fill_samples(reinterpret_cast<uint16_t*>(frame3->data[0]), frame3->sample_rate, frame3->nb_samples, frame3->channels, 349.2282, t3);
++        fill_samples(reinterpret_cast<uint16_t*>(frame3->data[0]), frame3->sample_rate, frame3->nb_samples, frame3->ch_layout.nb_channels, 349.2282, t3);
+ 
+         // apply filter
+         CPPUNIT_ASSERT(filter_->feedInput(frame1, "a1") >= 0);
+@@ -318,17 +315,16 @@ MediaFilterTest::testReinit()
+     AudioFrame af;
+     auto frame = af.pointer();
+     frame->format = AV_SAMPLE_FMT_S16;
+-    frame->channel_layout = AV_CH_LAYOUT_STEREO;
++    av_channel_layout_from_mask(&frame->ch_layout, AV_CH_LAYOUT_STEREO);
+     frame->nb_samples = 100;
+     frame->sample_rate = 44100;
+-    frame->channels = 2;
+ 
+     // construct the filter parameters with different sample rate
+-    auto params = MediaStream("in1", frame->format, rational<int>(1, 16000), 16000, frame->channels, frame->nb_samples);
++    auto params = MediaStream("in1", frame->format, rational<int>(1, 16000), 16000, frame->ch_layout.nb_channels, frame->nb_samples);
+ 
+     // allocate and fill frame buffers
+     CPPUNIT_ASSERT(av_frame_get_buffer(frame, 0) >= 0);
+-    fill_samples(reinterpret_cast<uint16_t*>(frame->data[0]), frame->sample_rate, frame->nb_samples, frame->channels, 440.0);
++    fill_samples(reinterpret_cast<uint16_t*>(frame->data[0]), frame->sample_rate, frame->nb_samples, frame->ch_layout.nb_channels, 440.0);
+ 
+     // prepare filter
+     std::vector<MediaStream> vec;
+-- 
+GitLab
+
diff -Nru ring-20230206.0~ds2/debian/patches/series ring-20230206.0~ds2/debian/patches/series
--- ring-20230206.0~ds2/debian/patches/series	2023-02-26 16:37:15.000000000 +0100
+++ ring-20230206.0~ds2/debian/patches/series	2023-09-02 10:00:03.000000000 +0200
@@ -3,3 +3,6 @@
 2000-jsoncpp-rename.patch
 2010-dont-build-gnutls.patch
 2020-dont-build-msgpack.patch
+d5e6509975bfaa67f7b3c54db72336b810454fc2.patch
+bfa5a93114266caf791ff62c84918249c6d75bdf.patch
+fc975f0cacde4b06c6adde3d7f0c02f71abfb38c.patch

Attachment: OpenPGP_signature
Description: OpenPGP digital signature

Reply via email to