Commit graph

1035 commits

Author SHA1 Message Date
Stefan Sauer
2f41e7bc6a tracer: harmonize the query hooks
In post hooks always pass the return value as the last param. Pass the query
also to post hooks since it is still alive.
2016-01-07 23:03:48 +01:00
Tim-Philipp Müller
7c992cfbe0 docs: fix some warnings and add some since markers 2016-01-03 17:50:35 +00:00
Edward Hervey
56d4650789 pad: Implement GstPadEventFullFunction
API: GstPadEventFullFunction

Returns a GstFlowReturn, allows asynchronous elements to properly
propagate flow returns

https://bugzilla.gnome.org/show_bug.cgi?id=757821
2015-12-02 16:04:03 +01:00
Thiago Santos
02d88fc3f3 pad: check template caps for proxy pads in accept-caps
Validate that the proxy pad indeed accepts the caps by also
comparing with the pad template caps, otherwise when the pad
had no internally linked pads it would always return true.

https://bugzilla.gnome.org/show_bug.cgi?id=754112
2015-11-06 10:23:34 -03:00
Jan Schmidt
ca22e60b91 pad: Mark sticky events as sent on not-linked
Instead of re-sending sticky events over and over to a not-linked
pad, mark them as sent the first time. If the not-linked came from
downstream, it already received the events. If the pad is actually
not-linked, the sticky events will be rescheduled when the
pad is linked anyway.
2015-11-01 23:16:44 +11:00
Sebastian Dröge
c47e49e1e3 pad: Unblock blocking pad probes when receiving FLUSH_START in send_event() too
Without this, flushing might not unblock the streaming thread and cause deadlocks.

https://bugzilla.gnome.org/show_bug.cgi?id=757257
2015-10-29 11:08:26 +02:00
Sebastian Dröge
1493f4a334 pad: Document the order in which pad probes are called
https://bugzilla.gnome.org/show_bug.cgi?id=757197
2015-10-28 13:04:25 +02:00
Sebastian Dröge
2dfa548f36 pad: Append hooks instead of prepending to call them in the order they were added
https://bugzilla.gnome.org/show_bug.cgi?id=757197
2015-10-28 13:02:04 +02:00
Sebastian Dröge
0f5be03d76 pad: Fix docs/annotation of gst_pad_probe_info_get_buffer_list()
It's not get_bufferlist(). Because of that it was ignored by the docs and
G-I, leading to crashes because of broken ownership transfer.

https://bugzilla.gnome.org/show_bug.cgi?id=756898
2015-10-21 14:49:49 +03:00
Sebastian Dröge
1efb451154 Use new GST_ENABLE_EXTRA_CHECKS #define
https://bugzilla.gnome.org/show_bug.cgi?id=756870
2015-10-21 14:31:56 +03:00
Florin Apostol
224da699a9 pad: fix memory leak when sending events to an EOS pad
https://bugzilla.gnome.org/show_bug.cgi?id=756208
2015-10-07 23:07:59 +01:00
Marcin Kolny
e8d0b019b3 tracer: add missing hooks
Add following hooks: element-new, element-add-pad, element-remove-pad,
bin-add-pre, bin-add-post, bin-remove-pre, bin-remove-post, pad-link-pre,
pad-link-post, pad-unlink-pre, pad-unlink-post.

https://bugzilla.gnome.org/show_bug.cgi?id=733187
2015-10-05 20:59:39 +02:00
Thiago Santos
567865c81c tracer: add pad query hooks 2015-10-05 20:59:39 +02:00
Stefan Sauer
46ea9729df tracer: split into tracer and tracerutils
Keep tracer base class in tracer and move core support into the utils module.
Add a unstable-api guard to the tracer.h so that external modules would need to
acknowledge the status by setting GST_USE_UNSTABLE_API.
2015-10-05 20:59:39 +02:00
Stefan Sauer
ce7ce2d866 tracer: add more hooks and handle it in the plugins 2015-10-05 20:59:39 +02:00
Stefan Sauer
e08fab7d5f tracer: use macros for hooks
Wrap the hook with a pre and post macro. This looks less intrusive than the
previous version, although it is a little less optimized.
2015-10-05 20:59:39 +02:00
Stefan Sauer
9d3975b5da tracer: pass the timestamp directly
Avoid the structure mashalling (and weird field naming).
2015-10-05 20:59:39 +02:00
Stefan Sauer
764b5833b9 tracer: switch to quarks and add another hook for buffer flow
Use pre-defines quarks as this will be called quite often.
2015-10-05 20:59:39 +02:00
Stefan Sauer
4e5d586c7d tracer: initial prototype for the tracing subsystem 2015-10-05 20:59:39 +02:00
Thiago Santos
4b5e79cd18 pad: don't fallback to caps queries with proxy pads
A proxy-pad should always proxy the caps related queries
and events to its down or upstream peers on the other side
of the element. Falling back to a caps query seems wrong.

