instead of resetting virtual_volume unconditionally on initialization, do so only...
authorLennart Poettering <lennart@poettering.net>
Tue, 7 Oct 2008 20:42:13 +0000 (22:42 +0200)
committerLennart Poettering <lennart@poettering.net>
Tue, 7 Oct 2008 20:42:13 +0000 (22:42 +0200)
src/pulsecore/sink-input.c

index 9a3c49c..bd4d769 100644 (file)
@@ -150,13 +150,16 @@ pa_sink_input* pa_sink_input_new(
     pa_return_null_if_fail(pa_channel_map_valid(&data->channel_map));
     pa_return_null_if_fail(data->channel_map.channels == data->sample_spec.channels);
 
-    if (!data->volume_is_set)
+    if (!data->volume_is_set) {
         pa_cvolume_reset(&data->volume, data->sample_spec.channels);
+        pa_cvolume_reset(&data->virtual_volume, data->sample_spec.channels);
+    }
 
     pa_return_null_if_fail(pa_cvolume_valid(&data->volume));
     pa_return_null_if_fail(data->volume.channels == data->sample_spec.channels);
 
-    data->virtual_volume = data->volume;
+    pa_return_null_if_fail(pa_cvolume_valid(&data->virtual_volume));
+    pa_return_null_if_fail(pa_cvolume_compatible(&data->virtual_volume.channels, &data->sample_spec));
 
     if (!data->muted_is_set)
         data->muted = FALSE;