aboutsummaryrefslogtreecommitdiff
path: root/audio/mixeng.h
diff options
context:
space:
mode:
authorVolker Rümelin <vr_qemu@t-online.de>2023-02-24 20:05:52 +0100
committerMarc-André Lureau <marcandre.lureau@redhat.com>2023-03-06 10:30:23 +0400
commita9ea567873ba8d532520f194413ff28f37065c00 (patch)
treec25cdae272de3f9ffbd94439cc7255496cd9c50f /audio/mixeng.h
parentfbde1edf06dad792ef3e9f51e3f52a49669bdd40 (diff)
audio: make recording packet length calculation exact
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: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Signed-off-by: Volker Rümelin <vr_qemu@t-online.de> Message-Id: <20230224190555.7409-12-vr_qemu@t-online.de>
Diffstat (limited to 'audio/mixeng.h')
-rw-r--r--audio/mixeng.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/audio/mixeng.h b/audio/mixeng.h
index 64c1e231cc..f9de7cffeb 100644
--- a/audio/mixeng.h
+++ b/audio/mixeng.h
@@ -52,6 +52,7 @@ void st_rate_flow(void *opaque, st_sample *ibuf, st_sample *obuf,
void st_rate_flow_mix(void *opaque, st_sample *ibuf, st_sample *obuf,
size_t *isamp, size_t *osamp);
void st_rate_stop (void *opaque);
+uint32_t st_rate_frames_out(void *opaque, uint32_t frames_in);
uint32_t st_rate_frames_in(void *opaque, uint32_t frames_out);
void mixeng_clear (struct st_sample *buf, int len);
void mixeng_volume (struct st_sample *buf, int len, struct mixeng_volume *vol);