https://bugzilla.gnome.org/show_bug.cgi?id=754112
2015-09-26 07:13:45 -03:00
Sebastian Dröge
1176fbf6dc pad: Break sticky event array iterations if the type is bigger than the one we look for
Microoptimization we can do because the array is sorted by type.
2015-08-15 17:59:21 +02:00
Edward Hervey
7f0e0ff3ca gstpad: Add a new GST_PROBE_HANDLED return value for probes
In some cases, probes might want to handle the buffer/event/query
themselves and stop the data from travelling further downstream.

While this was somewhat possible with buffer/events and using
GST_PROBE_DROP, it was not applicable to queries, and would result
in the query failing.

With this new GST_PROBE_HANDLED value, the buffer/event/query will
be considered as successfully handled, will not be pushed further
and the appropriate return value (TRUE or GST_FLOW_OK) will be returned

This also allows probes to return a non-default GstFlowReturn when dealing
with buffer push. This can be done by setting the
GST_PAD_PROBE_INFO_FLOW_RETURN() field accordingly

https://bugzilla.gnome.org/show_bug.cgi?id=748643
2015-08-15 17:00:12 +02:00
Thiago Santos
b76ecfd992 pad: add GST_PAD_FLAG_ACCEPT_TEMPLATE
It will make the default accept-caps handler use the pad template
caps instead of the query-caps result to check if the caps is
acceptable. This is aligned with what the design docs says the
accept-caps should do (be non-recursive) and should be faster. It
is *not* enabled by default, though.

API: GST_PAD_FLAG_ACCEPT_TEMPLATE
API: GST_PAD_IS_ACCEPT_TEMPLATE
API: GST_PAD_SET_ACCEPT_TEMPLATE
API: GST_PAD_UNSET_ACCEPT_TEMPLATE

https://bugzilla.gnome.org/show_bug.cgi?id=753623
2015-08-14 08:56:53 -03:00
Edward Hervey
2ef06fd39d pad: Fix previous commit
We want to get the caps query *result*
2015-08-08 15:29:30 +02:00
Edward Hervey
2499349d94 pad: get_allowed_caps() should go through both pads
The previous implementation was doing a direct call to the peer pad,
which resulted in query probes never being called on the original pad.

Instead of that, get the peer pad caps by using gst_pad_peer_query()
which will call probes in the expected fashion.
2015-08-08 14:51:59 +02:00
George Kiagiadakis
794a08d7e9 pad: fix invalid unref after IDLE probe on non-OK flow return
In case there is an IDLE probe fired from gst_pad_push_data and it
doesn't return GST_FLOW_OK, the code jumps to the probe_stopped
label which tries to unref the data object. However, at this point
the data object belongs downstream and must not be touched.
By setting data = NULL, the code skips this unref.

https://bugzilla.gnome.org//show_bug.cgi?id=753151
2015-08-04 11:10:45 +01:00
Olivier Crête
f126094dce pad: Enforce NEED_PARENT flag also for chain
The check for the presence of the parent in the presence of
the NEED_PARENT flag was missing for the chain function. Also keep
a ref on the parent in case the pad is removed mid-chain.
2015-07-03 12:56:01 -04:00
Song Bing
5109173abf pad: Clear EOS flag after received STREAM_START event
Clear EOS flag after received STREAM_START event

https://bugzilla.gnome.org/show_bug.cgi?id=750761
2015-06-23 10:35:46 +02:00
Vincent Penquerc'h
d0c3e33bbe pad: bump chain function call logs from LOG to DEBUG
They're really useful compared to other LOG stuff in there, so
there is value is including them and not the rest.
2015-05-15 14:57:14 +01:00
Thiago Santos
3d8de8a4f9 pad: block data flow when idle probe is running
When idle probe runs directly from the gst_pad_add_probe() function
we need to make sure that no data flow happens as idle probe
is a blocking probe. The idle probe will prevent that any
buffer, bufferlist or serialized events and queries are not
flowing while it is running.

https://bugzilla.gnome.org/show_bug.cgi?id=747852
2015-04-16 10:09:29 -03:00
Sebastian Dröge
36f7b13658 pad: Print debug output from gst_pad_link_full() if preparing linking failed
Makes it easier to find linking failures in debug logs.
2015-04-04 18:33:50 -07:00
Tim-Philipp Müller
5deb4f658e pad: allow probes to remove the data item whilst returning PROBE_OK
Use case: we want to block the source pad of a leaky queue and
drop the buffer that causes the block. If we return PROBE_DROP
then the buffer gets dropped, but we get called again. If we
return PROBE_OK we can't easily drop the buffer. If we just
replace the item into the GstPadProbeInfo structure with NULL,
GStreamer will push a NULL buffer to the next element when we
unblock the pad probe. This patch ensures it doesn't do that.

