[vlc-devel] [PATCH 1/3] video_output: move the src_fmt/src_vctx init up when filters change

Steve Lhomme robux4 at ycbcr.xyz
Mon Dec 2 14:45:22 CET 2019


No functional change.

Either source is set and was set in vout->p->filter.src_fmt or
vout->p->filter.src_fmt was used regardless.
Same thing with the source video context.
---
 src/video_output/video_output.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index ee7e54072a2..2f024ceead3 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -812,6 +812,14 @@ static void ThreadChangeFilters(vout_thread_t *vout,
     if (!is_locked)
         vlc_mutex_lock(&vout->p->filter.lock);
 
+    if (source) {
+        video_format_Clean(&vout->p->filter.src_fmt);
+        video_format_Copy(&vout->p->filter.src_fmt, source);
+        if (vout->p->filter.src_vctx)
+            vlc_video_context_Release(vout->p->filter.src_vctx);
+        vout->p->filter.src_vctx = src_vctx ? vlc_video_context_Hold(src_vctx) : NULL;
+    }
+
     es_format_t fmt_target;
     es_format_InitFromVideo(&fmt_target, source ? source : &vout->p->filter.src_fmt);
     vlc_video_context *vctx_target   = source ? src_vctx : vout->p->filter.src_vctx;
@@ -867,13 +875,6 @@ static void ThreadChangeFilters(vout_thread_t *vout,
         free(vout->p->filter.configuration);
         vout->p->filter.configuration = filters ? strdup(filters) : NULL;
     }
-    if (source) {
-        video_format_Clean(&vout->p->filter.src_fmt);
-        video_format_Copy(&vout->p->filter.src_fmt, source);
-        if (vout->p->filter.src_vctx)
-            vlc_video_context_Release(vout->p->filter.src_vctx);
-        vout->p->filter.src_vctx = src_vctx ? vlc_video_context_Hold(src_vctx) : NULL;
-    }
 
     if (!is_locked)
         vlc_mutex_unlock(&vout->p->filter.lock);
-- 
2.17.1



More information about the vlc-devel mailing list