diff options
author | Stefan Kost <ensonic@users.sf.net> | 2009-06-12 10:14:27 +0300 |
---|---|---|
committer | Stefan Kost <ensonic@users.sf.net> | 2009-06-14 10:56:23 +0300 |
commit | 1187b88acdb0b9d7d50418309c60a6b4b8f7a72a (patch) | |
tree | 24e10ab44e0b3b21349b7d8beeadb0e45813f934 | |
parent | 1b7d1fc94cbe527560f93c8be65f857cddbbfa61 (diff) | |
download | gst-plugins-bad-1187b88acdb0b9d7d50418309c60a6b4b8f7a72a.tar.gz gst-plugins-bad-1187b88acdb0b9d7d50418309c60a6b4b8f7a72a.tar.bz2 gst-plugins-bad-1187b88acdb0b9d7d50418309c60a6b4b8f7a72a.zip |
outputselector: do the pad_alloc for the pad that is pending and have a fallback
We should do the pad_alloc for the pending pad if any, as we will switch to that
pad on next _chain() call. Also do a fallback alloc, if there is no output yet to
not fail state transitions in dynamic pipelines.
-rw-r--r-- | gst/selector/gstoutputselector.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/gst/selector/gstoutputselector.c b/gst/selector/gstoutputselector.c index 6e93a0a4..15c0a726 100644 --- a/gst/selector/gstoutputselector.c +++ b/gst/selector/gstoutputselector.c @@ -196,7 +196,7 @@ gst_output_selector_set_property (GObject * object, guint prop_id, next_pad = g_value_get_object (value); - GST_LOG_OBJECT (sel, "Activating pad %s:%s", + GST_INFO_OBJECT (sel, "Activating pad %s:%s", GST_DEBUG_PAD_NAME (next_pad)); GST_OBJECT_LOCK (object); @@ -262,11 +262,11 @@ gst_output_selector_buffer_alloc (GstPad * pad, guint64 offset, guint size, GstPad *allocpad; sel = GST_OUTPUT_SELECTOR (GST_PAD_PARENT (pad)); - res = GST_FLOW_NOT_LINKED; GST_OBJECT_LOCK (sel); - if ((allocpad = sel->active_srcpad)) { + allocpad = sel->pending_srcpad ? sel->pending_srcpad : sel->active_srcpad; + if (allocpad) { /* if we had a previous pad we used for allocating a buffer, continue using * it. */ GST_DEBUG_OBJECT (sel, "using pad %s:%s for alloc", @@ -278,9 +278,16 @@ gst_output_selector_buffer_alloc (GstPad * pad, guint64 offset, guint size, gst_object_unref (allocpad); GST_OBJECT_LOCK (sel); + } else { + /* fallback case, allocate a buffer of our own, add pad caps. */ + GST_DEBUG_OBJECT (pad, "fallback buffer alloc"); + *buf = NULL; + res = GST_FLOW_OK; } GST_OBJECT_UNLOCK (sel); + GST_DEBUG_OBJECT (sel, "buffer alloc finished: %s", gst_flow_get_name (res)); + return res; } |