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
diff --git a/src/audio/pulseaudio/SDL_pulseaudio.c b/src/audio/pulseaudio/SDL_pulseaudio.c
index 271e1fa..eded4b6 100644
--- a/src/audio/pulseaudio/SDL_pulseaudio.c
+++ b/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;