From d6bdaf039542e21583cb6d8c4c3fb33e395a6351 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rafa=C3=ABl=20Carr=C3=A9?= Date: Fri, 28 Sep 2007 21:11:01 +0000 Subject: [PATCH] telepathy: avoid flooding the bus when playing some special inputs. --- modules/misc/notify/notify.c | 2 +- modules/misc/notify/telepathy.c | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/modules/misc/notify/notify.c b/modules/misc/notify/notify.c index aa1e556969..5319c1b179 100644 --- a/modules/misc/notify/notify.c +++ b/modules/misc/notify/notify.c @@ -193,7 +193,7 @@ static int ItemChange( vlc_object_t *p_this, const char *psz_var, psz_title, psz_artist ); else snprintf( psz_tmp, MAX_LENGTH, "%s", psz_title ); - + free( psz_title ); free( psz_artist ); free( psz_album ); diff --git a/modules/misc/notify/telepathy.c b/modules/misc/notify/telepathy.c index 25c0275a00..6d093adf6d 100644 --- a/modules/misc/notify/telepathy.c +++ b/modules/misc/notify/telepathy.c @@ -40,6 +40,7 @@ struct intf_sys_t char *psz_format; DBusConnection *p_conn; int i_id; + int i_item-changes; }; /***************************************************************************** @@ -162,9 +163,18 @@ static int ItemChange( vlc_object_t *p_this, const char *psz_var, if( !strncmp( "playlist-current", psz_var, 16 ) ) { /* stores the current input item id */ p_intf->p_sys->i_id = newval.i_int; + p_intf->p_sys->i_item-changes = 0; + } + else + { + if( newval.i_int != p_intf->p_sys->i_id ) /* "item-change" */ + return VLC_SUCCESS; + /* some variable bitrate inputs call "item-change callbacks each time + * their length is updated, that is several times per second. */ + if( p_intf->p_sys->i_item-changes > 5 ) + return VLC_SUCCESS; + p_intf->p_sys->i_item-changes++; } - else if( newval.i_int != p_intf->p_sys->i_id ) /* "item-change" */ - return VLC_SUCCESS; playlist_t *p_playlist = pl_Yield( p_this ); -- 2.39.2