[vlc-commits] cli: remove the status lock
Rémi Denis-Courmont
git at videolan.org
Sat Oct 17 20:35:49 CEST 2020
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Oct 17 12:50:59 2020 +0300| [3e1b773120467e562c3e6bb966d20ff49a0aa8c3] | committer: Rémi Denis-Courmont
cli: remove the status lock
The player lock is already serialising all the code paths.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=3e1b773120467e562c3e6bb966d20ff49a0aa8c3
---
modules/control/cli/cli.c | 1 -
modules/control/cli/cli.h | 1 -
modules/control/cli/player.c | 13 ++++---------
3 files changed, 4 insertions(+), 11 deletions(-)
diff --git a/modules/control/cli/cli.c b/modules/control/cli/cli.c
index f6a470aaf5..db3efe2484 100644
--- a/modules/control/cli/cli.c
+++ b/modules/control/cli/cli.c
@@ -711,7 +711,6 @@ static int Activate( vlc_object_t *p_this )
#ifdef AF_LOCAL
p_sys->psz_unix_path = psz_unix_path;
#endif
- vlc_mutex_init( &p_sys->status_lock );
p_sys->b_input_buffering = false;
p_sys->playlist = vlc_intf_GetMainPlaylist(p_intf);;
diff --git a/modules/control/cli/cli.h b/modules/control/cli/cli.h
index feec2e936a..c359443e19 100644
--- a/modules/control/cli/cli.h
+++ b/modules/control/cli/cli.h
@@ -33,7 +33,6 @@ struct intf_sys_t
vlc_playlist_t *playlist;
/* status changes */
- vlc_mutex_t status_lock;
bool b_input_buffering;
#ifndef _WIN32
diff --git a/modules/control/cli/player.c b/modules/control/cli/player.c
index 3f9fbe2e9e..2b9d997193 100644
--- a/modules/control/cli/player.c
+++ b/modules/control/cli/player.c
@@ -75,19 +75,16 @@ player_on_buffering_changed(vlc_player_t *player,
{ VLC_UNUSED(player); VLC_UNUSED(new_buffering);
intf_thread_t *intf = data;
intf_sys_t *sys = intf->p_sys;
- vlc_mutex_lock(&sys->status_lock);
+
sys->b_input_buffering = true;
- vlc_mutex_unlock(&sys->status_lock);
}
static void
player_on_rate_changed(vlc_player_t *player, float new_rate, void *data)
{ VLC_UNUSED(player);
intf_thread_t *p_intf = data;
- intf_sys_t *sys = p_intf->p_sys;
- vlc_mutex_lock(&sys->status_lock);
+
msg_rc(STATUS_CHANGE "( new rate: %.3f )", new_rate);
- vlc_mutex_unlock(&sys->status_lock);
}
static void
@@ -96,12 +93,11 @@ player_on_position_changed(vlc_player_t *player,
{ VLC_UNUSED(player); VLC_UNUSED(new_pos);
intf_thread_t *p_intf = data;
intf_sys_t *sys = p_intf->p_sys;
- vlc_mutex_lock(&sys->status_lock);
+
if (sys->b_input_buffering)
msg_rc(STATUS_CHANGE "( time: %"PRId64"s )",
SEC_FROM_VLC_TICK(new_time));
sys->b_input_buffering = false;
- vlc_mutex_unlock(&sys->status_lock);
}
static const struct vlc_player_cbs player_cbs =
@@ -116,10 +112,9 @@ static void
player_aout_on_volume_changed(audio_output_t *aout, float volume, void *data)
{ VLC_UNUSED(aout);
intf_thread_t *p_intf = data;
- vlc_mutex_lock(&p_intf->p_sys->status_lock);
+
msg_rc(STATUS_CHANGE "( audio volume: %ld )",
lroundf(volume * 100));
- vlc_mutex_unlock(&p_intf->p_sys->status_lock);
}
static const struct vlc_player_aout_cbs player_aout_cbs =
More information about the vlc-commits
mailing list