[vlc-devel] [PATCH 5/9] video_output: separate the error logs and return in vout_Request

Steve Lhomme robux4 at ycbcr.xyz
Fri Oct 11 08:52:44 CEST 2019


On 2019-10-10 17:37, Thomas Guillem wrote:
> 
> 
> On Thu, Oct 10, 2019, at 16:27, Steve Lhomme wrote:
>> vout_Stop already clean sys->original, so no need to do it again.
>> ---
>>   src/video_output/video_output.c | 12 +++++++-----
>>   1 file changed, 7 insertions(+), 5 deletions(-)
>>
>> diff --git a/src/video_output/video_output.c
>> b/src/video_output/video_output.c
>> index 7dad8278db7..7e0df907e19 100644
>> --- a/src/video_output/video_output.c
>> +++ b/src/video_output/video_output.c
>> @@ -1986,7 +1986,8 @@ int vout_Request(const vout_configuration_t *cfg,
>> input_thread_t *input)
>>   
>>           if (vout_window_Enable(sys->display_cfg.window, &wcfg)) {
>>               vlc_mutex_unlock(&sys->window_lock);
>> -            goto error;
>> +            video_format_Clean(&sys->original);
>> +            return -1;
> 
> I think you should log that the window can't be enabled.

It's done in a further patch but I can move it here.

>>           }
>>           sys->window_enabled = true;
>>       } else
>> @@ -2001,17 +2002,18 @@ int vout_Request(const vout_configuration_t
>> *cfg, input_thread_t *input)
>>   
>>       if (vout_Start(vout, cfg))
>>       {
>> +        msg_Err(vout, "video output display creation failed");
>> +        video_format_Clean(&sys->original);
>> +
>>           vlc_mutex_lock(&sys->window_lock);
>>           vout_window_Disable(sys->display_cfg.window);
>>           sys->window_enabled = false;
>>           vlc_mutex_unlock(&sys->window_lock);
>> -        goto error;
>> +        return -1;
>>       }
>>       if (vlc_clone(&sys->thread, Thread, vout, VLC_THREAD_PRIORITY_OUTPUT)) {
>> +        msg_Err(vout, "video output thread creation failed");
> 
> Like small malloc, you don't need to log clone error. It is *very* unlikely to happen, never saw one personally.
> 
>>           vout_Stop(vout);
>> -error:
>> -        msg_Err(vout, "video output creation failed");
>> -        video_format_Clean(&sys->original);
>>           return -1;
>>       }
>>   
>> -- 
>> 2.17.1
>>
>> _______________________________________________
>> vlc-devel mailing list
>> To unsubscribe or modify your subscription options:
>> https://mailman.videolan.org/listinfo/vlc-devel
> _______________________________________________
> 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