diff options
author | Hein-Pieter van Braam <hp@tmm.cx> | 2018-07-26 01:26:46 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-26 01:26:46 +0200 |
commit | 832e2bfcd38965a01a9149d509169dd197e42f58 (patch) | |
tree | 18b7ff35f1eeee39031a16e9c1d834ebf03d44cf /drivers/pulseaudio/audio_driver_pulseaudio.cpp | |
parent | 9423f23ffb80c946dec380f73f3f313ec44d0d18 (diff) | |
parent | 0e29f7974b59e4440cf02e1388fb9d8ab2b5c5fd (diff) |
Merge pull request #20137 from hpvb/reduce-vector-cow
Reduce unnecessary COW on Vector by make writing explicit
Diffstat (limited to 'drivers/pulseaudio/audio_driver_pulseaudio.cpp')
-rw-r--r-- | drivers/pulseaudio/audio_driver_pulseaudio.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/pulseaudio/audio_driver_pulseaudio.cpp b/drivers/pulseaudio/audio_driver_pulseaudio.cpp index 864b9714a9..6db0e58737 100644 --- a/drivers/pulseaudio/audio_driver_pulseaudio.cpp +++ b/drivers/pulseaudio/audio_driver_pulseaudio.cpp @@ -295,7 +295,7 @@ void AudioDriverPulseAudio::thread_func(void *p_udata) { if (!ad->active) { for (unsigned int i = 0; i < ad->pa_buffer_size; i++) { - ad->samples_out[i] = 0; + ad->samples_out.write[i] = 0; } } else { @@ -303,7 +303,7 @@ void AudioDriverPulseAudio::thread_func(void *p_udata) { if (ad->channels == ad->pa_map.channels) { for (unsigned int i = 0; i < ad->pa_buffer_size; i++) { - ad->samples_out[i] = ad->samples_in[i] >> 16; + ad->samples_out.write[i] = ad->samples_in[i] >> 16; } } else { // Uneven amount of channels @@ -312,11 +312,11 @@ void AudioDriverPulseAudio::thread_func(void *p_udata) { for (unsigned int i = 0; i < ad->buffer_frames; i++) { for (unsigned int j = 0; j < ad->pa_map.channels - 1; j++) { - ad->samples_out[out_idx++] = ad->samples_in[in_idx++] >> 16; + 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[out_idx++] = (l >> 1 + r >> 1) >> 16; + ad->samples_out.write[out_idx++] = (l >> 1 + r >> 1) >> 16; } } } |