mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 06:54:49 +00:00
pad: update the context lazyly
This commit is contained in:
parent
e72d062b33
commit
f16180a761
2 changed files with 11 additions and 41 deletions
51
gst/gstpad.c
51
gst/gstpad.c
|
@ -371,8 +371,6 @@ gst_pad_init (GstPad * pad)
|
||||||
g_static_rec_mutex_init (pad->stream_rec_lock);
|
g_static_rec_mutex_init (pad->stream_rec_lock);
|
||||||
|
|
||||||
pad->block_cond = g_cond_new ();
|
pad->block_cond = g_cond_new ();
|
||||||
|
|
||||||
pad->context = gst_context_new ();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -406,7 +404,8 @@ gst_pad_dispose (GObject * object)
|
||||||
pad->block_data = NULL;
|
pad->block_data = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
gst_context_clear (pad->context);
|
if (GST_PAD_CONTEXT (pad))
|
||||||
|
gst_context_replace (&GST_PAD_CONTEXT (pad), NULL);
|
||||||
|
|
||||||
G_OBJECT_CLASS (parent_class)->dispose (object);
|
G_OBJECT_CLASS (parent_class)->dispose (object);
|
||||||
}
|
}
|
||||||
|
@ -434,8 +433,6 @@ gst_pad_finalize (GObject * object)
|
||||||
pad->block_cond = NULL;
|
pad->block_cond = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
gst_context_unref (pad->context);
|
|
||||||
|
|
||||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -620,7 +617,8 @@ post_activate (GstPad * pad, GstActivateMode new_mode)
|
||||||
/* ensures that streaming stops */
|
/* ensures that streaming stops */
|
||||||
GST_PAD_STREAM_LOCK (pad);
|
GST_PAD_STREAM_LOCK (pad);
|
||||||
GST_DEBUG_OBJECT (pad, "stopped streaming");
|
GST_DEBUG_OBJECT (pad, "stopped streaming");
|
||||||
gst_context_clear (pad->context);
|
if (GST_PAD_CONTEXT (pad))
|
||||||
|
gst_context_clear (GST_PAD_CONTEXT (pad));
|
||||||
GST_PAD_STREAM_UNLOCK (pad);
|
GST_PAD_STREAM_UNLOCK (pad);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -3449,39 +3447,6 @@ gst_pad_chain_data_unchecked (GstPad * pad, gboolean is_buffer, void *data,
|
||||||
|
|
||||||
emit_signal = GST_PAD_DO_BUFFER_SIGNALS (pad) > 0;
|
emit_signal = GST_PAD_DO_BUFFER_SIGNALS (pad) > 0;
|
||||||
|
|
||||||
#if 0
|
|
||||||
if (G_UNLIKELY (GST_PAD_IS_STICKY_PENDING (pad))) {
|
|
||||||
GstPadEventFunction eventfunc;
|
|
||||||
|
|
||||||
if (G_LIKELY ((eventfunc = GST_PAD_EVENTFUNC (pad)))) {
|
|
||||||
GstEvent *events[GST_EVENT_MAX_STICKY];
|
|
||||||
GstEvent *event;
|
|
||||||
guint i;
|
|
||||||
|
|
||||||
/* need to make a copy because when we release the object lock, things
|
|
||||||
* could just change */
|
|
||||||
for (i = 0; i < GST_EVENT_MAX_STICKY; i++) {
|
|
||||||
if ((event = pad->sticky[i]))
|
|
||||||
events[i] = gst_event_ref (event);
|
|
||||||
else
|
|
||||||
events[i] = NULL;
|
|
||||||
}
|
|
||||||
/* clear the flag */
|
|
||||||
GST_OBJECT_FLAG_UNSET (pad, GST_PAD_STICKY_PENDING);
|
|
||||||
GST_OBJECT_UNLOCK (pad);
|
|
||||||
|
|
||||||
/* and push */
|
|
||||||
GST_DEBUG_OBJECT (pad, "pushing sticky events");
|
|
||||||
for (i = 0; i < GST_EVENT_MAX_STICKY; i++) {
|
|
||||||
if ((event = events[i]))
|
|
||||||
eventfunc (pad, event);
|
|
||||||
}
|
|
||||||
/* and restart, we released the lock things might have changed */
|
|
||||||
goto again;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
GST_OBJECT_UNLOCK (pad);
|
GST_OBJECT_UNLOCK (pad);
|
||||||
|
|
||||||
/* see if the signal should be emited, we emit before caps nego as
|
/* see if the signal should be emited, we emit before caps nego as
|
||||||
|
@ -4497,8 +4462,12 @@ gst_pad_push_event (GstPad * pad, GstEvent * event)
|
||||||
|
|
||||||
/* store the event on the pad, but only on srcpads */
|
/* store the event on the pad, but only on srcpads */
|
||||||
if (GST_PAD_IS_SRC (pad) && GST_EVENT_IS_STICKY (event)) {
|
if (GST_PAD_IS_SRC (pad) && GST_EVENT_IS_STICKY (event)) {
|
||||||
pad->context = gst_context_make_writable (pad->context);
|
if (GST_PAD_CONTEXT (pad))
|
||||||
gst_context_update (pad->context, event);
|
GST_PAD_CONTEXT (pad) = gst_context_make_writable (GST_PAD_CONTEXT (pad));
|
||||||
|
else
|
||||||
|
GST_PAD_CONTEXT (pad) = gst_context_new ();
|
||||||
|
|
||||||
|
gst_context_update (GST_PAD_CONTEXT (pad), event);
|
||||||
}
|
}
|
||||||
|
|
||||||
peerpad = GST_PAD_PEER (pad);
|
peerpad = GST_PAD_PEER (pad);
|
||||||
|
|
|
@ -684,6 +684,7 @@ struct _GstPadClass {
|
||||||
* The caps for this pad.
|
* The caps for this pad.
|
||||||
*/
|
*/
|
||||||
#define GST_PAD_CAPS(pad) (GST_PAD_CAST(pad)->caps)
|
#define GST_PAD_CAPS(pad) (GST_PAD_CAST(pad)->caps)
|
||||||
|
#define GST_PAD_CONTEXT(pad) (GST_PAD_CAST(pad)->context)
|
||||||
#define GST_PAD_GETCAPSFUNC(pad) (GST_PAD_CAST(pad)->getcapsfunc)
|
#define GST_PAD_GETCAPSFUNC(pad) (GST_PAD_CAST(pad)->getcapsfunc)
|
||||||
#define GST_PAD_SETCAPSFUNC(pad) (GST_PAD_CAST(pad)->setcapsfunc)
|
#define GST_PAD_SETCAPSFUNC(pad) (GST_PAD_CAST(pad)->setcapsfunc)
|
||||||
#define GST_PAD_ACCEPTCAPSFUNC(pad) (GST_PAD_CAST(pad)->acceptcapsfunc)
|
#define GST_PAD_ACCEPTCAPSFUNC(pad) (GST_PAD_CAST(pad)->acceptcapsfunc)
|
||||||
|
|
Loading…
Reference in a new issue