mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 04:36:20 +00:00
Document locking and its order
This commit is contained in:
parent
176f5dd0be
commit
b9d111372e
11 changed files with 32 additions and 28 deletions
|
@ -67,7 +67,7 @@ GST_DEBUG_CATEGORY_STATIC (rtsp_address_pool_debug);
|
||||||
|
|
||||||
struct _GstRTSPAddressPoolPrivate
|
struct _GstRTSPAddressPoolPrivate
|
||||||
{
|
{
|
||||||
GMutex lock;
|
GMutex lock; /* protects everything in this struct */
|
||||||
GList *addresses;
|
GList *addresses;
|
||||||
GList *allocated;
|
GList *allocated;
|
||||||
};
|
};
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
struct _GstRTSPAuthPrivate
|
struct _GstRTSPAuthPrivate
|
||||||
{
|
{
|
||||||
GMutex lock;
|
GMutex lock;
|
||||||
gchar *basic;
|
gchar *basic; /* protected by lock */
|
||||||
GstRTSPMethod methods;
|
GstRTSPMethod methods;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -27,9 +27,13 @@
|
||||||
#define GST_RTSP_CLIENT_GET_PRIVATE(obj) \
|
#define GST_RTSP_CLIENT_GET_PRIVATE(obj) \
|
||||||
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), GST_TYPE_RTSP_CLIENT, GstRTSPClientPrivate))
|
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), GST_TYPE_RTSP_CLIENT, GstRTSPClientPrivate))
|
||||||
|
|
||||||
|
/* locking order:
|
||||||
|
* send_lock, lock, tunnels_lock
|
||||||
|
*/
|
||||||
|
|
||||||
struct _GstRTSPClientPrivate
|
struct _GstRTSPClientPrivate
|
||||||
{
|
{
|
||||||
GMutex lock;
|
GMutex lock; /* protects everything else */
|
||||||
GMutex send_lock;
|
GMutex send_lock;
|
||||||
GstRTSPConnection *connection;
|
GstRTSPConnection *connection;
|
||||||
GstRTSPWatch *watch;
|
GstRTSPWatch *watch;
|
||||||
|
@ -38,9 +42,9 @@ struct _GstRTSPClientPrivate
|
||||||
gboolean is_ipv6;
|
gboolean is_ipv6;
|
||||||
gboolean use_client_settings;
|
gboolean use_client_settings;
|
||||||
|
|
||||||
GstRTSPClientSendFunc send_func;
|
GstRTSPClientSendFunc send_func; /* protected by send_lock */
|
||||||
gpointer send_data;
|
gpointer send_data; /* protected by send_lock */
|
||||||
GDestroyNotify send_notify;
|
GDestroyNotify send_notify; /* protected by send_lock */
|
||||||
|
|
||||||
GstRTSPSessionPool *session_pool;
|
GstRTSPSessionPool *session_pool;
|
||||||
GstRTSPMountPoints *mount_points;
|
GstRTSPMountPoints *mount_points;
|
||||||
|
@ -54,7 +58,7 @@ struct _GstRTSPClientPrivate
|
||||||
};
|
};
|
||||||
|
|
||||||
static GMutex tunnels_lock;
|
static GMutex tunnels_lock;
|
||||||
static GHashTable *tunnels;
|
static GHashTable *tunnels; /* protected by tunnels_lock */
|
||||||
|
|
||||||
#define DEFAULT_SESSION_POOL NULL
|
#define DEFAULT_SESSION_POOL NULL
|
||||||
#define DEFAULT_MOUNT_POINTS NULL
|
#define DEFAULT_MOUNT_POINTS NULL
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
struct _GstRTSPMediaFactoryURIPrivate
|
struct _GstRTSPMediaFactoryURIPrivate
|
||||||
{
|
{
|
||||||
GMutex lock;
|
GMutex lock;
|
||||||
gchar *uri;
|
gchar *uri; /* protected by lock */
|
||||||
gboolean use_gstpay;
|
gboolean use_gstpay;
|
||||||
|
|
||||||
GstCaps *raw_vcaps;
|
GstCaps *raw_vcaps;
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
|
|
||||||
struct _GstRTSPMediaFactoryPrivate
|
struct _GstRTSPMediaFactoryPrivate
|
||||||
{
|
{
|
||||||
GMutex lock;
|
GMutex lock; /* protects everything but medias */
|
||||||
gchar *launch;
|
gchar *launch;
|
||||||
gboolean shared;
|
gboolean shared;
|
||||||
gboolean eos_shutdown;
|
gboolean eos_shutdown;
|
||||||
|
@ -38,7 +38,7 @@ struct _GstRTSPMediaFactoryPrivate
|
||||||
GstRTSPAddressPool *pool;
|
GstRTSPAddressPool *pool;
|
||||||
|
|
||||||
GMutex medias_lock;
|
GMutex medias_lock;
|
||||||
GHashTable *medias;
|
GHashTable *medias; /* protected by medias_lock */
|
||||||
};
|
};
|
||||||
|
|
||||||
#define DEFAULT_LAUNCH NULL
|
#define DEFAULT_LAUNCH NULL
|
||||||
|
@ -799,9 +799,9 @@ no_launch:
|
||||||
}
|
}
|
||||||
parse_error:
|
parse_error:
|
||||||
{
|
{
|
||||||
GST_RTSP_MEDIA_FACTORY_UNLOCK (factory);
|
|
||||||
g_critical ("could not parse launch syntax (%s): %s", priv->launch,
|
g_critical ("could not parse launch syntax (%s): %s", priv->launch,
|
||||||
(error ? error->message : "unknown reason"));
|
(error ? error->message : "unknown reason"));
|
||||||
|
GST_RTSP_MEDIA_FACTORY_UNLOCK (factory);
|
||||||
if (error)
|
if (error)
|
||||||
g_error_free (error);
|
g_error_free (error);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
@ -33,6 +33,7 @@ struct _GstRTSPMediaPrivate
|
||||||
GMutex lock;
|
GMutex lock;
|
||||||
GCond cond;
|
GCond cond;
|
||||||
|
|
||||||
|
/* protected by lock */
|
||||||
gboolean shared;
|
gboolean shared;
|
||||||
gboolean reusable;
|
gboolean reusable;
|
||||||
GstRTSPLowerTrans protocols;
|
GstRTSPLowerTrans protocols;
|
||||||
|
@ -43,17 +44,17 @@ struct _GstRTSPMediaPrivate
|
||||||
GstRTSPAddressPool *pool;
|
GstRTSPAddressPool *pool;
|
||||||
|
|
||||||
GstElement *element;
|
GstElement *element;
|
||||||
GRecMutex state_lock;
|
GRecMutex state_lock; /* locking order: state lock, lock */
|
||||||
GPtrArray *streams;
|
GPtrArray *streams; /* protected by lock */
|
||||||
GList *dynamic;
|
GList *dynamic; /* protected by lock */
|
||||||
GstRTSPMediaStatus status;
|
GstRTSPMediaStatus status; /* protected by lock */
|
||||||
gint prepare_count;
|
gint prepare_count;
|
||||||
gint n_active;
|
gint n_active;
|
||||||
gboolean adding;
|
gboolean adding;
|
||||||
|
|
||||||
/* the pipeline for the media */
|
/* the pipeline for the media */
|
||||||
GstElement *pipeline;
|
GstElement *pipeline;
|
||||||
GstElement *fakesink;
|
GstElement *fakesink; /* protected by lock */
|
||||||
GSource *source;
|
GSource *source;
|
||||||
guint id;
|
guint id;
|
||||||
|
|
||||||
|
@ -66,7 +67,7 @@ struct _GstRTSPMediaPrivate
|
||||||
GstElement *rtpbin;
|
GstElement *rtpbin;
|
||||||
|
|
||||||
/* the range of media */
|
/* the range of media */
|
||||||
GstRTSPTimeRange range;
|
GstRTSPTimeRange range; /* protected by lock */
|
||||||
GstClockTime range_start;
|
GstClockTime range_start;
|
||||||
GstClockTime range_stop;
|
GstClockTime range_stop;
|
||||||
};
|
};
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
struct _GstRTSPMountPointsPrivate
|
struct _GstRTSPMountPointsPrivate
|
||||||
{
|
{
|
||||||
GMutex lock;
|
GMutex lock;
|
||||||
GHashTable *mounts;
|
GHashTable *mounts; /* protected by lock */
|
||||||
};
|
};
|
||||||
|
|
||||||
G_DEFINE_TYPE (GstRTSPMountPoints, gst_rtsp_mount_points, G_TYPE_OBJECT);
|
G_DEFINE_TYPE (GstRTSPMountPoints, gst_rtsp_mount_points, G_TYPE_OBJECT);
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
|
|
||||||
struct _GstRTSPServerPrivate
|
struct _GstRTSPServerPrivate
|
||||||
{
|
{
|
||||||
GMutex lock;
|
GMutex lock; /* protects everything in this struct */
|
||||||
|
|
||||||
/* server information */
|
/* server information */
|
||||||
gchar *address;
|
gchar *address;
|
||||||
|
|
|
@ -26,12 +26,12 @@
|
||||||
struct _GstRTSPSessionMediaPrivate
|
struct _GstRTSPSessionMediaPrivate
|
||||||
{
|
{
|
||||||
GMutex lock;
|
GMutex lock;
|
||||||
GstRTSPUrl *url;
|
GstRTSPUrl *url; /* unmutable */
|
||||||
GstRTSPMedia *media;
|
GstRTSPMedia *media; /* unmutable */
|
||||||
GstRTSPState state;
|
GstRTSPState state; /* protected by lock */
|
||||||
guint counter;
|
guint counter; /* protected by lock */
|
||||||
|
|
||||||
GPtrArray *transports;
|
GPtrArray *transports; /* protected by lock */
|
||||||
};
|
};
|
||||||
|
|
||||||
enum
|
enum
|
||||||
|
|
|
@ -24,9 +24,8 @@
|
||||||
|
|
||||||
struct _GstRTSPSessionPoolPrivate
|
struct _GstRTSPSessionPoolPrivate
|
||||||
{
|
{
|
||||||
|
GMutex lock; /* protects everything in this struct */
|
||||||
guint max_sessions;
|
guint max_sessions;
|
||||||
|
|
||||||
GMutex lock;
|
|
||||||
GHashTable *sessions;
|
GHashTable *sessions;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -25,11 +25,11 @@
|
||||||
|
|
||||||
struct _GstRTSPSessionPrivate
|
struct _GstRTSPSessionPrivate
|
||||||
{
|
{
|
||||||
GMutex lock;
|
GMutex lock; /* protects everything but sessionid and create_time */
|
||||||
gchar *sessionid;
|
gchar *sessionid;
|
||||||
|
|
||||||
guint timeout;
|
guint timeout;
|
||||||
GTimeVal create_time;
|
GTimeVal create_time; /* immutable */
|
||||||
GTimeVal last_access;
|
GTimeVal last_access;
|
||||||
gint expire_count;
|
gint expire_count;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue