Ticket #521: module-combine.diff

File module-combine.diff, 2.3 kB (added by mkbosmans, 3 years ago)

new patch

  • src/modules/module-combine.c

    diff --git a/src/modules/module-combine.c b/src/modules/module-combine.c
    index b7e18bc..f8dbb6d 100644
    a b  
    10551055 
    10561056    ss = m->core->default_sample_spec; 
    10571057    map = m->core->default_channel_map; 
     1058 
     1059    /* Check the specified slave sinks for sample_spec and channel_map to use for the combined sink */ 
     1060    if (!u->automatic) { 
     1061        const char*split_state = NULL; 
     1062        char *n = NULL; 
     1063        pa_sample_spec slaves_spec; 
     1064        pa_channel_map slaves_map; 
     1065        pa_bool_t is_first_slave = TRUE; 
     1066 
     1067        while ((n = pa_split(slaves, ",", &split_state))) { 
     1068            pa_sink *slave_sink; 
     1069 
     1070            if (!(slave_sink = pa_namereg_get(m->core, n, PA_NAMEREG_SINK))) { 
     1071                pa_log("Invalid slave sink '%s'", n); 
     1072                pa_xfree(n); 
     1073                goto fail; 
     1074            } 
     1075 
     1076            pa_xfree(n); 
     1077 
     1078            if (is_first_slave) { 
     1079                slaves_spec = slave_sink->sample_spec; 
     1080                slaves_map = slave_sink->channel_map; 
     1081                is_first_slave = FALSE; 
     1082            } else { 
     1083                if(slaves_spec.format != (slave_sink->sample_spec).format) 
     1084                    slaves_spec.format = PA_SAMPLE_INVALID; 
     1085                if (slaves_spec.rate < slave_sink->sample_spec.rate) 
     1086                    slaves_spec.rate = slave_sink->sample_spec.rate; 
     1087                if(slaves_spec.channels != (slave_sink->sample_spec).channels) 
     1088                    slaves_spec.channels = 0; 
     1089                if (!pa_channel_map_equal (&slaves_map, &slave_sink->channel_map)) 
     1090                    slaves_spec.channels = 0; 
     1091            } 
     1092        } 
     1093 
     1094        if (!is_first_slave) { 
     1095            if (slaves_spec.format != PA_SAMPLE_INVALID) 
     1096                ss.format = slaves_spec.format; 
     1097            if (slaves_spec.rate > 0) 
     1098                ss.rate = slaves_spec.rate; 
     1099            if (pa_channel_map_compatible(&slaves_map, &slaves_spec)) { 
     1100                map = slaves_map; 
     1101                ss.channels = slaves_map.channels; 
     1102            } 
     1103        } 
     1104    } 
     1105 
    10581106    if ((pa_modargs_get_sample_spec_and_channel_map(ma, &ss, &map, PA_CHANNEL_MAP_DEFAULT) < 0)) { 
    10591107        pa_log("Invalid sample specification."); 
    10601108        goto fail;