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

Jon Stacey jon at jonsview.com
Thu Mar 8 00:24:53 CET 2012


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

I had already seen that and it does not answer any of my questions. Is there documentation which describes the overarching VLC internals in this area? I have not found anything coherent through my searches [see below]. What little documentation I have seen is quite honestly poor. However, since you have written/touched major chunks of the code in question, you are in a position to provide great insight directly.

>> 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.

My thinking is this: as you said VLC does not know where the volume is stored if the plugin does not set it. That is the purpose of the volume abstraction here. That is why I am saying that it seems strange that VLC is not telling the audio plugin to set the volume initially once being told where volume is. In other words, aout_VolumeSoftInit() calls aout_VolumeSoftSet(), so it *seems* like aout_VolumeHardInit() should be telling the audio module what volume to use as specified by the user through VLC.

Now we come to the crux of the problem. It appears that the opposite behavior is in play here. The audio plugin is telling VLC what the volume is. This is not well documented, and there is a missing piece of the puzzle which I have been unable to find: what is telling pulseaudio what the initial starting volume is? Is it the stream? Who knows, nothing says, and I didn't write that code. You hint at the stream [see below], but where is that set, and how do I access it? Where is the documentation on that object?

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


I suppose all of this is leading to a root question: where/what is telling pulseaudio what volume to initialize to at start? Is VolumeSet() in pulse.c called on initialization? It was not called for me in auhal.c after using aout_VolumeHardInit(), so that leads me to this: if the pf_volume_set() function is not called, then where is the input sink in pulseaudio getting its initial volume from?

> 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 
> startup.

Where is the stream volume being initialized then? VLC? If so, where is that happening? How do I access it? Where is the documentation?

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

VLC should be the one initializing because it is the user that is setting the volume through VLC. Even when the volume is remembered from last start, or set by preferences to start at a certain level, it is still the user through VLC telling the audio output what volume to use. Not the other way around.

I look forward to your insight. I am not intimately familiar with this codebase and my end goal is simply to squash a very annoying behavior that I [and many others] did not like in the behavior of VLC from an end user perspective. Obviously I would like to do this the "right" way, but I lack the information to do that right now, but you can help.

Jon




More information about the vlc-devel mailing list