mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-22 15:18:21 +00:00
gst/gstpad.c (gst_real_pad_dispose): Free the stream lock (it wasn't being freed before).
Original commit message from CVS: 2005-02-21 Andy Wingo <wingo@pobox.com> * gst/gstpad.c (gst_real_pad_dispose): Free the stream lock (it wasn't being freed before). (gst_real_pad_init): Allocate and initialize the stream lock. * gst/gstpad.h (GstRealPad): Change the stream lock to be recursive, so that if an event comes while a loop-based sink is pulling, the stream lock can be had by both the sink's loop function and the sink's event function. (GST_STREAM_GET_LOCK, GST_STREAM_LOCK, GST_STREAM_TRYLOCK) (GST_STREAM_UNLOCK): Updated accordingly.
This commit is contained in:
parent
ae2cc6d30f
commit
aafa4f7570
3 changed files with 32 additions and 14 deletions
11
ChangeLog
11
ChangeLog
|
@ -1,5 +1,16 @@
|
||||||
2005-02-21 Andy Wingo <wingo@pobox.com>
|
2005-02-21 Andy Wingo <wingo@pobox.com>
|
||||||
|
|
||||||
|
* gst/gstpad.c (gst_real_pad_dispose): Free the stream lock (it
|
||||||
|
wasn't being freed before).
|
||||||
|
(gst_real_pad_init): Allocate and initialize the stream lock.
|
||||||
|
|
||||||
|
* gst/gstpad.h (GstRealPad): Change the stream lock to be
|
||||||
|
recursive, so that if an event comes while a loop-based sink is
|
||||||
|
pulling, the stream lock can be had by both the sink's loop
|
||||||
|
function and the sink's event function.
|
||||||
|
(GST_STREAM_GET_LOCK, GST_STREAM_LOCK, GST_STREAM_TRYLOCK)
|
||||||
|
(GST_STREAM_UNLOCK): Updated accordingly.
|
||||||
|
|
||||||
* gst/gstmessage.h (GstMessageType): Turned into flags. Added
|
* gst/gstmessage.h (GstMessageType): Turned into flags. Added
|
||||||
GST_MESSAGE_ANY as an OR of all flags.
|
GST_MESSAGE_ANY as an OR of all flags.
|
||||||
(GST_MESSAGE_PARSE_STATE_CHANGED): New terrible macro. Will be
|
(GST_MESSAGE_PARSE_STATE_CHANGED): New terrible macro. Will be
|
||||||
|
|
21
gst/gstpad.c
21
gst/gstpad.c
|
@ -254,8 +254,8 @@ gst_real_pad_init (GstRealPad * pad)
|
||||||
|
|
||||||
GST_FLAG_UNSET (pad, GST_PAD_ACTIVE);
|
GST_FLAG_UNSET (pad, GST_PAD_ACTIVE);
|
||||||
|
|
||||||
pad->stream_lock = g_mutex_new ();
|
pad->stream_rec_lock = g_new (GStaticRecMutex, 1);
|
||||||
pad->stream_cond = g_cond_new ();
|
g_static_rec_mutex_init (pad->stream_rec_lock);
|
||||||
|
|
||||||
pad->block_cond = g_cond_new ();
|
pad->block_cond = g_cond_new ();
|
||||||
|
|
||||||
|
@ -2494,7 +2494,11 @@ not_negotiated:
|
||||||
static void
|
static void
|
||||||
gst_real_pad_dispose (GObject * object)
|
gst_real_pad_dispose (GObject * object)
|
||||||
{
|
{
|
||||||
GstPad *pad = GST_PAD (object);
|
GstPad *pad;
|
||||||
|
GstRealPad *rpad;
|
||||||
|
|
||||||
|
pad = GST_PAD (object);
|
||||||
|
rpad = GST_REAL_PAD (object);
|
||||||
|
|
||||||
/* No linked pad can ever be disposed.
|
/* No linked pad can ever be disposed.
|
||||||
* It has to have a parent to be linked
|
* It has to have a parent to be linked
|
||||||
|
@ -2508,10 +2512,10 @@ gst_real_pad_dispose (GObject * object)
|
||||||
GST_DEBUG_PAD_NAME (pad));
|
GST_DEBUG_PAD_NAME (pad));
|
||||||
|
|
||||||
/* we destroy the ghostpads, because they are nothing without the real pad */
|
/* we destroy the ghostpads, because they are nothing without the real pad */
|
||||||
if (GST_REAL_PAD (pad)->ghostpads) {
|
if (rpad->ghostpads) {
|
||||||
GList *orig, *ghostpads;
|
GList *orig, *ghostpads;
|
||||||
|
|
||||||
orig = ghostpads = g_list_copy (GST_REAL_PAD (pad)->ghostpads);
|
orig = ghostpads = g_list_copy (rpad->ghostpads);
|
||||||
|
|
||||||
while (ghostpads) {
|
while (ghostpads) {
|
||||||
GstPad *ghostpad = GST_PAD (ghostpads->data);
|
GstPad *ghostpad = GST_PAD (ghostpads->data);
|
||||||
|
@ -2532,7 +2536,12 @@ gst_real_pad_dispose (GObject * object)
|
||||||
g_list_free (orig);
|
g_list_free (orig);
|
||||||
/* as the ghost pads are removed, they remove themselves from ->ghostpads.
|
/* as the ghost pads are removed, they remove themselves from ->ghostpads.
|
||||||
So it should be empty now. Let's assert that. */
|
So it should be empty now. Let's assert that. */
|
||||||
g_assert (GST_REAL_PAD (pad)->ghostpads == NULL);
|
g_assert (rpad->ghostpads == NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rpad->stream_rec_lock) {
|
||||||
|
g_static_rec_mutex_free (rpad->stream_rec_lock);
|
||||||
|
rpad->stream_rec_lock = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* clear the caps */
|
/* clear the caps */
|
||||||
|
|
14
gst/gstpad.h
14
gst/gstpad.h
|
@ -204,9 +204,8 @@ struct _GstRealPad {
|
||||||
GstPadDirection direction;
|
GstPadDirection direction;
|
||||||
|
|
||||||
/*< public >*/ /* with STREAM_LOCK */
|
/*< public >*/ /* with STREAM_LOCK */
|
||||||
/* streaming lock and cond */
|
/* streaming rec_lock */
|
||||||
GMutex *stream_lock;
|
GStaticRecMutex *stream_rec_lock;
|
||||||
GCond *stream_cond;
|
|
||||||
GstTask *task;
|
GstTask *task;
|
||||||
|
|
||||||
/*< public >*/ /* with LOCK */
|
/*< public >*/ /* with LOCK */
|
||||||
|
@ -331,11 +330,10 @@ struct _GstGhostPadClass {
|
||||||
#define GST_RPAD_IS_SRC(pad) (GST_RPAD_DIRECTION(pad) == GST_PAD_SRC)
|
#define GST_RPAD_IS_SRC(pad) (GST_RPAD_DIRECTION(pad) == GST_PAD_SRC)
|
||||||
#define GST_RPAD_IS_SINK(pad) (GST_RPAD_DIRECTION(pad) == GST_PAD_SINK)
|
#define GST_RPAD_IS_SINK(pad) (GST_RPAD_DIRECTION(pad) == GST_PAD_SINK)
|
||||||
|
|
||||||
#define GST_STREAM_GET_LOCK(pad) (GST_PAD_REALIZE(pad)->stream_lock)
|
#define GST_STREAM_GET_LOCK(pad) (GST_PAD_REALIZE(pad)->stream_rec_lock)
|
||||||
#define GST_STREAM_LOCK(pad) (g_mutex_lock(GST_STREAM_GET_LOCK(pad)))
|
#define GST_STREAM_LOCK(pad) (g_static_rec_mutex_lock(GST_STREAM_GET_LOCK(pad)))
|
||||||
#define GST_STREAM_TRYLOCK(pad) (g_mutex_trylock(GST_STREAM_GET_LOCK(pad)))
|
#define GST_STREAM_TRYLOCK(pad) (g_static_rec_mutex_trylock(GST_STREAM_GET_LOCK(pad)))
|
||||||
#define GST_STREAM_UNLOCK(pad) (g_mutex_unlock(GST_STREAM_GET_LOCK(pad)))
|
#define GST_STREAM_UNLOCK(pad) (g_static_rec_mutex_unlock(GST_STREAM_GET_LOCK(pad)))
|
||||||
#define GST_STREAM_GET_COND(pad) (GST_PAD_REALIZE(pad)->stream_cond)
|
|
||||||
|
|
||||||
#define GST_PAD_BLOCK_GET_COND(pad) (GST_PAD_REALIZE(pad)->block_cond)
|
#define GST_PAD_BLOCK_GET_COND(pad) (GST_PAD_REALIZE(pad)->block_cond)
|
||||||
#define GST_PAD_BLOCK_WAIT(pad) (g_cond_wait(GST_PAD_BLOCK_GET_COND (pad), GST_GET_LOCK (pad)))
|
#define GST_PAD_BLOCK_WAIT(pad) (g_cond_wait(GST_PAD_BLOCK_GET_COND (pad), GST_GET_LOCK (pad)))
|
||||||
|
|
Loading…
Reference in a new issue