diff options
author | Marton Balint <cus@passwd.hu> | 2021-03-03 23:23:10 +0100 |
---|---|---|
committer | Marton Balint <cus@passwd.hu> | 2021-03-28 01:14:33 +0100 |
commit | 4bbcaf75595425292e1ac23f8c99dbd8f7b9f9bc (patch) | |
tree | a1d81a312ecfe1cc4de43f0816c1f9f5da18b034 | |
parent | 4383b9e8a325a63b4b50022abc68122e6bab9462 (diff) | |
download | ffmpeg-4bbcaf75595425292e1ac23f8c99dbd8f7b9f9bc.tar.gz |
fftools/ffplay: do not write out of rdft visualization texture
If the window is resized it was possible that xpos pointed outside the
visualization texture. By rearranging the overflow check we make sure this (and
a crash) does not happen.
We also don't have to use xleft for start position, as that is 0 anyways, and
if we ever want to take into account xleft then the texture should be
positioned accordingly when rendering.
Signed-off-by: Marton Balint <cus@passwd.hu>
(cherry picked from commit 573f05a7533cd9aed3ed895b4fa4ad8fcba4e56a)
-rw-r--r-- | fftools/ffplay.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/fftools/ffplay.c b/fftools/ffplay.c index d673b8049a..41339b30e3 100644 --- a/fftools/ffplay.c +++ b/fftools/ffplay.c @@ -1151,6 +1151,8 @@ static void video_audio_display(VideoState *s) if (realloc_texture(&s->vis_texture, SDL_PIXELFORMAT_ARGB8888, s->width, s->height, SDL_BLENDMODE_NONE, 1) < 0) return; + if (s->xpos >= s->width) + s->xpos = 0; nb_display_channels= FFMIN(nb_display_channels, 2); if (rdft_bits != s->rdft_bits) { av_rdft_end(s->rdft); @@ -1200,8 +1202,6 @@ static void video_audio_display(VideoState *s) } if (!s->paused) s->xpos++; - if (s->xpos >= s->width) - s->xpos= s->xleft; } } |