Skip to content
Snippets Groups Projects
  • Volker Rümelin's avatar
    a9ea5678
    audio: make recording packet length calculation exact · a9ea5678
    Volker Rümelin authored
    
    Introduce the new function st_rate_frames_out() to calculate the
    exact number of audio output frames the resampling code can
    generate from a given number of audio input frames. When upsampling,
    this function returns the maximum number of output frames.
    
    This new function replaces the audio_frontend_frames_in()
    function, which calculated the average number of output frames
    rounded down to the nearest integer. The audio_frontend_frames_in()
    function was additionally used to limit the number of output frames
    to the resample buffer size. In audio_pcm_sw_read() the variable
    resample_buf.size replaces the open coded audio_frontend_frames_in()
    function. In audio_run_in() an additional MIN() function is
    necessary.
    
    After this patch the audio packet length calculation for audio
    recording is exact.
    
    Acked-by: default avatarMark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
    Signed-off-by: default avatarVolker Rümelin <vr_qemu@t-online.de>
    Message-Id: <20230224190555.7409-12-vr_qemu@t-online.de>
    a9ea5678
    History
    audio: make recording packet length calculation exact
    Volker Rümelin authored
    
    Introduce the new function st_rate_frames_out() to calculate the
    exact number of audio output frames the resampling code can
    generate from a given number of audio input frames. When upsampling,
    this function returns the maximum number of output frames.
    
    This new function replaces the audio_frontend_frames_in()
    function, which calculated the average number of output frames
    rounded down to the nearest integer. The audio_frontend_frames_in()
    function was additionally used to limit the number of output frames
    to the resample buffer size. In audio_pcm_sw_read() the variable
    resample_buf.size replaces the open coded audio_frontend_frames_in()
    function. In audio_run_in() an additional MIN() function is
    necessary.
    
    After this patch the audio packet length calculation for audio
    recording is exact.
    
    Acked-by: default avatarMark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
    Signed-off-by: default avatarVolker Rümelin <vr_qemu@t-online.de>
    Message-Id: <20230224190555.7409-12-vr_qemu@t-online.de>