[vlc-devel] [vlc-commits] Audio: Core Audio: Initialize starting volume for analog devices.

Rémi Denis-Courmont remi at remlab.net
Wed Mar 7 21:48:14 CET 2012

Le mercredi 7 mars 2012 22:04:20 Jon Stacey, vous avez écrit :
> I think you were referring to patch
> 0052 which changed aout_HardVolumeInit(), but Felix committed 0053 which
> only affects the auhal module. That should have no affect on the
> operations of other modules. Please clarify exactly which patch you are
> referring to.

I said patch 52 was wrong. *And* I said the correct semantics were in the 
Pulse plugin.

> With regards to 0052, I have not been able to find any good information
> about this in the wiki or the source.

It's hard to find when you don't search.
It's right below the changes by yout 52 patch.

 * Supply or update the current custom ("hardware") volume.
 * @note This only makes sense after calling aout_VolumeHardInit().
 * @param setter volume setter callback
 * @param volume current custom volume
 * @param mute current mute flag
 * @warning The caller (i.e. the audio output plug-in) is responsible for
 * interlocking and synchronizing call to this function and to the
 * audio_output_t.pf_volume_set callback. This ensures that VLC gets correct
 * volume information (possibly with a latency).

You could also browse the git log. It is in the first (most recent) match on 
"volume" on output.c. But that's not the problem. When you don't know 
something, you ask. You don't blindly push the change like Felix did.

> I currently do not understand why aout_VolumeSoftInit() sets the default
> volume,

What else can set the VLC software volume than VLC? If the audio HAL does not 
support volume, it is not going to provide an initial setting.

> but aout_VolumeHardInit() does not.

VLC cannot guess where the audio HAL stores the volume if the plugin does not 
set it.

> It seems like these should have the same behavior,

I don't see how that could work. If there was a uniform way to get the stream 
volume, there would be no volume abstraction in the first place.

> I've also been looking through the pulse source and the only place that I
> have seen the volume initialized is in sink_input_info_cb(). This seems
> strange to me because the PulseAudio documentation says that
> pa_context_get_sink_input_info() is only supposed to "Get some information
> about a sink input by its index."

I don't find it strange that getting the sink input infos returns the volume 
of that sink input.

> It does not seem like the volume should
> be initialized here, but that's just me.

Then where?

I think it is obvious but VLC should not override the master volume for the 
sink, and screw up other applications.

> Nonetheless, patch 0053 initializes the volume within the auhal module
> itself like the pulse module does,

That's not true. PulseAudio nicely requests the stream volume and leave it as 
is until the user hits the volume control. Auhal forces the volume brutally at 

> so it shouldn't affect anything else.

Sure, it only affects MacOS there.

Rémi Denis-Courmont

More information about the vlc-devel mailing list