0
0
mirror of https://github.com/obsproject/obs-studio.git synced 2024-09-20 13:08:50 +02:00

Merge pull request #1686 from pkviet/mono_upmix

libobs/media-io: Fix mono upmix
This commit is contained in:
Colin Edwards 2019-03-03 22:38:59 -06:00 committed by GitHub
commit 84b87df161
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -102,6 +102,21 @@ audio_resampler_t *audio_resampler_create(const struct resample_info *dst,
return NULL;
}
if (rs->input_layout == AV_CH_LAYOUT_MONO && rs->output_ch > 1) {
const double matrix[MAX_AUDIO_CHANNELS][MAX_AUDIO_CHANNELS] = {
{1},
{1, 1},
{1, 1, 0},
{1, 1, 1, 1},
{1, 1, 1, 0, 1},
{1, 1, 1, 1, 1, 1},
{1, 1, 1, 0, 1, 1, 1},
{1, 1, 1, 0, 1, 1, 1, 1},
};
if (swr_set_matrix(rs->context, matrix[rs->output_ch - 1], 1) < 0)
blog(LOG_DEBUG, "swr_set_matrix failed for mono upmix\n");
}
errcode = swr_init(rs->context);
if (errcode != 0) {
blog(LOG_ERROR, "avresample_open failed: error code %d",