Ticket #231: 0001-Ensure-period_size-not-too-low.patch

File 0001-Ensure-period_size-not-too-low.patch, 936 bytes (added by KO Myung-Hun, 3 weeks ago)

Updated patch

  • lib/unipcm.c

    From 606398bc2bc9582d9380931ef5679377ae4726be Mon Sep 17 00:00:00 2001
    From: KO Myung-Hun <komh78@gmail.com>
    Date: Thu, 23 Jan 2025 12:59:54 +0900
    Subject: [PATCH] Ensure period_size not too low
    
    This fixes audio stuttering
    ---
     lib/unipcm.c | 7 +++++++
     1 file changed, 7 insertions(+)
    
    diff --git a/lib/unipcm.c b/lib/unipcm.c
    index fa71f53..a6c9ca7 100644
    a b int uniaud_pcm_set_params(uniaud_pcm *pcm, int channels, int sample_rate, int pc  
    271271        if (periods > 3) periods = ((periods - 3) /3) * 3;
    272272        if (!periods) periods = periods_min*new_channels;
    273273
     274        // assure 512 samples at least
     275#define PERIOD_SIZE_MIN 512
     276        if (period_size < PERIOD_SIZE_MIN) {
     277                period_size = PERIOD_SIZE_MIN;
     278                period_bytes = period_size*samplesize*new_channels;
     279        }
     280
    274281        if (DebugMode) {
    275282                printf("periods min = %i\n",periods_min);
    276283                printf("period_size = %i\n",period_size);