]> git.alsa-project.org Git - alsa-lib.git/commitdiff
Fixed problem with the route plugin and ttable (an extra route plugin was
authorJaroslav Kysela <perex@perex.cz>
Wed, 11 Aug 2004 15:09:05 +0000 (15:09 +0000)
committerJaroslav Kysela <perex@perex.cz>
Wed, 11 Aug 2004 15:09:05 +0000 (15:09 +0000)
inserted accidently).

src/pcm/pcm_plug.c

index 1a6bbbb39e81b365c1e730b18e8e14360d3631e8..82a6a5f55ea47a0aa323407e8508e6ca13f9445c 100644 (file)
@@ -53,7 +53,7 @@ typedef struct {
        int srate;
        enum snd_pcm_plug_route_policy route_policy;
        snd_pcm_route_ttable_entry_t *ttable;
-       int ttable_ok;
+       int ttable_ok, ttable_last;
        unsigned int tt_ssize, tt_cused, tt_sused;
 } snd_pcm_plug_t;
 
@@ -361,7 +361,8 @@ static int snd_pcm_plug_change_channels(snd_pcm_t *pcm, snd_pcm_t **new, snd_pcm
        snd_pcm_route_ttable_entry_t *ttable;
        int err;
        assert(snd_pcm_format_linear(slv->format));
-       if (clt->channels == slv->channels && !plug->ttable)
+       if (clt->channels == slv->channels &&
+           (!plug->ttable || !plug->ttable_last))
                return 0;
        if (clt->rate != slv->rate &&
            clt->channels > slv->channels)
@@ -560,7 +561,7 @@ static int snd_pcm_plug_insert_plugins(snd_pcm_t *pcm,
        };
        snd_pcm_plug_params_t p = *slave;
        unsigned int k = 0;
-       plug->ttable_ok = 0;
+       plug->ttable_ok = plug->ttable_last = 0;
        while (client->format != p.format ||
               client->channels != p.channels ||
               client->rate != p.rate ||
@@ -584,6 +585,7 @@ static int snd_pcm_plug_insert_plugins(snd_pcm_t *pcm,
        if (plug->ttable && !plug->ttable_ok) {
                snd_pcm_t *new;
                int err;
+               plug->ttable_last = 1;
                err = snd_pcm_plug_change_channels(pcm, &new, client, &p);
                if (err < 0) {
                        snd_pcm_plug_clear(pcm);