[vlc-devel] commit: sout_announce: use a static mutex instead of a variable. ( Rémi Duraffort )
git version control
git at videolan.org
Mon Dec 28 14:44:30 CET 2009
vlc | branch: master | Rémi Duraffort <ivoire at videolan.org> | Sun Dec 20 16:32:31 2009 +0100| [f45691bd1e685574290b4d8caede5dede6020c48] | committer: Rémi Duraffort
sout_announce: use a static mutex instead of a variable.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=f45691bd1e685574290b4d8caede5dede6020c48
---
src/stream_output/announce.c | 19 +++++++------------
1 files changed, 7 insertions(+), 12 deletions(-)
diff --git a/src/stream_output/announce.c b/src/stream_output/announce.c
index 261b69d..3944705 100644
--- a/src/stream_output/announce.c
+++ b/src/stream_output/announce.c
@@ -49,6 +49,9 @@ static void sap_destroy (vlc_object_t *p_this)
}
#undef sout_AnnounceRegisterSDP
+
+static vlc_mutex_t sap_mutex = VLC_STATIC_MUTEX;
+
/**
* Registers a new session with the announce handler, using a pregenerated SDP
*
@@ -81,12 +84,7 @@ sout_AnnounceRegisterSDP( vlc_object_t *obj, const char *psz_sdp,
vlc_freeaddrinfo (res);
}
- vlc_value_t lockval;
- if (var_Create (obj->p_libvlc, "sap_mutex", VLC_VAR_MUTEX)
- || var_Get (obj->p_libvlc, "sap_mutex", &lockval))
- goto error;
-
- vlc_mutex_lock (lockval.p_address);
+ vlc_mutex_lock (&sap_mutex);
sap_handler_t *p_sap = libvlc_priv (obj->p_libvlc)->p_sap;
if (p_sap == NULL)
{
@@ -96,7 +94,7 @@ sout_AnnounceRegisterSDP( vlc_object_t *obj, const char *psz_sdp,
}
else
vlc_object_hold ((vlc_object_t *)p_sap);
- vlc_mutex_unlock (lockval.p_address);
+ vlc_mutex_unlock (&sap_mutex);
if (p_sap == NULL)
goto error;
@@ -127,12 +125,9 @@ int sout_AnnounceUnRegister( vlc_object_t *obj,
msg_Dbg (obj, "removing SAP session");
SAP_Del (p_sap, p_session);
- vlc_value_t lockval;
- var_Create (obj->p_libvlc, "sap_mutex", VLC_VAR_MUTEX);
- var_Get (obj->p_libvlc, "sap_mutex", &lockval);
- vlc_mutex_lock (lockval.p_address);
+ vlc_mutex_lock (&sap_mutex);
vlc_object_release ((vlc_object_t *)p_sap);
- vlc_mutex_unlock (lockval.p_address);
+ vlc_mutex_unlock (&sap_mutex);
free (p_session->psz_sdp);
free (p_session);
More information about the vlc-devel
mailing list