[vlc-commits] vout: set zoom synchronously
Rémi Denis-Courmont
git at videolan.org
Fri Jun 14 05:31:20 CEST 2019
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Wed Jun 12 19:34:50 2019 +0300| [b7fce97f71fa2ee68d04deceedde7895868b61f3] | committer: Rémi Denis-Courmont
vout: set zoom synchronously
This fixes an ABBA race if two threads set the factor simultaneously.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=b7fce97f71fa2ee68d04deceedde7895868b61f3
---
src/video_output/control.h | 1 -
src/video_output/video_output.c | 12 +++++-------
2 files changed, 5 insertions(+), 8 deletions(-)
diff --git a/src/video_output/control.h b/src/video_output/control.h
index a384afa2c6..087c3f9820 100644
--- a/src/video_output/control.h
+++ b/src/video_output/control.h
@@ -32,7 +32,6 @@ enum {
VOUT_CONTROL_MOUSE_STATE, /* vlc_mouse_t */
VOUT_CONTROL_DISPLAY_SIZE, /* window */
- VOUT_CONTROL_ZOOM, /* pair */
VOUT_CONTROL_ASPECT_RATIO, /* pair */
VOUT_CONTROL_CROP_BORDER, /* border */
diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index c8e436493e..e722cf09d3 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -467,10 +467,13 @@ void vout_ChangeZoom(vout_thread_t *vout, unsigned num, unsigned den)
sys->display_cfg.zoom.den = den;
vout_UpdateWindowSizeLocked(vout);
+
+ vlc_mutex_lock(&sys->display_lock);
vlc_mutex_unlock(&sys->window_lock);
- vout_control_PushPair(&vout->p->control, VOUT_CONTROL_ZOOM,
- num, den);
+ if (sys->display != NULL)
+ vout_SetDisplayZoom(sys->display, num, den);
+ vlc_mutex_unlock(&sys->display_lock);
}
void vout_ChangeDisplayAspectRatio(vout_thread_t *vout,
@@ -1576,11 +1579,6 @@ static void ThreadControl(vout_thread_t *vout, vout_control_cmd_t cmd)
cmd.window.width, cmd.window.height);
vlc_mutex_unlock(&vout->p->display_lock);
break;
- case VOUT_CONTROL_ZOOM:
- vlc_mutex_lock(&vout->p->display_lock);
- vout_SetDisplayZoom(vout->p->display, cmd.pair.a, cmd.pair.b);
- vlc_mutex_unlock(&vout->p->display_lock);
- break;
case VOUT_CONTROL_ASPECT_RATIO:
vlc_mutex_lock(&vout->p->display_lock);
vout_SetDisplayAspect(vout->p->display, cmd.pair.a, cmd.pair.b);
More information about the vlc-commits
mailing list