[vlc-commits] vout: gather window locking/unlocking
Rémi Denis-Courmont
git at videolan.org
Fri Jun 14 05:31:15 CEST 2019
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Wed Jun 12 18:49:41 2019 +0300| [4563df98a188f4276d2529484d1b3f3dafb9182b] | committer: Rémi Denis-Courmont
vout: gather window locking/unlocking
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=4563df98a188f4276d2529484d1b3f3dafb9182b
---
src/video_output/video_output.c | 36 +++++++++++++++++-------------------
1 file changed, 17 insertions(+), 19 deletions(-)
diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index 131eb593d1..8605a752cb 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -1448,26 +1448,12 @@ static int vout_Start(vout_thread_t *vout, const vout_configuration_t *cfg)
sys->filter.chain_interactive = filter_chain_NewVideo(vout, true, &owner);
vout_display_cfg_t dcfg;
+ int x = 0, y = 0, w = 0, h = 0;
+ unsigned num, den;
vlc_mutex_lock(&sys->window_lock);
dcfg = sys->display_cfg;
- /* Any configuration change after unlocking will involve a control request
- * that will be processed in the new thread. There may also be some pending
- * control requests for configuration change already visible in
- * sys->display_cfg, leading to processing of extra harmless and useless
- * control request processing.
- *
- * TODO: display lock separate from window lock.
- */
- vlc_mutex_unlock(&sys->window_lock);
-
- if (vout_OpenWrapper(vout, sys->splitter_name, &dcfg))
- goto error;
- unsigned num = 0, den = 0;
- int x = 0, y = 0, w = 0, h = 0;
-
- vlc_mutex_lock(&sys->window_lock); /* see above */
switch (sys->source.crop.mode) {
case VOUT_CROP_NONE:
break;
@@ -1488,13 +1474,25 @@ static int vout_Start(vout_thread_t *vout, const vout_configuration_t *cfg)
h = -(int)sys->source.crop.border.bottom;
break;
}
- vlc_mutex_unlock(&sys->window_lock);
- vout_SetDisplayCrop(sys->display, num, den, x, y, w, h);
- vlc_mutex_lock(&sys->window_lock); /* see above */
num = sys->source.dar.num;
den = sys->source.dar.den;
+ /*
+ * Any configuration change after unlocking will involve a control request
+ * that will be processed in the new thread. There may also be some pending
+ * control requests for configuration change already visible in
+ * sys->display_cfg, leading to processing of extra harmless and useless
+ * control request processing.
+ *
+ * TODO: display lock separate from window lock.
+ */
vlc_mutex_unlock(&sys->window_lock);
+
+ if (vout_OpenWrapper(vout, sys->splitter_name, &dcfg))
+ goto error;
+
+ vout_SetDisplayCrop(sys->display, num, den, x, y, w, h);
+
if (num != 0 && den != 0)
vout_SetDisplayAspect(sys->display, num, den);
More information about the vlc-commits
mailing list