Commit graph

105 commits

Author SHA1 Message Date
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
a1b9bb8eac tests: pad: tests for accept-caps default handling
Check if all the default 4 accept-caps possibilities are working:
subset or intersect check and query-caps or template caps comparisons.

https://bugzilla.gnome.org/show_bug.cgi?id=753623
2015-08-14 08:56:53 -03:00
Tim-Philipp Müller
072b1c6aba tests: pad: fix buffer leak in new blocking_with_probe_type_idle test 2015-04-18 12:01:54 +01:00
Tim-Philipp Müller
0759058896 tests: pad: fix invalid memory access in debug log message
The string we put in the buffer is not NUL-terminated, so
don't try to print that via %s in a debug log message.
2015-04-18 12:01:54 +01:00
Thiago Santos
d4d161a282 tests: pad: test that idle probe will block
This tests add an idle probe on an idle pad from a separate thread
so that the callback is called immediatelly. This callback will sit
still and then we try to push a buffer on this same pad. It verifies
that the idle probe blocks data passing

https://bugzilla.gnome.org/show_bug.cgi?id=747852
2015-04-16 11:45:24 -03: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
Wim Taymans
7e33f52961 tests: add flush-stop on inactive pad test
Check that pushing flush-stop on an inactive pad does not clear the
flushing flag.
2014-09-02 12:04:15 +02:00
Thiago Santos
c6f92562b6 pad: store last flow return and provide acessor function
Stores the last result of a gst_pad_push or a pull on the GstPad and provides
a getter and a macro to access this field.

Whenever the pad is inactive it is set to FLUSHING

API: gst_pad_get_last_flow_return

https://bugzilla.gnome.org/show_bug.cgi?id=709224
2014-05-26 15:29:53 -03:00
Sebastian Dröge
9e125e7bab pad: Add unit test for adding/removing blocking probes while a pad is blocked
And make sure that these new probes are actually called if they should
instead of silently blocking the pad forever.

https://bugzilla.gnome.org/show_bug.cgi?id=721289
2014-01-02 13:34:52 +01:00
Sebastian Dröge
2253f8fa6f pad: Fix memory leak in the unit test 2013-05-29 11:36:38 +02:00
Sebastian Dröge
114f9584d4 tests: Fix event order warnings and dataflow before stream-start/segment event 2013-05-09 13:32:07 +02:00
Alessandro Decina
ef0e9b6840 tests: add check for FLUSH pad probes 2013-04-25 07:26:29 +02:00
Руслан Ижбулатов
54aaba5f21 tests: fix GstPad test on windows and in CK_FORK=no mode
Need to clear buffer lists at the end of each test.

https://bugzilla.gnome.org/show_bug.cgi?id=697610
2013-04-09 09:56:57 +01:00
Tim-Philipp Müller
c0926dc7cc pad: add gst_pad_get_stream_id() utility function
API: gst_pad_get_stream_id()
2013-01-19 12:51:56 +00:00
Tim-Philipp Müller
666c8c11c6 Fix FSF address
https://bugzilla.gnome.org/show_bug.cgi?id=687520
2012-11-03 20:44:48 +00:00
Olivier Crête
945e0d2be9 pad: Remove pad probes only once
Also add test to make sure that if a pad probe is removed while it's
callback is running, the cleanup_hook isn't called again if it
returns GST_PAD_PROBE_REMOVE
2012-09-20 15:24:33 -04:00
Mark Nauwelaerts
47e7c91ab5 tests: port to new GLib thread API 2012-09-12 13:01:18 +02:00
Sebastian Dröge
0d22988e5c event: Update for stream-start event API changes 2012-08-06 14:00:56 +02:00
Wim Taymans
02eebca16b pad: fix test raciness
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=679506
2012-07-13 09:43:59 +02:00
Mark Nauwelaerts
678e9704fc tests: plug some leaks 2012-04-24 16:01:52 +02:00
Wim Taymans
6886be59f5 tests: fix unit test
with the new caps API, there is more sharing and less copying going on so the
unit test refcounts are different.
2012-03-12 10:41:28 +01:00
Wim Taymans
842afb9732 test: add test to check sticky events order
Sticky events pushed on an unlinked pad should be stored on the pad. When the
pad is then linked and an event is pushed, the event should be merged with the
already existing sticky events and then the sticky events should be pushed in
the order that they were originally pushed.
2012-03-09 11:49:08 +01:00
Wim Taymans
7b8263de93 pad: return ANY for a pad without template
Because gst_pad_get_pad_template_caps() returns ANY when there is no template,
the query caps function should also return ANY when there is no template (and no
pad current caps) instead of EMPTY.
2012-03-08 10:34:42 +01:00
Wim Taymans
92b61a6a18 tests: fix old caps in tests now that core warns 2012-03-01 17:41:56 +01:00
Matej Knopp
1d7626f293 Unit test for queue src caps notification 2012-02-21 11:04:55 +01:00
Wim Taymans
7ab1d62c24 GST_FLOW_WRONG_STATE -> GST_FLOW_FLUSHING 2012-02-08 16:18:04 +01:00
Wim Taymans
a521252845 Add new GstMapInfo
Use a structure to hold info about the mapping. The application then keeps track
of this state and we can use it to unmap the memory again later.
2012-01-25 11:54:23 +01:00
Edward Hervey
173d845cca tests: Fix leak in pad check 2011-12-28 15:30:31 +01:00
Stefan Sauer
3663167582 tests: don't include glib/gthread.h directly
The g_thread functions are available after including glib.h as per docs.
2011-12-06 14:46:46 +01:00
Wim Taymans
c0e3974aa7 pad: remove GST_FLOW_RESEND
It is unused and undefined.
2011-12-06 14:24:15 +01:00
Wim Taymans
005dab15f6 test: fix refcount error 2011-11-28 14:07:24 +01:00
Wim Taymans
933e8b230c pad: fix blocking probe emission
If we are dealing with a blocking probe, only then check if one the
blocking flags of the hook matches.
Add some more debug.
Make the pad unit test less racy.
2011-11-25 07:11:24 +01:00
Matej Knopp
0b2ecbf6fc Add test for PAD_PROBE_TYPE_BLOCK and PAD_PROBE_TYPE_BLOCKING 2011-11-25 06:07:27 +01:00
Edward Hervey
13e7839653 tests: Check for dataflow with incompatible caps
This test currently fails, but is there to ensure we fix this issue
and keep it fixed, since it completely breaks delayed negotiation
use-cases.

