[vlc-commits] vout: set crop ratio synchronously
Rémi Denis-Courmont
git at videolan.org
Fri Jun 14 05:31:23 CEST 2019
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Wed Jun 12 19:34:50 2019 +0300| [b820a3ccb7026ce8a887e1d1f301c9fe16f0d634] | committer: Rémi Denis-Courmont
vout: set crop ratio synchronously
This fixes an ABBA race if two threads set crop settings simultaneously.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=b820a3ccb7026ce8a887e1d1f301c9fe16f0d634
---
src/video_output/control.h | 1 -
src/video_output/video_output.c | 13 +++++--------
2 files changed, 5 insertions(+), 9 deletions(-)
diff --git a/src/video_output/control.h b/src/video_output/control.h
index a7568ceec5..d24784bd6a 100644
--- a/src/video_output/control.h
+++ b/src/video_output/control.h
@@ -34,7 +34,6 @@ enum {
VOUT_CONTROL_DISPLAY_SIZE, /* window */
VOUT_CONTROL_CROP_BORDER, /* border */
- VOUT_CONTROL_CROP_RATIO, /* pair */
VOUT_CONTROL_CROP_WINDOW, /* window */
VOUT_CONTROL_VIEWPOINT, /* viewpoint */
};
diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index c97d549db1..ad0b975aa7 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -510,10 +510,13 @@ void vout_ChangeCropRatio(vout_thread_t *vout, unsigned num, unsigned den)
sys->source.crop.mode = VOUT_CROP_NONE;
vout_UpdateWindowSizeLocked(vout);
+
+ vlc_mutex_lock(&sys->display_lock);
vlc_mutex_unlock(&sys->window_lock);
- vout_control_PushPair(&vout->p->control, VOUT_CONTROL_CROP_RATIO,
- num, den);
+ if (sys->display != NULL)
+ vout_SetDisplayCrop(sys->display, num, den, 0, 0, 0, 0);
+ vlc_mutex_unlock(&sys->display_lock);
}
void vout_ChangeCropWindow(vout_thread_t *vout,
@@ -1582,12 +1585,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_CROP_RATIO:
- vlc_mutex_lock(&vout->p->display_lock);
- vout_SetDisplayCrop(vout->p->display, cmd.pair.a, cmd.pair.b,
- 0, 0, 0, 0);
- vlc_mutex_unlock(&vout->p->display_lock);
- break;
case VOUT_CONTROL_CROP_WINDOW:
vlc_mutex_lock(&vout->p->display_lock);
vout_SetDisplayCrop(vout->p->display, 0, 0,
More information about the vlc-commits
mailing list