[vlc-commits] display: balance format init/clean

Rémi Denis-Courmont git at videolan.org
Thu Dec 20 19:42:48 CET 2018


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Wed Dec 19 22:10:50 2018 +0200| [d76d1a6d5802309376a4c41dd865fd49e4c9d7f9] | committer: Rémi Denis-Courmont

display: balance format init/clean

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=d76d1a6d5802309376a4c41dd865fd49e4c9d7f9
---

 src/video_output/display.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/video_output/display.c b/src/video_output/display.c
index f8a70c83a0..0c0a566eed 100644
--- a/src/video_output/display.c
+++ b/src/video_output/display.c
@@ -77,12 +77,14 @@ static int vout_display_start(void *func, va_list ap)
     video_format_t *fmtp = va_arg(ap, video_format_t *);
     vlc_video_context *context = va_arg(ap, vlc_video_context *);
 
-    video_format_Clean(fmtp);
     video_format_Copy(fmtp, &vd->source);
     fmtp->i_sar_num = 0;
     fmtp->i_sar_den = 0;
 
-    return activate(vd, cfg, fmtp, context);
+    int ret = activate(vd, cfg, fmtp, context);
+    if (ret != VLC_SUCCESS)
+        video_format_Clean(fmtp);
+    return ret;
 }
 
 /**
@@ -99,7 +101,6 @@ static vout_display_t *vout_display_New(vlc_object_t *obj,
 
     /* */
     video_format_Copy(&vd->source, fmt);
-    video_format_Init(&vd->fmt, 0);
 
     /* Picture buffer does not have the concept of aspect ratio */
 
@@ -130,6 +131,7 @@ static vout_display_t *vout_display_New(vlc_object_t *obj,
         vout_window_SetSize(cfg->window,
                             cfg->display.width, cfg->display.height);
     } else {
+        video_format_Copy(&vd->fmt, &vd->source);
         vd->module = NULL;
     }
 



More information about the vlc-commits mailing list