History

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.

Marton Balint committed 5 years ago

Commit 573f05a1 parent a7425f71 file · +2 −2Browse files

Unified · Split

fftools/ffplay.c+2−2
@@ -1148,6 +1148,8 @@ static void video_audio_display(VideoState *s) · 1147 unmodified lines
1148 if (realloc_texture(&s->vis_texture, SDL_PIXELFORMAT_ARGB8888, s->width, s->height, SDL_BLENDMODE_NONE, 1) < 0)1148 if (realloc_texture(&s->vis_texture, SDL_PIXELFORMAT_ARGB8888, s->width, s->height, SDL_BLENDMODE_NONE, 1) < 0)
1149 return;1149 return;
1150 1150
1151 if (s->xpos >= s->width)
1152 s->xpos = 0;
1151 nb_display_channels= FFMIN(nb_display_channels, 2);1153 nb_display_channels= FFMIN(nb_display_channels, 2);
1152 if (rdft_bits != s->rdft_bits) {1154 if (rdft_bits != s->rdft_bits) {
1153 av_rdft_end(s->rdft);1155 av_rdft_end(s->rdft);
@@ -1197,8 +1199,6 @@ static void video_audio_display(VideoState *s) · 43 unmodified lines
1197 }1199 }
1198 if (!s->paused)1200 if (!s->paused)
1199 s->xpos++;1201 s->xpos++;
1200 if (s->xpos >= s->width)
1201 s->xpos= s->xleft;
1202 }1202 }
1203}1203}
1204 1204

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t