[xcode] Fix for reading mono sources (ref issue #742)

This commit is contained in:
ejurgensen 2019-05-19 22:45:39 +02:00
parent cbd8d8a44d
commit 7bf90eb8cb

View File

@ -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;
}