pcm: rate - rewrite the may_wait_for_avail_min callback for the rate plugin

Shuffle the code to avoid special conditions using the plugin type
in the generic plugin code. The rate plugin has the own
may_wait_for_avail_min callback implementation now.

Fixes: d21e0e01 ("pcm: plugin - fix avail_min calculation on rate plugin")
Fixes: https://github.com/alsa-project/alsa-lib/pull/218
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
Jaroslav Kysela 2022-05-20 10:47:43 +02:00
parent d21e0e01c6
commit d9dbb57b94
4 changed files with 43 additions and 28 deletions

View file

@ -50,6 +50,8 @@ typedef struct {
/* make local functions really local */
#define snd_pcm_plugin_init \
snd1_pcm_plugin_init
#define snd_pcm_plugin_may_wait_for_avail_min_conv \
snd1_pcm_plugin_may_wait_for_avail_min_conv
#define snd_pcm_plugin_may_wait_for_avail_min \
snd1_pcm_plugin_may_wait_for_avail_min
#define snd_pcm_plugin_fast_ops \
@ -66,6 +68,8 @@ typedef struct {
void snd_pcm_plugin_init(snd_pcm_plugin_t *plugin);
snd_pcm_sframes_t snd_pcm_plugin_rewind(snd_pcm_t *pcm, snd_pcm_uframes_t frames);
snd_pcm_sframes_t snd_pcm_plugin_forward(snd_pcm_t *pcm, snd_pcm_uframes_t frames);
int snd_pcm_plugin_may_wait_for_avail_min_conv(snd_pcm_t *pcm, snd_pcm_uframes_t avail,
snd_pcm_uframes_t (*conv)(snd_pcm_t *, snd_pcm_uframes_t));
int snd_pcm_plugin_may_wait_for_avail_min(snd_pcm_t *pcm, snd_pcm_uframes_t avail);
extern const snd_pcm_fast_ops_t snd_pcm_plugin_fast_ops;