Comment 33 for bug 598308

Revision history for this message
Ricardo Salveti (rsalveti) wrote : Re: Volume at login set to Maximum

So this is the call trace I'm getting with my device:
1) module specific (droid in my case) -> pa_sink_new
2) pa_sink_new fires up PA_CORE_HOOK_SINK_FIXATE before finishing setting up the sink, giving the original data (pa_sink_new_data) to the callback;
3) module-device-restore gets PA_CORE_HOOK_SINK_FIXATE and calls sink_fixate_hook_callback, updating the real volume for pa_sink_new_data, and setting up save_volume;
4) pa_sink_new then correctly sets reference_volume and real_volume, getting it from pa_sink_new_data (which was used by module-device-restore)
5) pa_sink_new initializes soft_volume with the max value, causing this broken behavior

Code:
src/pulsecore/sink.c:
 169 /* Called from main context */
 170 pa_sink* pa_sink_new(
 171 pa_core *core,
 172 pa_sink_new_data *data,
 173 pa_sink_flags_t flags) {
 174
...
 285 s->reference_volume = s->real_volume = data->volume;
 286 pa_cvolume_reset(&s->soft_volume, s->sample_spec.channels);
...

At the time you call pactl set-sink-volume (or set the volume via the indicator), it'll call sink_port_hook_callback that will call pa_sink_set_volume, which will then set the real_volume and soft_volume to the same value (as my driver is not providing the set_volume callback.