Commit 49334e07 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont
Browse files

"fullscreen" callback: do nothing if value is unchanged

The old video output core assumes that the fullscreen state must be
toggled if the VOUT_FULLSCREEN_CHANGE bit is set. So we need to check
that the target state is not already correct, as the VLC variables core
does NOT do it internally. This commit provides rare exception to the
rule that oldval is useless.

This fixes a whole class of race conditions where two threads try to
change fullscreen status at the same time.

In the video filter case, we now enable fullscreen on all childrens, not
just one. This seems a bit more logical for wall. Without this, toggling
fullscreen would only ever work on the first video output. With this,
things should work great if the different pieces of the wall are on
different video ports, and OK (Alt+Tab is your friend) otherwise.
parent ec104981
......@@ -236,7 +236,7 @@ static int PutAction( intf_thread_t *p_intf, int i_action )
}
case ACTIONID_LEAVE_FULLSCREEN:
if( p_vout && var_GetBool( p_vout, "fullscreen" ) )
if( p_vout )
var_SetBool( p_vout, "fullscreen", false );
break;
......
......@@ -82,19 +82,6 @@ static inline int ForwardEvent( vlc_object_t *p_this, char const *psz_var,
return var_Set( p_dst, psz_var, newval );
}
/**
* Internal helper to forward fullscreen event from p_this to p_data.
*/
static inline int ForwardFullscreen( vlc_object_t *p_this, char const *psz_var,
vlc_value_t oldval, vlc_value_t newval, void *p_data )
{
VLC_UNUSED(p_this); VLC_UNUSED(oldval);
vlc_object_t *p_dst = (vlc_object_t*)p_data;
if( !var_GetBool( p_dst, "fullscreen" ) != !newval.b_bool )
return var_SetBool( p_dst, psz_var, newval.b_bool );
return VLC_SUCCESS;
}
/**
* Install/remove all callbacks needed for proper event handling inside
* a vout-filter.
......@@ -129,9 +116,9 @@ static inline void vout_filter_SetupChild( vout_thread_t *p_parent, vout_thread_
/* */
if( !pf_fullscreen_up )
pf_fullscreen_up = ForwardFullscreen;
pf_fullscreen_up = ForwardEvent;
if( !pf_fullscreen_down )
pf_fullscreen_down = ForwardFullscreen;
pf_fullscreen_down = ForwardEvent;
pf_execute( VLC_OBJECT(p_child), "fullscreen", pf_fullscreen_up, p_parent );
pf_execute( VLC_OBJECT(p_parent), "fullscreen", pf_fullscreen_down, p_child );
}
......
......@@ -562,9 +562,7 @@ static int FullscreenEventUp( vlc_object_t *p_this, char const *psz_var,
VLC_UNUSED(oldval); VLC_UNUSED(p_this); VLC_UNUSED(psz_var); VLC_UNUSED(newval);
const bool b_fullscreen = IsFullscreenActive( p_vout );
if( !var_GetBool( p_vout, "fullscreen" ) != !b_fullscreen )
return var_SetBool( p_vout, "fullscreen", b_fullscreen );
return VLC_SUCCESS;
return var_SetBool( p_vout, "fullscreen", b_fullscreen );
}
static int FullscreenEventDown( vlc_object_t *p_this, char const *psz_var,
vlc_value_t oldval, vlc_value_t newval, void *p_data )
......@@ -573,19 +571,10 @@ static int FullscreenEventDown( vlc_object_t *p_this, char const *psz_var,
vout_sys_t *p_sys = p_vout->p_sys;
VLC_UNUSED(oldval); VLC_UNUSED(p_data); VLC_UNUSED(psz_var);
const bool b_fullscreen = IsFullscreenActive( p_vout );
if( !b_fullscreen != !newval.b_bool )
for( int i = 0; i < p_sys->i_vout; i++ )
{
for( int i = 0; i < p_sys->i_vout; i++ )
{
vout_thread_t *p_child = p_sys->pp_vout[i];
if( !var_GetBool( p_child, "fullscreen" ) != !newval.b_bool )
{
var_SetBool( p_child, "fullscreen", newval.b_bool );
if( newval.b_bool )
return VLC_SUCCESS;
}
}
vout_thread_t *p_child = p_sys->pp_vout[i];
var_SetBool( p_child, "fullscreen", newval.b_bool );
}
return VLC_SUCCESS;
}
......
......@@ -100,8 +100,7 @@ static inline void vout_SendEventMouseHidden(vout_thread_t *vout)
static inline void vout_SendEventFullscreen(vout_thread_t *vout, bool is_fullscreen)
{
if (!var_GetBool(vout, "fullscreen") != !is_fullscreen)
var_SetBool(vout, "fullscreen", is_fullscreen);
var_SetBool(vout, "fullscreen", is_fullscreen);
}
static inline void vout_SendEventDisplayFilled(vout_thread_t *vout, bool is_display_filled)
......
......@@ -978,8 +978,10 @@ static int FullscreenCallback( vlc_object_t *p_this, char const *psz_cmd,
{
vout_thread_t *p_vout = (vout_thread_t *)p_this;
vlc_value_t val;
(void)psz_cmd; (void)oldval; (void)p_data;
(void)psz_cmd; (void)p_data;
if( oldval.b_bool == newval.b_bool )
return VLC_SUCCESS; /* no-op */
p_vout->i_changes |= VOUT_FULLSCREEN_CHANGE;
/* Modify libvlc as well because the vout might have to be restarted */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment