Re: [FFmpeg-devel] [PATCH]ffplay: Don't crash if stream_cycle_channel() is called before initialization
2018-06-20 22:43 GMT+02:00, Marton Balint : > > > On Mon, 11 Jun 2018, Marton Balint wrote: > >> >> >> 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... > > Pushed. Thank you! Carl Eugen ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH]ffplay: Don't crash if stream_cycle_channel() is called before initialization
On Mon, 11 Jun 2018, Marton Balint wrote: 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... Pushed. Regards, Marton ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH]ffplay: Don't crash if stream_cycle_channel() is called before initialization
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, MartonFrom 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, ); 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 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH]ffplay: Don't crash if stream_cycle_channel() is called before initialization
Hi! Attached patch fixes a crash if SDL sends a keydown event before stream and window initialization is finished, ticket #7252. Please comment, Carl Eugen From 43324194a81f1f33150fefac6336285ab95eb14f Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos Date: Mon, 11 Jun 2018 01:44:24 +0200 Subject: [PATCH] ffplay: Don't crash if stream_cycle_channel() is called before initialization. SDL may send a keydown event before stream (and window) initialization is finished. Fixes ticket #7252. --- fftools/ffplay.c |6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/fftools/ffplay.c b/fftools/ffplay.c index 84ba667..5ace5cd 100644 --- a/fftools/ffplay.c +++ b/fftools/ffplay.c @@ -3106,7 +3106,11 @@ static void stream_cycle_channel(VideoState *is, int codec_type) int old_index; AVStream *st; AVProgram *p = NULL; -int nb_streams = is->ic->nb_streams; +int nb_streams; + +if (!is->ic) +return; +nb_streams = is->ic->nb_streams; if (codec_type == AVMEDIA_TYPE_VIDEO) { start_index = is->last_video_stream; -- 1.7.10.4 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel