[vlc-commits] Revert "service_discovery: lock playlist_ServicesDiscoveryKillAll()"
Rémi Denis-Courmont
git at videolan.org
Tue Feb 20 19:26:26 CET 2018
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Tue Feb 20 19:04:50 2018 +0200| [b46ddaecda368656421f5d71a6e702ec60ccefbe] | committer: Rémi Denis-Courmont
Revert "service_discovery: lock playlist_ServicesDiscoveryKillAll()"
This reverts commit d9661b8bdcd40331c71963a565c6e1788f474be7.
There is no point in locking there, since interfaces are gone and the
playlist is disabled already.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=b46ddaecda368656421f5d71a6e702ec60ccefbe
---
src/playlist/services_discovery.c | 30 ++++++++++--------------------
1 file changed, 10 insertions(+), 20 deletions(-)
diff --git a/src/playlist/services_discovery.c b/src/playlist/services_discovery.c
index 6c2d9072c0..39a43badd6 100644
--- a/src/playlist/services_discovery.c
+++ b/src/playlist/services_discovery.c
@@ -147,24 +147,23 @@ int playlist_ServicesDiscoveryAdd(playlist_t *playlist, const char *chain)
return VLC_SUCCESS;
}
-static void playlist_ServicesDiscoveryInternalRemoveLocked(playlist_t *playlist,
- vlc_sd_internal_t *sds)
+static void playlist_ServicesDiscoveryInternalRemove(playlist_t *playlist,
+ vlc_sd_internal_t *sds)
{
assert(sds->sd != NULL);
-
- playlist_Unlock(playlist);
-
vlc_sd_Destroy(sds->sd);
+
/* Remove the sd playlist node if it exists */
playlist_Lock(playlist);
-
if (sds->node != NULL)
playlist_NodeDeleteExplicit(playlist, sds->node,
PLAYLIST_DELETE_FORCE | PLAYLIST_DELETE_STOP_IF_CURRENT );
+ playlist_Unlock(playlist);
free(sds);
}
+
int playlist_ServicesDiscoveryRemove(playlist_t *playlist, const char *name)
{
playlist_private_t *priv = pl_priv(playlist);
@@ -182,18 +181,15 @@ int playlist_ServicesDiscoveryRemove(playlist_t *playlist, const char *name)
break;
}
}
+ playlist_Unlock(playlist);
if (sds == NULL)
{
msg_Warn(playlist, "discovery %s is not loaded", name);
- playlist_Unlock(playlist);
return VLC_EGENERIC;
}
- playlist_ServicesDiscoveryInternalRemoveLocked(playlist, sds);
-
- playlist_Unlock(playlist);
-
+ playlist_ServicesDiscoveryInternalRemove(playlist, sds);
return VLC_SUCCESS;
}
@@ -248,14 +244,8 @@ void playlist_ServicesDiscoveryKillAll(playlist_t *playlist)
{
playlist_private_t *priv = pl_priv(playlist);
- playlist_Lock(playlist);
- while (priv->i_sds > 0)
- {
- vlc_sd_internal_t *sds = priv->pp_sds[priv->i_sds - 1];
- TAB_ERASE(priv->i_sds, priv->pp_sds, priv->i_sds - 1);
-
- playlist_ServicesDiscoveryInternalRemoveLocked(playlist, sds);
- }
+ for (int i = 0; i < priv->i_sds; i++)
+ playlist_ServicesDiscoveryInternalRemove(playlist, priv->pp_sds[i]);
- playlist_Unlock(playlist);
+ TAB_CLEAN(priv->i_sds, priv->pp_sds);
}
More information about the vlc-commits
mailing list