https://bugzilla.gnome.org/show_bug.cgi?id=734342
2015-04-03 00:07:26 +01:00
Wonchul Lee
ca380d16a0 pad: Fix a typo in a docstring
https://bugzilla.gnome.org/show_bug.cgi?id=747119
2015-03-31 19:28:51 +01:00
Tim-Philipp Müller
eb2d1f5b96 pad: fix outdated debug message
Buffer lists don't have groups any more in 1.0
2015-03-28 14:47:45 +00:00
Arun Raghavan
be36d34aee pad: Don't fail latency query on unlinked pads
A single unlinked pad can make the latency query fail across the
pipeline, which is probably not desirable. Instead, we return a default
anything goes value.

Perhaps we should also be emitting a gst_message_new_latency() when a
PLAYING element has one of its pads linked.

https://bugzilla.gnome.org/show_bug.cgi?id=745197
2015-02-26 15:57:26 +05:30
Sebastian Dröge
6f9adbe273 pad: If the latency query fails for one of the pads, it fails overall 2015-02-19 01:12:49 +02:00
Sebastian Dröge
9107a5e041 pad: Only initialize GValue to a type once, not on every retry
Otherwise we'll get warnings like this:
cannot initialize GValue with type 'gboolean', the value has already been initialized as 'gboolean'
2015-02-16 11:35:41 +02:00
Sebastian Dröge
ae0b12b109 pad: gst_pad_iterate_internal_links() can return NULL if there are none 2015-02-12 14:03:15 +02:00
Sebastian Dröge
5141641dc8 pad: Return NULL instead of FALSE for pointers 2015-02-12 14:03:03 +02:00
Sebastian Dröge
1937d09a95 pad: Implement more useful default handling for the LATENCY query
Before we just took the values from the first pad that succeded the query,
now we accumulate the results of every sinkpad properly and return that
result.
2015-02-12 13:55:36 +02:00
Tim-Philipp Müller
08167e3234 pad: add "offset" property to go with gst_pad_set_offset()
So we can set the offset via gst-launch.
2015-02-05 13:49:47 +00:00
Jan Schmidt
ae2b0bacb6 gstpad: Fix a typo in a docstring. 2015-02-02 17:38:00 +11:00
Edward Hervey
a6373625f3 gstpad: Inline apply_pad_offset()
Avoid doing a function call for something which will mostly be unused
2015-01-21 14:13:15 +01:00
Edward Hervey
64b451c170 gstpad: Fix debug message 2015-01-21 14:13:15 +01:00
Edward Hervey
93f540bb62 gstpad: Fix PROBE_NO_DATA macro
The problem was that the macro was always used with 'ret' as the defaultval
argument.

This would result in the macro eventually expanding to
    if (G_UNLIKELY (ret != ret && ret != GST_FLOW_OK))

... ret != ret will always fail, and therefore we'd never call the
following line.

Instead of that, store the previous value locally for comparision
2015-01-21 14:11:41 +01:00
Vincent Penquerc'h
d4c551a292 pad: fail dropped queries
Previously, dropping a query from a pad probe would deem the
query succeeded, and the caller might then assume the query's
results are valid, and thus dereference an invalid object
such as a GstCaps.

We now assume dropped queries did not succeed. Dropped events
and buffers are still deemed a success.

Added back after previous revert, as it's been double checked.

https://bugzilla.gnome.org/show_bug.cgi?id=740003
2014-11-12 14:05:19 +00:00
Vincent Penquerc'h
1b06822ce3 Revert "pad: fail dropped queries"
This was pushed by mistake along with an unrelated patch.

This reverts commit c7103ce4b8.
2014-11-12 13:55:23 +00:00
Vincent Penquerc'h
c7103ce4b8 pad: fail dropped queries
Previously, dropping a query from a pad probe would deem the
query succeeded, and the caller might then assume the query's
results are valid, and thus dereference an invalid object
such as a GstCaps.

We now assume dropped queries did not succeed. Dropped events
and buffers are still deemed a success.
2014-11-12 11:04:21 +00:00
Sebastian Dröge
126c511e62 pad: Make sure the buffer to get/pull_range() has at least the requested size
https://bugzilla.gnome.org/show_bug.cgi?id=735861
2014-09-12 15:22:19 +03:00
Wim Taymans
060b16ac75 pad: don't accept flush-stop on inactive pads
Inactive pads should at all times have the flushing flag set. This means
that when we get a flush-stop on an inactive pad we must ignore it.

On sinkpads, make this more explicit. We used to not clear the flush
flag but remove the events and then return an error because the flushing
flag was set. Now just simply refuse the event without doing anything.

On srcpads, check that we are trying to push a flush-stop event and
refuse it. We would allow this and mark the srcpad as non-flushing
anymore.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=735357
2014-09-02 12:04:15 +02:00