Procházet zdrojové kódy

pulseaudio: Initialize fragsize to fix mic recording

fragsize wasn't initialized, and it is used for recording.
If the value was 0 or -1, pulseaudio configures it itself. But sometimes
we can get a random (and large) value that makes pulseaudio give us
large sample at a very low frequency.

https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/blob/master/src/pulse/def.h#L453
https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/blob/v13.0/src/pulsecore/protocol-native.c#L409
Romain Roffé před 4 roky
rodič
revize
ef85ed9352
1 změnil soubory, kde provedl 2 přidání a 0 odebrání
  1. 2 0
      src/audio/pulseaudio/SDL_pulseaudio.c

+ 2 - 0
src/audio/pulseaudio/SDL_pulseaudio.c

@@ -600,6 +600,7 @@ PULSEAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture)
 
     /* Reduced prebuffering compared to the defaults. */
 #ifdef PA_STREAM_ADJUST_LATENCY
+    paattr.fragsize = this->spec.size;
     /* 2x original requested bufsize */
     paattr.tlength = h->mixlen * 4;
     paattr.prebuf = -1;
@@ -608,6 +609,7 @@ PULSEAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture)
     paattr.minreq = h->mixlen;
     flags = PA_STREAM_ADJUST_LATENCY;
 #else
+    paattr.fragsize = this->spec.size;
     paattr.tlength = h->mixlen*2;
     paattr.prebuf = h->mixlen*2;
     paattr.maxlength = h->mixlen*2;