[vlc-devel] [PATCH] aout: do not reset the instance volume to -1 on destroy

Steve Lhomme robux4 at ycbcr.xyz
Fri Jan 19 08:42:25 CET 2018


Le 18/01/2018 à 17:57, Rémi Denis-Courmont a écrit :
> Le torstaina 18. tammikuuta 2018, 10.22.11 EET Steve Lhomme a écrit :
>> Le 17/01/2018 à 19:06, Rémi Denis-Courmont a écrit :
>>> Le keskiviikkona 17. tammikuuta 2018, 18.53.04 EET Steve Lhomme a écrit :
>>>> There might be other modules started that have already set their proper
>>>> value.
>>> First, that wouldn´t actually fix the problem - the reported value is
>>> whatever
>> I'm not sure if you're referring to my code or the sentence in the
>> commit log. If it's for the code I can tell you it fixes that particular
>> issue.
> So what happens if the being-destroyed aout has updated the volume shortly
> before it got destroyed? You still end up with a garbage value at the input
> manager level. This patch only makes the problem less apparent, and thus much
> harder to debug going forward.
>
> If there is only one output at time, this patch has no effect other than
> leaving a stale volume value in the input manager.
>
>>> the last update of any aout was. It is not meaningful with more than one
>>> aout.
>>>
>>> And then, there cannot be more than one concurrent aout per input with the
>>> default ES output parameters.
>> During playback yes. But when switching aout that's not what the code does.
>>
>> In input/decoder.c there's a input_resource_GetAout() which creates the
>> new aout (sets the volume) and then a
>> input_resource_PutAout() (destroys the previous aout, resets the volume).
> input_resource_PutAout() does not destroy the aout. It just shelves it for
> later reuse by input_resource_GetAout() (unless there are two aouts, but that
> is broken anyway, as noted above).

Here is one call to `decoder_UpdateAudioFormat()` which successively 
calls `input_resource_GetAout()` which creates a new aout (aout_New), 
and then a call to `input_resource_PutAout()` which destroys the 
previous aout (aout_Destroy). In that order.

1   aout_New                  output.c     353  0x7ff87eb3a6ee
2   input_resource_GetAout    resource.c   348  0x7ff87eb2b66c
3   aout_update_format        decoder.c    364  0x7ff87eb0a90b
4   decoder_UpdateAudioFormat vlc_codec.h  381  0x7ff884fb15c3
5   OpenDecoder               spdif.c      81   0x7ff884fb1919
6   generic_start             modules.c    356  0x7ff87eaed111
7   module_load               modules.c    183  0x7ff87eaecb26
8   vlc_module_load           modules.c    279  0x7ff87eaece66
9   module_need               modules.c    371  0x7ff87eaed1a4
10  LoadDecoder               decoder.c    178  0x7ff87eb0a18a
11  CreateDecoder             decoder.c    1747 0x7ff87eb0dfdd
12  decoder_New               decoder.c    1908 0x7ff87eb0e6cd
13  input_DecoderNew          decoder.c    1956 0x7ff87eb0e8dc
14  EsCreateDecoder           es_out.c     1684 0x7ff87eb16292
15  EsSelect                  es_out.c     1772 0x7ff87eb166c8
16  EsOutSelect               es_out.c     1870 0x7ff87eb16a78
17  EsOutControlLocked        es_out.c     2349 0x7ff87eb180b1
18  EsOutControl              es_out.c     2859 0x7ff87eb194c2
19  es_out_vaControl          vlc_es_out.h 143  0x7ff87eb11aad
20  es_out_Control            vlc_es_out.h 152  0x7ff87eb11af8
... <plus>


1   aout_Destroy              output.c     364  0x7ff87eb3a732
2   input_resource_PutAout    resource.c   386  0x7ff87eb2b891
3   aout_update_format        decoder.c    376  0x7ff87eb0a989
4   decoder_UpdateAudioFormat vlc_codec.h  381  0x7ff884fb15c3
5   OpenDecoder               spdif.c      81   0x7ff884fb1919
6   generic_start             modules.c    356  0x7ff87eaed111
7   module_load               modules.c    183  0x7ff87eaecb26
8   vlc_module_load           modules.c    279  0x7ff87eaece66
9   module_need               modules.c    371  0x7ff87eaed1a4
10  LoadDecoder               decoder.c    178  0x7ff87eb0a18a
11  CreateDecoder             decoder.c    1747 0x7ff87eb0dfdd
12  decoder_New               decoder.c    1908 0x7ff87eb0e6cd
13  input_DecoderNew          decoder.c    1956 0x7ff87eb0e8dc
14  EsCreateDecoder           es_out.c     1684 0x7ff87eb16292
15  EsSelect                  es_out.c     1772 0x7ff87eb166c8
16  EsOutSelect               es_out.c     1870 0x7ff87eb16a78
17  EsOutControlLocked        es_out.c     2349 0x7ff87eb180b1
18  EsOutControl              es_out.c     2859 0x7ff87eb194c2
19  es_out_vaControl          vlc_es_out.h 143  0x7ff87eb11aad
20  es_out_Control            vlc_es_out.h 152  0x7ff87eb11af8
... <plus>

> Also, as far as I am aware, and as far as I can read the code, it releases the
> audio output before it gets it back. But even if that´s not the case, I don't
> see how this patch can solve the problem.

That's clearly not what the code does. So maybe try the code and you 
will see for yourself.

You need a file with multiple audio and switch the audio track.
https://trac.videolan.org/vlc/ticket/19206#comment:11

>
> You simply cannot expect a single value at input or input manager level to
> represent the state of more than one non-synchronized children.
>



More information about the vlc-devel mailing list