summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2018-11-18 10:53:24 +0100
committerGitHub <noreply@github.com>2018-11-18 10:53:24 +0100
commit4340580e749b390b870f325a255435a1595ac016 (patch)
tree51f5015815a25a4ac49f4777053fde2a88dc5bec
parentadc0752da7ffa557d1871eb125c54d301d32c4a9 (diff)
parentdbf7cad04f2cc63f31f28246bf6ff3b0bf048613 (diff)
Merge pull request #23787 from marcelofg55/pulse_uneven_fix
Fix distorted sound with PulseAudio and uneven channels
-rw-r--r--drivers/pulseaudio/audio_driver_pulseaudio.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/pulseaudio/audio_driver_pulseaudio.cpp b/drivers/pulseaudio/audio_driver_pulseaudio.cpp
index d78316945f..010f7bdb0a 100644
--- a/drivers/pulseaudio/audio_driver_pulseaudio.cpp
+++ b/drivers/pulseaudio/audio_driver_pulseaudio.cpp
@@ -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;
}
}
}