Skip to content

Commit

Permalink
fix audio issue related to 16 vs 8 channels
Browse files Browse the repository at this point in the history
  • Loading branch information
niklaspandersson committed Dec 6, 2024
1 parent 46bf2f3 commit 5497cf1
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/modules/ffmpeg/util/audio_resampler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@ namespace caspar::ffmpeg {
AudioResampler::AudioResampler(int sample_rate, AVSampleFormat in_sample_fmt)
{
AVChannelLayout channel_layout = AV_CHANNEL_LAYOUT_7POINT1;

AVChannelLayout channel_layout_out = AV_CHANNEL_LAYOUT_HEXADECAGONAL;

SwrContext* raw_ctx = nullptr;
FF(swr_alloc_set_opts2(&raw_ctx,
&channel_layout,
&channel_layout_out,
AV_SAMPLE_FMT_S32,
sample_rate,
&channel_layout,
Expand All @@ -30,7 +31,7 @@ AudioResampler::AudioResampler(int sample_rate, AVSampleFormat in_sample_fmt)

caspar::array<int32_t> AudioResampler::convert(int frames, const void** src)
{
auto result = caspar::array<int32_t>(frames * 8 * sizeof(int32_t));
auto result = caspar::array<int32_t>(frames * 16 * sizeof(int32_t));
auto ptr = result.data();
swr_convert(ctx.get(), (uint8_t**)&ptr, frames, reinterpret_cast<const uint8_t**>(src), frames);

Expand Down

0 comments on commit 5497cf1

Please sign in to comment.