From b7e8f57314022d9994db07050dfed9dc07f6d13f Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Fri, 29 Oct 2004 10:56:13 +0000 Subject: [PATCH] Try to fix period_time/period_size problems for direct plugin slaves --- src/pcm/pcm.c | 1 + src/pcm/pcm_dmix.c | 6 +++++- src/pcm/pcm_dshare.c | 6 +++++- src/pcm/pcm_dsnoop.c | 6 +++++- 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/pcm/pcm.c b/src/pcm/pcm.c index aaab6c6b..ce0f2408 100644 --- a/src/pcm/pcm.c +++ b/src/pcm/pcm.c @@ -1044,6 +1044,7 @@ snd_pcm_sframes_t snd_pcm_rewind(snd_pcm_t *pcm, snd_pcm_uframes_t frames) * \param pcm PCM handle * \param frames wanted skip in frames * \return a positive number for actual skip otherwise a negative error code + * \retval 0 means no action */ #ifndef DOXYGEN snd_pcm_sframes_t INTERNAL(snd_pcm_forward)(snd_pcm_t *pcm, snd_pcm_uframes_t frames) diff --git a/src/pcm/pcm_dmix.c b/src/pcm/pcm_dmix.c index 5e4fa373..45a5b929 100644 --- a/src/pcm/pcm_dmix.c +++ b/src/pcm/pcm_dmix.c @@ -1206,7 +1206,7 @@ int _snd_pcm_dmix_open(snd_pcm_t **pcmp, const char *name, params.format = SND_PCM_FORMAT_S16; params.rate = 48000; params.channels = 2; - params.period_time = 125000; /* 0.125 seconds */ + params.period_time = -1; params.buffer_time = -1; bsize = psize = -1; params.periods = 3; @@ -1223,6 +1223,10 @@ int _snd_pcm_dmix_open(snd_pcm_t **pcmp, const char *name, if (err < 0) return err; + /* set a reasonable default */ + if (psize == -1 && params.period_time == -1) + params.period_time = 125000; /* 0.125 seconds */ + /* sorry, limited features */ if (params.format != SND_PCM_FORMAT_S16 && params.format != SND_PCM_FORMAT_S32) { diff --git a/src/pcm/pcm_dshare.c b/src/pcm/pcm_dshare.c index b821544d..52784019 100644 --- a/src/pcm/pcm_dshare.c +++ b/src/pcm/pcm_dshare.c @@ -874,7 +874,7 @@ int _snd_pcm_dshare_open(snd_pcm_t **pcmp, const char *name, params.format = SND_PCM_FORMAT_S16; params.rate = 48000; params.channels = 2; - params.period_time = 125000; /* 0.125 seconds */ + params.period_time = -1; params.buffer_time = -1; bsize = psize = -1; params.periods = 3; @@ -890,6 +890,10 @@ int _snd_pcm_dshare_open(snd_pcm_t **pcmp, const char *name, if (err < 0) return err; + /* set a reasonable default */ + if (psize == -1 && params.period_time == -1) + params.period_time = 125000; /* 0.125 seconds */ + params.period_size = psize; params.buffer_size = bsize; err = snd_pcm_dshare_open(pcmp, name, ipc_key, ipc_perm, ¶ms, bindings, slowptr, root, sconf, stream, mode); diff --git a/src/pcm/pcm_dsnoop.c b/src/pcm/pcm_dsnoop.c index e0e9664d..e6ae1e6a 100644 --- a/src/pcm/pcm_dsnoop.c +++ b/src/pcm/pcm_dsnoop.c @@ -824,7 +824,7 @@ int _snd_pcm_dsnoop_open(snd_pcm_t **pcmp, const char *name, params.format = SND_PCM_FORMAT_S16; params.rate = 48000; params.channels = 2; - params.period_time = 125000; /* 0.125 seconds */ + params.period_time = -1; params.buffer_time = -1; bsize = psize = -1; params.periods = 3; @@ -840,6 +840,10 @@ int _snd_pcm_dsnoop_open(snd_pcm_t **pcmp, const char *name, if (err < 0) return err; + /* set a reasonable default */ + if (psize == -1 && params.period_time == -1) + params.period_time = 125000; /* 0.125 seconds */ + params.period_size = psize; params.buffer_size = bsize; err = snd_pcm_dsnoop_open(pcmp, name, ipc_key, ipc_perm, ¶ms, bindings, slowptr, root, sconf, stream, mode); -- 2.47.1