]> git.alsa-project.org Git - alsa-lib.git/commitdiff
Try to fix period_time/period_size problems for direct plugin slaves
authorJaroslav Kysela <perex@perex.cz>
Fri, 29 Oct 2004 10:56:13 +0000 (10:56 +0000)
committerJaroslav Kysela <perex@perex.cz>
Fri, 29 Oct 2004 10:56:13 +0000 (10:56 +0000)
src/pcm/pcm.c
src/pcm/pcm_dmix.c
src/pcm/pcm_dshare.c
src/pcm/pcm_dsnoop.c

index aaab6c6b41670beab00437f76d61a999d1c6e430..ce0f2408c08b164c57f56afb217f901fef1df2d6 100644 (file)
@@ -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)
index 5e4fa373cd6f1ff22631d7f59d34ee064e972e6d..45a5b929bcf7ba4e4545e9e25dbbf02b8ae037c9 100644 (file)
@@ -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) {
index b821544d906a0f7b3597789e2aacc7bf427e6cbc..527840193331ee09d94c46311b53c80508533ba1 100644 (file)
@@ -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, &params, bindings, slowptr, root, sconf, stream, mode);
index e0e9664dd2703803e2b4a5b09cf6e128b5e0b3c4..e6ae1e6a2152b4da1f558162b87b099525a7ff83 100644 (file)
@@ -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, &params, bindings, slowptr, root, sconf, stream, mode);