Skip to contentSkip to conversation

pulseaudio: process audio data in smaller chunks

PATCH Superseded Gerd Hoffmann 2 participants 2 messages Jul 3, 2018

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pulseaudio: process audio data in smaller chunks

The rate of pulseaudio absorbing the audio stream is used to control the the rate of the guests audio stream. When the emulated hardware uses small chunks (like intel-hda does) we need small chunks on the audio backend side too, otherwise that feedback loop doesn't work very well.

Cc Max Ehrlich <[email protected]>
Cc Martin Schrodt <[email protected]>
---
 audio/paaudio.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
audio/paaudio.c +2 -2
index 949769774d..4c100bc318 100644
@@ -227,7 +227,7 @@ static void *qpa_thread_out (void *arg)
             }
         }
 
-        decr = to_mix = audio_MIN (pa->live, pa->g->conf.samples >> 2);
+        decr = to_mix = audio_MIN(pa->live, pa->g->conf.samples >> 5);
         rpos = pa->rpos;
 
         if (audio_pt_unlock(&pa->pt, __func__)) {
@@ -319,7 +319,7 @@ static void *qpa_thread_in (void *arg)
             }
         }
 
-        incr = to_grab = audio_MIN (pa->dead, pa->g->conf.samples >> 2);
+        incr = to_grab = audio_MIN(pa->dead, pa->g->conf.samples >> 5);
         wpos = pa->wpos;
 
         if (audio_pt_unlock(&pa->pt, __func__)) {
Signature · 1 line
2.9.3
#1 lore raw
Quoted 26 lines · Gerd Hoffmann

The rate of pulseaudio absorbing the audio stream is used to control the the rate of the guests audio stream. When the emulated hardware uses small chunks (like intel-hda does) we need small chunks on the audio backend side too, otherwise that feedback loop doesn't work very well.

Cc Max Ehrlich <[email protected]>
Cc Martin Schrodt <[email protected]>
---
 audio/paaudio.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
audio/paaudio.c +1 -1
index 949769774d..4c100bc318 100644
@@ -227,7 +227,7 @@ static void *qpa_thread_out (void *arg)
             }
         }
 
-        decr = to_mix = audio_MIN (pa->live, pa->g->conf.samples >> 2);
+        decr = to_mix = audio_MIN(pa->live, pa->g->conf.samples >> 5);
         rpos = pa->rpos;
 
         if (audio_pt_unlock(&pa->pt, __func__)) {

audio/paaudio.c static void *qpa_thread_in (void *arg) · line 322

Quoted 5 lines
audio/paaudio.c +1 -1
@@ -319,7 +319,7 @@ static void *qpa_thread_in (void *arg)
             }
         }
 
-        incr = to_grab = audio_MIN (pa->dead, pa->g->conf.samples >> 2);
+        incr = to_grab = audio_MIN(pa->dead, pa->g->conf.samples >> 5);

Same pattern/value: can we have a #define?

I looked at the PA intel-hda code and couldn't find the chunk size, anyway this change looks sane.

Quoted 4 lines
audio/paaudio.c +0 -0
         wpos = pa->wpos;
 
         if (audio_pt_unlock(&pa->pt, __func__)) {