Merge pull request #23787 from marcelofg55/pulse_uneven_fix

Fix distorted sound with PulseAudio and uneven channels
This commit is contained in:
Rémi Verschelde 2018-11-18 10:53:24 +01:00 committed by GitHub
commit 4340580e74
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -346,9 +346,9 @@ void AudioDriverPulseAudio::thread_func(void *p_udata) {
for (int j = 0; j < ad->pa_map.channels - 1; j++) {
ad->samples_out.write[out_idx++] = ad->samples_in[in_idx++] >> 16;
}
uint32_t l = ad->samples_in[in_idx++];
uint32_t r = ad->samples_in[in_idx++];
ad->samples_out.write[out_idx++] = ((l >> 1) + (r >> 1)) >> 16;
uint32_t l = ad->samples_in[in_idx++] >> 16;
uint32_t r = ad->samples_in[in_idx++] >> 16;
ad->samples_out.write[out_idx++] = (l + r) / 2;
}
}
}