[FFmpeg-devel] [PATCH] fftools/ffplay: do not write out of rdft visualization texture

Marton Balint cus at passwd.hu
Mon Mar 8 22:56:38 EET 2021



On Sun, 7 Mar 2021, Michael Niedermayer wrote:

> On Wed, Mar 03, 2021 at 11:27:22PM +0100, Marton Balint wrote:
>> 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.
>
> reading this, i wonder if a assertion with xleft == 0 would make sense

I don't really see the point. I'd rather add the xleft/ytop to the render 
if you prefer, but overall I don't think it matters.

--- a/fftools/ffplay.c
+++ b/fftools/ffplay.c
@@ -1193,7 +1193,8 @@ static void video_audio_display(VideoState *s)
                  }
                  SDL_UnlockTexture(s->vis_texture);
              }
-            SDL_RenderCopy(renderer, s->vis_texture, NULL, NULL);
+            rect = (SDL_Rect){s->xleft, s->ytop, s->width, s->height};
+            SDL_RenderCopy(renderer, s->vis_texture, NULL, &rect);
          }
          if (!s->paused)
              s->xpos++;

Regards,
Marton


More information about the ffmpeg-devel mailing list