This behaviour started breaking since
dd65aae9a1
2011-11-24 09:34:47 +01:00
Edward Hervey
1cc836b2f0 tests: Add comments to gstpad tests 2011-11-24 09:31:02 +01:00
Edward Hervey
bfa78eb7a1 tests: Remove "#if 0" block for behaviour that now works 2011-11-24 09:30:14 +01:00
Edward Hervey
77596b0e05 tests: Remove commented block
This behaviour is actually tested in test_push_unlinked
2011-11-24 09:28:32 +01:00
Wim Taymans
3a595d5849 tests: improve pad tests 2011-11-21 17:46:45 +01:00
Wim Taymans
612b1fbb14 pad: add parent to other functions
Add parent to chain, chain_list, getrange and event functions.
2011-11-17 12:40:45 +01:00
Wim Taymans
37318a8cd2 pad: remove GstPadFixateCapsFunction
The fixate caps function was not used externally and we have vmethods in the
base classes where it is needed.
Update some docs.
simplify some fixate functions in the base classes. Also pass the untruncated
caps to the vmethod.
2011-11-10 10:58:42 +01:00
René Stadler
464f55bc5b tests: pad: add tests for sticky caps handling
test_sticky_caps_flushing is currently failing.
2011-11-09 12:38:34 +01:00
Wim Taymans
fb1f6bec68 pad: fix unit test 2011-11-08 13:30:18 +01:00
Wim Taymans
47eb1fe52b test: port to 0.11 2011-11-08 13:02:04 +01:00
Wim Taymans
9c0d8ca718 Merge branch 'master' into 0.11
Conflicts:
	gst/gstelement.h
	gst/gstghostpad.c
	gst/gstminiobject.c
2011-11-08 12:54:15 +01:00
René Stadler
ab8d5874b0 tests: pad: add test to verify flushing behaviour
Seems like a trivial case, but this was actually broken in 0.11 recently.
2011-11-08 12:22:21 +01:00
Wim Taymans
ba3028aeeb pad: Add GstPadProbeInfo
Make a new GstPadProbeInfo structure and pass this in the probe callback. This
allows us to add more things later and also allow the callback to replace or
modify the passed object.
2011-11-08 11:04:19 +01:00
Wim Taymans
24e596a1fb pad: rework pad probes
Make a separate cookie to detect chancges in the list of probes and keeping
track of what hooks have been invoked yet.
Remove the requirement to have probes on srcpads in push mode and sinkpads in
pull mode.
Add some more debug.
Keep track of what callbacks got executed. If no callback is called and we are a
blocking pad, let the item pass. This allows you to block pads on selected
items only.
Explicitly have an UPSTREAM and DOWNSTREAM PadProbeType. This allows you to only
block the pad on upstream or downstream items.
Add convenience macros to only block on downstream/upstream items.
2011-11-07 17:15:17 +01:00
Tim-Philipp Müller
bffc9207b5 pad: rename GstProbeType and GstProbeReturn to GstPadProbe{Type,Return}
Better now than later in the cycle. These might come in handy:

sed -i -e 's/GstProbeReturn/GstPadProbeReturn/g'   `git grep GstProbeReturn  | sed -e 's/:.*//' | sort -u`
sed -i -e 's/GST_PROBE_/GST_PAD_PROBE_/g'          `git grep GST_PROBE_      | sed -e 's/:.*//' | sort -u`
sed -i -e 's/GstProbeType/GstPadProbeType/g'       `git grep GstProbeType    | sed -e 's/:.*//' | sort -u`
2011-11-01 00:15:17 +00:00
Edward Hervey
e60fa7cb48 tests: Fix more leaks 2011-10-11 13:54:45 +02:00
Wim Taymans
ea012d3dd7 pad: GST_FLOW_UNEXPECTED -> GST_FLOW_EOS 2011-10-10 11:33:51 +02:00