From patchwork Mon Jun 11 21:31:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marton Balint X-Patchwork-Id: 9367 Delivered-To: ffmpegpatchwork@gmail.com Received: by 2002:a02:11c:0:0:0:0:0 with SMTP id c28-v6csp4636834jad; Mon, 11 Jun 2018 14:31:22 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJdo+Sg8C70VoAavT4djG1XsEY5g5YMbDDuCPxUWSEjgu+Clkicmr8tIBsGucVTVAS4WDQb X-Received: by 2002:a1c:9d49:: with SMTP id g70-v6mr388506wme.134.1528752682462; Mon, 11 Jun 2018 14:31:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528752682; cv=none; d=google.com; s=arc-20160816; b=Goxxvf14euUAKRJBhj535RwITeogVMSKfHb/1OwJj5FgDSy5OoaNSvsjA21NFzLexP LorUAwkSc1mtLF1oBgSCLSwptYLFZqFcUxWegs2FYUcNOJ3XgfQyraXvv6+59LU4gdoR xZKQRe+T/2jxcDqjRcYdo+rrl3cyxPWpThI1sWyLmfldR2MafyhvmVCG/hM4VFTGJN8a 2KjyXD5D0dfTtzq9NG4nu7e3oyBREGGNJ2hc0Q5gl5YlWsbjDsF26Nd2030vnHOVTC7v TaTzOuXKkL02IcquueMlWL+tPxsGobzM/JV95Nn94MgokIXXjYlG+OAPM1Ad4aKTPrSr EULA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence:subject :mime-version:user-agent:references:message-id:in-reply-to:to:from :date:delivered-to:arc-authentication-results; bh=HSqN4HbLTJ6LTfk+065a5w5maophVibexnTJL3KuOCg=; b=GQoQP8e3I2iKXtoWFN2P1y5xHmyxvbLmie1w6QDNA+HWhO4dImsUPCHizGljmfCwZF mt/TfZK0Ev4XSaP5eY6CmND6bQUj7FVNFHQ7e5/yhiHguQZLL83DjDq8ZTx6AFFRfZs6 IzPylyWXqGN6tCdSNwN12i5+q7oYoBgV11800Kw8ne4ksYteW0rAmonBLiPLa/DvfI3x HfBYz/DiQJRiadTX4pOAQW/jplqZDJS7yB9qJhRL/9y/9CmXHEs4yBPGNSPJVMeQLURs 3+Jj8U7AvVdiFN73A7L962s/sE2vAB2LgKIdxXY+uDns8Zz2vhvOAegLBcSkH8VVOwWC uflA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id o130-v6si6671856wma.172.2018.06.11.14.31.21; Mon, 11 Jun 2018 14:31:22 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 8FBDC68ADC3; Tue, 12 Jun 2018 00:30:30 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from iq.passwd.hu (iq.passwd.hu [217.27.212.140]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 4447268ADB4 for ; Tue, 12 Jun 2018 00:30:24 +0300 (EEST) Received: from localhost (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 8FFBEE0480 for ; Mon, 11 Jun 2018 23:31:13 +0200 (CEST) X-Virus-Scanned: amavisd-new at passwd.hu Received: from iq.passwd.hu ([127.0.0.1]) by localhost (iq.passwd.hu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id k-C14wpAMARo for ; Mon, 11 Jun 2018 23:31:12 +0200 (CEST) Received: from iq (iq [217.27.212.140]) by iq.passwd.hu (Postfix) with ESMTPS id 2C0CDE047F for ; Mon, 11 Jun 2018 23:31:12 +0200 (CEST) Date: Mon, 11 Jun 2018 23:31:12 +0200 (CEST) From: Marton Balint X-X-Sender: cus@iq To: FFmpeg development discussions and patches In-Reply-To: Message-ID: References: User-Agent: Alpine 2.20 (LSU 67 2015-01-07) MIME-Version: 1.0 Subject: Re: [FFmpeg-devel] [PATCH]ffplay: Don't crash if stream_cycle_channel() is called before initialization X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" On Mon, 11 Jun 2018, Carl Eugen Hoyos wrote: > Hi! > > Attached patch fixes a crash if SDL sends a keydown event before > stream and window initialization is finished, ticket #7252. Wow, current ffplay code assumes that no keypress or mouse events will come before the window is shown. Strange thing that SDL2 on IOS is forwarding input events even without a window... So in order to fix this more thoroughly, I suggest the attached patch instead. Supporting keypresses without a window (e.g. -nodisp mode) might be possible, but that requires bigger changes... Regards, Marton From 23ec72e867f3f25f422d6c1c7298cfcf79b4f113 Mon Sep 17 00:00:00 2001 From: Marton Balint Date: Mon, 11 Jun 2018 23:19:37 +0200 Subject: [PATCH] ffplay: ignore keypress events before a window is created Current ffplay code assumes that the read thread is in its main loop before any key events are captured, but apparently on IOS even keypresses without a window are forwared. Fixes ticket #7252. Signed-off-by: Marton Balint --- fftools/ffplay.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/fftools/ffplay.c b/fftools/ffplay.c index 84ba6673dc..55cea32cae 100644 --- a/fftools/ffplay.c +++ b/fftools/ffplay.c @@ -3251,15 +3251,14 @@ static void event_loop(VideoState *cur_stream) refresh_loop_wait_event(cur_stream, &event); switch (event.type) { case SDL_KEYDOWN: - if (exit_on_keydown) { + if (exit_on_keydown || event.key.keysym.sym == SDLK_ESCAPE || event.key.keysym.sym == SDLK_q) { do_exit(cur_stream); break; } + // If we don't yet have a window, skip all key events, because read_thread might still be initializing... + if (!cur_stream->width) + continue; switch (event.key.keysym.sym) { - case SDLK_ESCAPE: - case SDLK_q: - do_exit(cur_stream); - break; case SDLK_f: toggle_full_screen(cur_stream); cur_stream->force_refresh = 1; -- 2.16.4