[vlc-devel] [PATCH V2 01/17] vout: don't call window operation when disabled
Thomas Guillem
thomas at gllm.fr
Tue Apr 16 16:25:11 CEST 2019
---
src/video_output/video_output.c | 49 +++++++++++++++++++++++++++++----
1 file changed, 43 insertions(+), 6 deletions(-)
diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index 5681acb9aa..7a784bc317 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -368,23 +368,28 @@ int vout_GetSnapshot(vout_thread_t *vout,
void vout_ChangeFullscreen(vout_thread_t *vout, const char *id)
{
vlc_mutex_lock(&vout->p->window_lock);
- vout_window_SetFullScreen(vout->p->display_cfg.window, id);
+ if (likely(vout->p->window_active))
+ vout_window_SetFullScreen(vout->p->display_cfg.window, id);
vlc_mutex_unlock(&vout->p->window_lock);
}
void vout_ChangeWindowed(vout_thread_t *vout)
{
vlc_mutex_lock(&vout->p->window_lock);
- vout_window_UnsetFullScreen(vout->p->display_cfg.window);
- /* Attempt to reset the intended window size */
- vout_UpdateWindowSize(vout);
+ if (likely(vout->p->window_active))
+ {
+ vout_window_UnsetFullScreen(vout->p->display_cfg.window);
+ /* Attempt to reset the intended window size */
+ vout_UpdateWindowSize(vout);
+ }
vlc_mutex_unlock(&vout->p->window_lock);
}
void vout_ChangeWindowState(vout_thread_t *vout, unsigned st)
{
vlc_mutex_lock(&vout->p->window_lock);
- vout_window_SetState(vout->p->display_cfg.window, st);
+ if (likely(vout->p->window_active))
+ vout_window_SetState(vout->p->display_cfg.window, st);
vlc_mutex_unlock(&vout->p->window_lock);
}
@@ -435,6 +440,12 @@ void vout_ChangeZoom(vout_thread_t *vout, unsigned num, unsigned den)
}
vlc_mutex_lock(&sys->window_lock);
+ if (unlikely(!sys->window_active))
+ {
+ vlc_mutex_unlock(&sys->window_lock);
+ return;
+ }
+
sys->display_cfg.zoom.num = num;
sys->display_cfg.zoom.den = den;
@@ -451,6 +462,11 @@ void vout_ChangeSampleAspectRatio(vout_thread_t *vout,
vout_thread_sys_t *sys = vout->p;
vlc_mutex_lock(&sys->window_lock);
+ if (unlikely(!sys->window_active))
+ {
+ vlc_mutex_unlock(&sys->window_lock);
+ return;
+ }
sys->source.dar.num = num;
sys->source.dar.den = den;
@@ -466,6 +482,11 @@ void vout_ChangeCropRatio(vout_thread_t *vout, unsigned num, unsigned den)
vout_thread_sys_t *sys = vout->p;
vlc_mutex_lock(&sys->window_lock);
+ if (unlikely(!sys->window_active))
+ {
+ vlc_mutex_unlock(&sys->window_lock);
+ return;
+ }
if (num != 0 && den != 0) {
sys->source.crop.mode = VOUT_CROP_RATIO;
sys->source.crop.ratio.num = num;
@@ -496,6 +517,11 @@ void vout_ChangeCropWindow(vout_thread_t *vout,
height = 0;
vlc_mutex_lock(&sys->window_lock);
+ if (unlikely(!sys->window_active))
+ {
+ vlc_mutex_unlock(&sys->window_lock);
+ return;
+ }
sys->source.crop.mode = VOUT_CROP_WINDOW;
sys->source.crop.window.x = x;
sys->source.crop.window.y = y;
@@ -529,6 +555,11 @@ void vout_ChangeCropBorder(vout_thread_t *vout,
bottom = 0;
vlc_mutex_lock(&sys->window_lock);
+ if (unlikely(!sys->window_active))
+ {
+ vlc_mutex_unlock(&sys->window_lock);
+ return;
+ }
sys->source.crop.mode = VOUT_CROP_BORDER;
sys->source.crop.border.left = left;
sys->source.crop.border.right = right;
@@ -585,6 +616,11 @@ void vout_ChangeViewpoint(vout_thread_t *vout,
vout_control_cmd_t cmd;
vlc_mutex_lock(&sys->window_lock);
+ if (unlikely(!sys->window_active))
+ {
+ vlc_mutex_unlock(&sys->window_lock);
+ return;
+ }
sys->display_cfg.viewpoint = *p_viewpoint;
/* no window size update here */
vlc_mutex_unlock(&sys->window_lock);
@@ -1241,7 +1277,8 @@ void vout_ChangePause(vout_thread_t *vout, bool is_paused, vlc_tick_t date)
vout_control_Release(&vout->p->control);
vlc_mutex_lock(&vout->p->window_lock);
- vout_window_SetInhibition(vout->p->display_cfg.window, !is_paused);
+ if (likely(vout->p->window_active))
+ vout_window_SetInhibition(vout->p->display_cfg.window, !is_paused);
vlc_mutex_unlock(&vout->p->window_lock);
}
--
2.20.1
More information about the vlc-devel
mailing list