Tracking down the pa_sink_set_volume call (which is what pactl set-sink-volume uses), the original sink had the correct real volume, but a wrong soft_volume (as in my use case the driver/hw is not providing hardware volume support). The soft_volume was actually at the max volume, which is the initial value provided by pa_sink_new.
Follows the dbg info from the first call to pa_sink_set_volume call (via pactl):
Tracking down the pa_sink_set_volume call (which is what pactl set-sink-volume uses), the original sink had the correct real volume, but a wrong soft_volume (as in my use case the driver/hw is not providing hardware volume support). The soft_volume was actually at the max volume, which is the initial value provided by pa_sink_new.
Follows the dbg info from the first call to pa_sink_set_volume call (via pactl):
Breakpoint 1, pa_sink_set_volume (s=s@entry=0x821c8, volume= volume@ entry=0xbeffeeb 4, send_msg= send_msg@ entry=true, save=save@ entry=true) at pulsecore/ sink.c: 1990 check_type> }, process_msg = 0xb11eb29d <sink_process_ msg>}, index = 1, core = 0x38350, DECIBEL_ VOLUME) , suspend_cause = PA_SUSPEND_IDLE, name = 0x82df8 "sink.primary", driver = 0x82f78 "module- droid-card. c", proplist = 0x827b0, module = 0x44c48, card = 0x6c020, POSITION_ FRONT_LEFT, PA_CHANNEL_ POSITION_ FRONT_RIGHT, PA_CHANNEL_ POSITION_ MONO <repeats 30 times>}}, default_sample_rate = 44100, sample_ rate = 48000, inputs = 0x829c8, n_corked = 0, monitor_source = 0x83788, input_to_master = 0x0, base_volume = 65536, n_volume_steps = 65537, reference_volume = {channels = 2 '\002', values = {9830, 9830, 0 <repeats 30 times>}}, real_volume = { requested_ latency = 0x0, set_port = 0xb11eb9a5 <sink_set_port_cb>, get_formats = 0x0, latency_ valid = false, latency = 0, max_rewind = 0, max_request = 0, rewind_nbytes = 0, rewind_requested = false, min_latency = 500, max_latency = 10000000, fixed_latency = 23311, latency_offset = 0, volume_changes = 0x0, volume_changes_tail = 0x0, current_hw_volume = { change_ safety_ margin = 1, volume_ change_ extra_delay = 0}, userdata = 0x60cc8}
1990 pulsecore/sink.c: No such file or directory.
(gdb) p *s
$1 = {parent = {parent = {_ref = {value = 2}, type_id = 0xb6fb036c <pa_sink_type_id> "pa_sink", free = 0xb6f82ffd <sink_free>, check_type = 0xb6f81859 <pa_sink_
state = PA_SINK_SUSPENDED, flags = (PA_SINK_LATENCY | PA_SINK_HARDWARE | PA_SINK_
sample_spec = {format = PA_SAMPLE_S16LE, rate = 44100, channels = 2 '\002'}, channel_map = {channels = 2 '\002', map = {PA_CHANNEL_
alternate_
channels = 2 '\002', values = {9830, 9830, 0 <repeats 30 times>}}, soft_volume = {channels = 2 '\002', values = {65536, 65536, 0 <repeats 30 times>}}, muted = false, refresh_volume = false, refresh_muted = false, save_port = false, save_volume = true,
save_muted = false, saved_volume = {channels = 0 '\000', values = {0 <repeats 32 times>}}, saved_save_volume = false, asyncmsgq = 0x61378, silence = {memblock = 0xb23fc000, index = 0, length = 65496}, ports = 0x81d28, active_port = 0x61aa8, mixer_dirty = {value = 0},
latency_offset = 0, priority = 9000, set_state = 0x0, get_volume = 0x0, set_volume = 0x0, write_volume = 0x0, get_mute = 0x0, set_mute = 0x0, request_rewind = 0x0, update_
set_formats = 0x0, update_rate = 0x0, thread_info = {state = PA_SINK_SUSPENDED, inputs = 0x83038, rtpoll = 0x60d78, soft_volume = {channels = 2 '\002', values = {65536, 65536, 0 <repeats 30 times>}}, soft_muted = false, requested_
requested_
channels = 2 '\002', values = {9830, 9830, 0 <repeats 30 times>}}, volume_