[vlc-commits] vout: check if reinit needed first

Rémi Denis-Courmont git at videolan.org
Sat Jan 26 19:51:28 CET 2019


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Jan 26 17:33:26 2019 +0200| [296be5f256798dc7fc320e954849d8ca21416d95] | committer: Rémi Denis-Courmont

vout: check if reinit needed first

Instead of systematically reinitializing the vout thread, check if it
needs to be reinitialized and only do so if necessary.

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

 src/video_output/video_output.c | 33 +++++++++++++++++----------------
 1 file changed, 17 insertions(+), 16 deletions(-)

diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index ee3f69bbb5..cb2eb688c7 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -352,6 +352,22 @@ vout_thread_t *vout_Request(vlc_object_t *object,
 
     /* If a vout is provided, try reusing it */
     if (vout) {
+        video_format_t original;
+
+        VoutFixFormat(&original, cfg->fmt);
+
+        /* TODO: If dimensions are equal or slightly smaller, update the aspect
+         * ratio and crop settings, instead of recreating a display.
+         */
+        if (video_format_IsSimilar(&original, &vout->p->original)) {
+            if (cfg->dpb_size <= vout->p->dpb_size) {
+                video_format_Clean(&original);
+                /* It is assumed that the SPU input matches input already. */
+                return vout;
+            }
+            msg_Warn(vout, "DPB need to be increased");
+        }
+
         vout_control_cmd_t cmd;
 
         vout_control_cmd_Init(&cmd, VOUT_CONTROL_REINIT);
@@ -1721,8 +1737,6 @@ static void ThreadStop(vout_thread_t *vout)
 static int ThreadReinit(vout_thread_t *vout,
                         const vout_configuration_t *cfg)
 {
-    video_format_t original;
-
     if (!cfg->fmt)
     {
         vout->p->mouse_event = NULL;
@@ -1736,19 +1750,6 @@ static int ThreadReinit(vout_thread_t *vout,
     vout->p->pause.is_on = false;
     vout->p->pause.date  = VLC_TICK_INVALID;
 
-    VoutFixFormat(&original, cfg->fmt);
-
-    /* TODO: If dimensions are equal or slightly smaller, update the aspect
-     * ratio and crop settings, instead of recreating a display.
-     */
-    if (video_format_IsSimilar(&original, &vout->p->original)) {
-        if (cfg->dpb_size <= vout->p->dpb_size) {
-            video_format_Clean(&original);
-            return VLC_SUCCESS;
-        }
-        msg_Warn(vout, "DPB need to be increased");
-    }
-
     vout_display_cfg_t dcfg;
 
     ThreadStop(vout);
@@ -1767,7 +1768,7 @@ static int ThreadReinit(vout_thread_t *vout,
     vlc_mutex_unlock(&vout->p->window_lock);
 
     video_format_Clean(&vout->p->original);
-    vout->p->original = original;
+    VoutFixFormat(&vout->p->original, cfg->fmt);
     vout->p->dpb_size = cfg->dpb_size;
     if (ThreadStart(vout, &dcfg))
         return VLC_EGENERIC;



More information about the vlc-commits mailing list