From 7bf90eb8cb57d9d58c0e59028a4a4a6f6ba16517 Mon Sep 17 00:00:00 2001 From: ejurgensen Date: Sun, 19 May 2019 22:45:39 +0200 Subject: [PATCH] [xcode] Fix for reading mono sources (ref issue #742) --- src/transcode.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/transcode.c b/src/transcode.c index 580795b8..1a92120e 100644 --- a/src/transcode.c +++ b/src/transcode.c @@ -1608,10 +1608,12 @@ transcode_frame_new(void *data, size_t size, int nsamples, struct media_quality // We don't align because the frame won't be given directly to the encoder // anyway, it will first go through the filter (which might align it...?) - ret = avcodec_fill_audio_frame(f, 2, f->format, data, size, 1); + ret = avcodec_fill_audio_frame(f, quality->channels, f->format, data, size, 1); if (ret < 0) { - DPRINTF(E_LOG, L_XCODE, "Error filling frame with rawbuf, size %zu, samples %d (%d/%d/2): %s\n", size, nsamples, quality->sample_rate, quality->bits_per_sample, err2str(ret)); + DPRINTF(E_LOG, L_XCODE, "Error filling frame with rawbuf, size %zu, samples %d (%d/%d/%d): %s\n", + size, nsamples, quality->sample_rate, quality->bits_per_sample, quality->channels, err2str(ret)); + av_frame_free(&f); return NULL; }