[FFmpeg-devel] [PATCH] ffplay: log possible error of SDL_EnableKeyRepeat

wm4 nfxjfg at googlemail.com
Fri Oct 9 10:21:59 CEST 2015


On Thu,  8 Oct 2015 18:46:44 -0400
Ganesh Ajjanagadde <gajjanagadde at gmail.com> wrote:

> Note that for the current SDL source code, 0 is always returned.
> Nevertheless, this makes the code more robust.
> 
> Signed-off-by: Ganesh Ajjanagadde <gajjanagadde at gmail.com>
> ---
>  ffplay.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/ffplay.c b/ffplay.c
> index 79f430d..c143e96 100644
> --- a/ffplay.c
> +++ b/ffplay.c
> @@ -3814,7 +3814,8 @@ int main(int argc, char **argv)
>      SDL_EventState(SDL_SYSWMEVENT, SDL_IGNORE);
>      SDL_EventState(SDL_USEREVENT, SDL_IGNORE);
>  
> -    SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL);
> +    if (SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL) < 0)
> +        av_log(NULL, AV_LOG_ERROR, "SDL_EnableKeyRepeat(): %s\n", SDL_GetError());
>  
>      if (av_lockmgr_register(lockmgr)) {
>          av_log(NULL, AV_LOG_FATAL, "Could not initialize lock manager!\n");

How does this make the code more "robust"?


More information about the ffmpeg-devel mailing list