By only having it on sinkpad-creation, it is racy to write a test
with a sometimes-pad (like a demuxer) that you want to pull from, having
the pull wait until the pad arrives and the buffer can be produced.
For the query function there's a risk that the function may be called
after the harness has been teared down. Since the function accesses a
pointer to the harness via the pad's data, the harness must protect
itself against this.
Event and chain function is also handled for constistency, although
they don't have the same problem since the gstpad.c checks whether the
pad is flushing before calling these.
gstharness.c: Use G_GSIZE_FORMAT instead of hard-coding %zu
error: unknown conversion type character 'z' in format [-Werror=format]
gst-inspect.c: GPid is void* on non-UNIX, and we only use it on UNIX
error: initialization makes pointer from integer without a cast [-Werror]
gstmeta.c: Use and then discard value
error: value computed is not used [-Werror=unused-value]
With this, gstreamer builds with -Werror on MinGW
Without this bindings get confused about the meaning of references, and
we really own these references if they are not already owned by
something else.
By moving the functionality down to the testclock, the implementation
no longer needs to poll the waits, but rather wait properly for
them to be added.
The performance-hit here would be that by polling the test-clock
regularly, you would create contention on the testclock-lock, making code
using the testclock (gst_clock_id_wait) fighting for the lock.
Convenience function to just grab all pending data
from the harness, e.g. if we just want to check if
it matches what we expect and we don't care about
the chunking or buffer metadata.
Based on patch by: Havard Graff <havard.graff@gmail.com>
gst_harness_new_parse() returns without any error even if it doesn't
find the specified element. Then a succeeding call to
gst_harness_set_sink_caps_str() causes an error like this:
Unexpected critical/warning: gst_pad_push_event: assertion 'GST_IS_PAD (pad)' failed
This is a bit cryptic and doesn't give users any clue what was going
on.
gst_harness_new_parse() calls gst_harness_add_parse() with a newly
created empty harness and the given pipeline description string, but
gst_harness_add_parse() does not have a way to propagate the error
back to the caller. Since the function, gst_harness_add_parse(), is a
public API, it's not a good idea to change its signature. This patch,
instead, makes the function to g_error() when it discovers any error.
With this change the same error prints:
** (myelement-test:25345): ERROR **: Unable to create pipeline 'bin.( myelement )': no element "myelement"
The current implementation of gst_parse_launch_full() doesn't return
partially constructed pipeline when GST_PARSE_FLAG_FATAL_ERRORS is
specified, however, this patch also adds a check for it.
https://bugzilla.gnome.org/show_bug.cgi?id=781958
Similar to the stress test functions for buffers that has a callback to
create the buffer to be pushed, it's useful to have functions that use a
callback to create the event to be pushed.
API: gst_harness_stress_push_event_with_cb_start()
API: gst_harness_stress_push_event_with_cb_start_full()
API: gst_harness_stress_send_upstream_event_with_cb_start()
API: gst_harness_stress_push_upstream_event_with_cb_start_full()
https://bugzilla.gnome.org/show_bug.cgi?id=761932
Depending on when gst_harness_pull was called - before the buffer reached
gst_harness_chain or after we can get different behaviors of the test
with enabled blocking push mode. The fix makes the behavior always the
same. In pull function we get the buffer first, thus making sure
gst_harness_chain waits for the signal, and emitting the signal after.
https://bugzilla.gnome.org/show_bug.cgi?id=761931
Set the sink_forward_pad to NULL before tearing down sink_harness to
avoid that the harness tries to forward events/queries to it while it's
tearing down.
https://bugzilla.gnome.org/show_bug.cgi?id=761904
In order for gst_harness_new_full to be MT-safe the increase and
decrease of HARNESS_REF must be MT-safe. This allows for creating
multiple harnesses from different threads wrapping the same element.
https://bugzilla.gnome.org/show_bug.cgi?id=754661
1. Get a list of pad templates from the element class, not the
factory. This allows us to interact with test-elements that does
not have a factory.
2. Use the pad_template_caps in caps-queries when caps is not set
explicitly on the pad. Not doing so is simply wrong, and prohibits
interactions with special templates used for testing.
https://bugzilla.gnome.org/show_bug.cgi?id=754193
To be able to disable the slightly "magic" forwarding of the
necessary events between the harnesses.
Also introduce a new test-suite for GstHarness, that documents the
feature, and should hopefully expand into documenting most of the
features the harness possesses.
https://bugzilla.gnome.org/show_bug.cgi?id=752746
Even though asserts can't be disabled in GstHarness, Coverity still
complains about running code inside them. Moving the code to outside the
g_asserts().
CID #1311326, #1311327, #1311328
By introducing gst_harness_add_src_harness and gst_harness_add_sink_harness
we collect all sub-harness setup in one function, making the previous
sub-harness creation functions now calls these directly, and making it
much easier (and less error-prone) to add your own src or sink-harness
using the more generic harness-creation functions.