lavd/opengl_enc: fix window size correction code
authorLukasz Marek <lukasz.m.luki2@gmail.com>
Thu, 1 May 2014 22:28:27 +0000 (00:28 +0200)
committerLukasz Marek <lukasz.m.luki2@gmail.com>
Fri, 2 May 2014 16:04:05 +0000 (18:04 +0200)
Signed-off-by: Lukasz Marek <lukasz.m.luki2@gmail.com>
libavdevice/opengl_enc.c

index cbd0b3a..28a0118 100644 (file)
@@ -872,8 +872,8 @@ static av_cold int opengl_prepare_vertex(AVFormatContext *s)
     int tex_w, tex_h;
 
     if (opengl->window_width > opengl->max_viewport_width || opengl->window_height > opengl->max_viewport_height) {
-        opengl->window_width = FFMAX(opengl->window_width, opengl->max_viewport_width);
-        opengl->window_height = FFMAX(opengl->window_height, opengl->max_viewport_height);
+        opengl->window_width = FFMIN(opengl->window_width, opengl->max_viewport_width);
+        opengl->window_height = FFMIN(opengl->window_height, opengl->max_viewport_height);
         av_log(opengl, AV_LOG_WARNING, "Too big viewport requested, limited to %dx%d", opengl->window_width, opengl->window_height);
     }
     glViewport(0, 0, opengl->window_width, opengl->window_height);