[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#1072451: simplescreenrecorder: FTBFS with ffmpeg 7.0: AudioEncoder.cpp:169:43: error: ‘AVFrame’ {aka ‘struct AVFrame’} has no member named ‘channels’ no member named ‘channels’



On Mon Aug 12, 2024 at 8:42 AM CEST, Petter Reinholdtsen wrote:
>
> Control: tags -1 + patch
>
> The following debian/patches/1020-ffmpeg-7.patch seem to fix the build:
>
> Description: More fixes for ffmpeg 7.0
>  Use class method GetChannels() as a wrapper to get the ffmpeg version
>  dependent implementation instead of the channels method which
>  disappeared with ffmpeg 7.
> Author: Petter Reinholdtsen
> Forwarded: no

Why not? This isn't specific to Debian and with forwarding everyone benefits.
And if a new upstream version gets released, you can likely drop the
patch.

> Last-Updated: 2024-08-12
> ---
> Index: simplescreenrecorder-salsa/src/AV/Output/AudioEncoder.cpp
> ==================================================================> --- simplescreenrecorder-salsa.orig/src/AV/Output/AudioEncoder.cpp	2024-08-12 06:33:54.881267389 +0000
> +++ simplescreenrecorder-salsa/src/AV/Output/AudioEncoder.cpp	2024-08-12 06:35:49.514541002 +0000
> @@ -42,7 +42,7 @@
>  	if(GetCodecContext()->frame_size <= 1) {
>  		// This is really weird, the old API uses the size of the *output* buffer to determine the number of
>  		// input samples if the number of input samples (i.e. frame_size) is not fixed (i.e. frame_size <= 1).
> -		m_temp_buffer.resize(DEFAULT_FRAME_SAMPLES * GetCodecContext()->channels * av_get_bits_per_sample(GetCodecContext()->codec_id) / 8);
> +		m_temp_buffer.resize(DEFAULT_FRAME_SAMPLES * GetChannels() * av_get_bits_per_sample(GetCodecContext()->codec_id) / 8);
>  	} else {
>  		m_temp_buffer.resize(std::max(FF_MIN_BUFFER_SIZE, 256 * 1024));
>  	}
> @@ -166,7 +166,11 @@
>  		assert((unsigned int) frame->GetFrame()->nb_samples == GetFrameSize());
>  #endif
>  #if SSR_USE_AVFRAME_CHANNELS
> -		assert(frame->GetFrame()->channels == GetCodecContext()->channels);
> +#  if LIBAVCODEC_VERSION_MAJOR < 61
> +		assert(frame->GetFrame()->channels == GetChannels());
> +#  else
> +		assert(frame->GetFrame()->ch_layout.nb_channels == GetChannels());
> +#  endif /* LIBAVCODEC_VERSION_MAJOR < 61 */
>  #endif
>  #if SSR_USE_AVFRAME_SAMPLE_RATE
>  		assert(frame->GetFrame()->sample_rate == GetCodecContext()->sample_rate);

Probably a PEBKAC issue, but it seems it didn't apply cleanly?
The Salsa CI pipeline now does succeed:
https://salsa.debian.org/diederik/simplescreenrecorder/-/pipelines/715297

(at time of writing at least the 'build' stage where it failed before)

Attachment: signature.asc
Description: PGP signature


Reply to: