[vlc-devel] [PATCH 10/18] spdif: reset the ES to AUDIO_ES on error
Steve Lhomme
robux4 at gmail.com
Sun Jul 9 08:27:26 CEST 2017
On Fri, Jul 7, 2017 at 7:15 PM, Rémi Denis-Courmont <remi at remlab.net> wrote:
> Le keskiviikkona 5. heinäkuuta 2017, 17.00.24 EEST Steve Lhomme a écrit :
>> rather than UNKNOWN_ES
>> ---
>> modules/codec/spdif.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/modules/codec/spdif.c b/modules/codec/spdif.c
>> index db25526781..50e4d4d58e 100644
>> --- a/modules/codec/spdif.c
>> +++ b/modules/codec/spdif.c
>> @@ -80,7 +80,7 @@ OpenDecoder(vlc_object_t *p_this)
>>
>> if (decoder_UpdateAudioFormat(p_dec))
>> {
>> - es_format_Init(&p_dec->fmt_out, UNKNOWN_ES, 0);
>> + es_format_Init(&p_dec->fmt_out, AUDIO_ES, 0);
>> return VLC_EGENERIC;
>> }
>
> Usually, the policy for read/write members of probed object is either:
> - default value on entry, writeable only on success
> (e.g. callback function pointers), or
> - undefined on entry, always writeable (e.g. sys/p_sys).
>
> Ideally, we shouldn´t need a third policy here, so this should be the second
> policy. But if that fails, common initialization in vlc_module_load() callback
> is probably the least insane option.
I agree. A lot of code is currently overwriting the output format and
resetting it after probe. All this code should be cleaned. But that's
for another set of patch.
(re)Initializing an ES with the wrong category is potentially
dangerous (it is for video). The following code might use the wrong
part of the union or uninitialized values.
> --
> 雷米‧德尼-库尔蒙
> https://www.remlab.net/
>
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel
More information about the vlc-devel
mailing list