Commit graph

2692 commits

Author SHA1 Message Date
Mathieu Duponchelle
0dafe6e639 gstvalue: use value_nick for serialization
not value_name . This was causing incorrect launch lines to be
displayed by gst-device-monitor, and the deserialization code
below works with nicks.
2019-09-17 01:09:05 +00:00
Sebastian Dröge
04a7334140 info: Deprecate gst_debug_category_free()
And change it to do nothing at all.

As debug categories don't use reference counting and they can be
retrieved from anywhere at any time by name, it is fundamentally unsafe
to free them at any point in time except for right before the end of the
process.

No code apart from a unit test seems to be currently using the function,
so deprecate it and also change it to do nothing at all.
2019-07-15 11:35:07 +03:00
Nirbheek Chauhan
b3c4ed7144 tests: Add test for new activity-tracking leaktracer API 2019-07-02 15:13:26 +05:30
Nirbheek Chauhan
5524137d7e tests: Add test for new live-objects leaktracer API
Needs a valgrind suppression for:

==11119== Warning: invalid file descriptor -1 in syscall close()
==11119== Warning: invalid file descriptor -1 in syscall close()
==11119== Syscall param write(buf) points to uninitialised byte(s)
==11119==    at 0x4C4AFAD: syscall (in /usr/lib64/libc-2.29.so)
==11119==    by 0x4E70DF9: write_validate (Ginit.c:112)
==11119==    by 0x4E70DF9: UnknownInlinedFun (Ginit.c:148)
==11119==    by 0x4E70DF9: mincore_validate (Ginit.c:131)
==11119==    by 0x4E70CC3: UnknownInlinedFun (Ginit.c:208)
==11119==    by 0x4E70CC3: access_mem (Ginit.c:242)
==11119==    by 0x4E75536: UnknownInlinedFun (libunwind_i.h:168)
==11119==    by 0x4E75536: apply_reg_state (Gparser.c:863)
==11119==    by 0x4E75A71: _ULx86_64_dwarf_step (Gparser.c:952)
==11119==    by 0x4E71BD3: _ULx86_64_step (Gstep.c:71)
==11119==    by 0x48BAF47: generate_unwind_trace (gstinfo.c:2726)
==11119==    by 0x48BC92E: gst_debug_get_stack_trace (gstinfo.c:2908)
==11119==    by 0x49B2BB2: handle_object_created.part.0 (gstleaks.c:384)
==11119==    by 0x488134E: gst_object_constructed (gstobject.c:141)
==11119==    by 0x49EC61B: g_object_new_internal (gobject.c:1845)
==11119==    by 0x49EE347: g_object_new_valist (gobject.c:2128)
==11119==    by 0x49EE69C: g_object_new (gobject.c:1648)
==11119==    by 0x48CA59D: gst_pad_new_from_template (gstpad.c:867)
==11119==    by 0x68C209E: gst_base_src_init (gstbasesrc.c:454)
==11119==    by 0x4A0A0C3: g_type_create_instance (gtype.c:1858)
==11119==    by 0x49EC42C: g_object_new_internal (gobject.c:1805)
==11119==    by 0x49EDB14: g_object_new_with_properties (gobject.c:1973)
==11119==    by 0x49EE6C0: g_object_new (gobject.c:1645)
==11119==    by 0x48AF91A: gst_element_factory_create (gstelementfactory.c:372)
==11119==  Address 0x1ffeffe000 is on thread 1's stack
==11119==  in frame #6, created by generate_unwind_trace (gstinfo.c:2695)

Fixed in libunwind commit:
b256722d49

Needs a separate suppression for Debian because the callstack is
different there.
2019-07-02 15:13:26 +05:30
Nicolas Dufresne
8a9b20a18b bufferpool: Fix the buffer size reset code
The offset in gst_buffer_resize() is additive. So to move back the
offset to zero, we need to pass the opposite of the current offset. This
was raised through the related unit test failingon 32bit as on 64bit
the alignment padding was enough to hide the issue. The test was
modified to also fail on 64bit. This patch will remove spurious
assertions like:

  assertion 'bufmax >= bufoffs + offset + size' failed

Fixes #316
2019-07-01 16:49:04 -04:00
Carlos Rafael Giani
6412988975 basesrc: Add public gst_base_src_negotiate () function
This is useful for when format changes occur mid-stream.
2019-07-01 11:16:09 +02:00
Nicolas Dufresne
91543bd78d testclock: Allow calling crank with a past entry
At the moment, we can only use crank if the pending entry is in the
future. This patch leaves the clock time to the same point if the
pending entry was in the past. This still execute a single entry. This
will be needed for the jitterbuffer, since as soon as we stop waking up
the jitterbuffer when the timer is reschedule later, we may endup with
such case in the unit tests.

Related to #608
2019-06-27 20:09:43 +00:00
Mathieu Duponchelle
25383eaa5c aggregator: refactor flushing logic
Instead of tracking "pending_flush_*" on the pads and the
aggregator, we now simply track the last seqnum for flush start
and flush stop events on the pads, and use it to determine whether
we should enter or exit our flushing state.

See https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/issues/977
2019-06-10 23:04:31 +02:00
Mathieu Duponchelle
7cc933dec7 valgrind: revert generic suppression of ld-related errors
the replacement suppression casts way too large a net, ignoring
all leaks in the main thread
2019-06-06 03:47:05 +02:00
Mathieu Duponchelle
2fadd20cc9 valgrind: ignore dlopen leaks when parsing launch lines 2019-06-06 00:04:51 +00:00
Mathieu Duponchelle
c7e4497a53 valgrind: suppress intentional debug list item leak 2019-06-06 00:04:51 +00:00
Niels De Graef
56d19cbf75 meson: Bump minimal GLib version to 2.44
This means we can use some newer features and get rid of some
boilerplate code using the `G_DECLARE_*` macros.

As discussed on IRC, 2.44 is old enough by now to start depending on it.
2019-06-03 08:51:40 +02:00
Sebastian Dröge
744687e537 dataurisrc: Add test that checks various URIs against their expected output 2019-05-23 18:53:35 +02:00
Edward Hervey
7aee718394 gstpad: Probes that return HANDLED can reset the data info field
Before GST_PAD_PROBE_HANDLED was introduced, we had to handle the case
where some probes would reset the probe info data field to NULL. This would
be considered an invalid use-case.

But with GST_PAD_PROBE_HANDLED it is totally fine to reset that, since
the probe has "handled" it.
2019-05-16 15:13:48 +02:00
Mathieu Duponchelle
5f21596795 tests: basesrc: unref gst_bus_timed_pop_filtered return 2019-04-17 23:03:56 +02:00
Mathieu Duponchelle
fee108f7cf basesrc: do not send EOS when automatic_eos is FALSE 2019-04-05 18:00:29 +00:00
Mathieu Duponchelle
2fa15d5371 event: add new seek parameter, "trickmode-interval"
When performing a key unit trickmode seek, it may be useful to
specify a minimum interval between the output frames, either
in very high rate cases, or as a protection against streams
that may contain an overly large amount of key frames.

One use case is ONVIF Section 6.5.3:

<https://www.onvif.org/specs/stream/ONVIF-Streaming-Spec.pdf>
2019-04-01 17:13:32 +00:00
Antonio Ospite
763d01f437 tests: add the valgrind suppression file from the "common" module
Other gstreamer repositories have their own valgrind suppression file
directly in the repository.

Add a suppression file to the core gstreamer repository too, this makes
it easier to use it with gst-build which does not check out the common
module.

This is also a little step towards the removal of the common submodule.

NOTE: the added file is the latest version from the "common" repository
but it has been renamed from gst.supp to gstreamer.supp for symmetry
with the suppression files in the other repositories.
2019-03-24 18:11:41 +00:00
Seungha Yang
ec0e4ae0c3 tests: fdsrc: Exclude unit test on Windows
Since elements_fdsrc.test_num_buffers uses blocking pipe on Windows,
the test will never be finished. But emulating non-blocking fd without
win32 APIs on Windows is a little tricky.
2019-03-10 11:48:31 +00:00
Tim-Philipp Müller
dfd9fd7f82 tests: fix leak in buffer test_wrapped_bytes test 2019-03-06 09:04:54 +00:00
Mathieu Duponchelle
5dc149f4f2 gstbuffer: store meta in add order
The previous implementation of add was implemented as a prepend,
switch to append as that seems like the expected order.
2019-03-04 12:57:02 +00:00
Tim-Philipp Müller
f62ee97592 buffer: store sequence number for metas
For metas where order might be significant if multiple metas are
attached to the same buffer, so store a sequence number with the
meta when adding it to the buffer. This allows users of the meta
to make sure metas are processed in the right order.

We need a 64-bit integer for the sequence number here in the API,
a 32-bit one might overflow too easily with high packet/buffer
rates. We could do it rtp-seqnum style of course, but that's a
bit of a pain.

We could also make it so that gst_buffer_add_meta() just keeps metas in
order or rely on the order we add the metas in, but that seems too
fragile overall, when buffers (incl. metas) get merged or split.

Also add a compare function for easier sorting.

We store the seqnum in the MetaItem struct here and not in the
GstMeta struct since there's no padding in the GstMeta struct.
We could add a private struct to GstMeta before the start of
GstMeta, but that's what MetaItem effectively is implementation-
wise. We can still change this later if we want, since it's all
private.

Fixes #262
2019-02-12 17:53:08 +00:00
Nirbheek Chauhan
febfabb39f misc: Fix various compiler warnings on MinGW
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
2019-02-05 18:45:54 +05:30
Edward Hervey
ef8f045ff9 test: Set PTS on proper variable
This would previously set the PTS on a random address causing various
memory corruption
2019-01-29 12:01:59 +01:00
Seungha Yang
5b19d30d24 tests: info: Fix spurious validation
Should be equality check, not assignment.
Additionally, use fail_unless_equals_* macro for better readability
and debugging easier, if possible.
2019-01-24 10:14:18 +09:00
Jordan Petridis
20ee2db955
tests: gstdatetime: move gst_date_time_new* and time() calls closer
While extremelly rare, time and gst_date_time_new_* will have
diff values and potentially trigger an assertion. Thus move
the calls as closely together as possible to mitigate this.
2019-01-11 12:54:54 +02:00
Jan Alexander Steffens (heftig)
a129b7df9c tests: Add more int range fixation tests 2019-01-09 23:03:08 +00:00
Sebastian Dröge
74b9e72ec6 pipeline: Call gst_task_cleanup_all() before checking reference counts after shutdown
We have to ensure that all background threads from thread pools are shut
down, or otherwise they might not have had a chance yet to drop their
last reference to the pipeline and then the assertion for a reference
count of 1 on the pipeline fails.
2019-01-03 14:05:31 +00:00
Sebastian Dröge
8b58cb03b2 pipeline: Use the test clock in all unit tests
And check for exact times as we can now do that thanks to the test clock
being deterministic.

Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/issues/313
2019-01-03 14:05:31 +00:00
Tim-Philipp Müller
156d33f30a tests: remove unused gststream.h file
Looks like an earlier version of the .c file.
2018-12-31 15:25:11 +00:00
Seungha Yang
2c0951774b tests: datetime: Fix failure on Windows
The documentation for WIN32 mktime indicates that for struct tm*
before January 1, 1970, that -1 is returned, and since mktime is timezone
dependent, the struct tm corresponding to 1:00, Jan. 1, 1970 might be failed.

See also
https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/mktime-mktime32-mktime64
2018-12-17 23:37:59 +09:00
Edward Hervey
fe6c905659 examples: Remove dead assignments
Those values are always set after before usage
2018-12-15 11:08:09 +01:00
Sebastian Dröge
2682f378c8 pad: Let threads in the test take ownership of a strong reference to their pads
Otherwise it can easily happen that the pad is destroyed before the
thread disappears, as happened sometimes in the test_pad_probe_block_add_remove
test where joining of the thread was done *after* the pad was unreffed
and destroyed.

Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/issues/339
2018-12-14 18:38:21 +02:00
Guillaume Desmottes
e03f086fae gstcaps: add gst_caps_set_features_simple()
Convenient helper setting a caps feature on all the structures of a
caps.
2018-12-11 16:39:30 +01:00
Dardo D Kleiner
ec5e781e6b buffer: Add more exhaustive test for gst_buffer_foreach_meta() meta removal
Existing test for iterating/removing buffer meta data was insufficient
to detect linked list corruption when removing multiple items, and could
also suffer from such corruption in attempting to count remaining items.
Modified the one test and added several others to exercise multiple
scenarios.

Validates fix for issue #332.
2018-12-05 20:50:45 +00:00
KimTaeSoo
afcae3f05b baseparse: Add unit test for short reads
Before the previous commit, buffer pulling count and chain function call
counts are not equal due to EOS. After the modification, these counts
are equal so unit test is passing.

https://gitlab.freedesktop.org/gstreamer/gstreamer/merge_requests/33
https://gitlab.freedesktop.org/gstreamer/gstreamer/issues/294
2018-11-28 17:46:12 +02:00
Jordan Petridis
84512152c1
Run gst-indent through the files
This is required before we enabled an indent test in the CI.

https://gitlab.freedesktop.org/gstreamer/gstreamer-project/issues/33
2018-11-28 05:58:53 +02:00
Seungha Yang
94ac598204 tests: caps: Add more broken caps test case 2018-11-12 20:12:50 +09:00
Havard Graff
1335110409 tests: fix tests when compiling with glib_checks=disabled
We won't be able to do ASSERT_CRITICAL, but the main body of the tests
are still valid, and given we ship GStreamer with this configuration, it
is important to be able to run some tests against it.
2018-11-10 15:37:36 +00:00
Havard Graff
320ac0ce1a test/datetime: fix test for windows
In the previous configuration, mktime returned -1 on Windows 10 compiled
with MSVC using meson.

Fix this by moving the hour one forward.
2018-11-10 15:37:36 +00:00
Havard Graff
4a7739f4b6 tests/uri: fix test after GHashTable changes in GLib 2.59
Maybe the implementation should not be dependent on a "random" hash-table
ordering, but at least this shows the problem clearly.
2018-11-10 15:37:36 +00:00
Matthew Waters
4fc4ad87d5 query: add a new bitrate query
Allows determining from downstream what the expected bitrate of a stream
may be which is useful in queue2 for setting time based limits when
upstream does not provide timing information.

Implement bitrate query handling in queue2

https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/issues/60
2018-11-07 15:04:14 +00:00
Havard Graff
4b3872f757 gstpad: use hook_id instead of hook in called_probes list
A pointer to a hook in this list can easily not be unique, given both
the slice-allocator reusing memory, and the OS re-using freed blocks
in malloc.

By doing many repeated add and remove of probes, this becomes very easily
reproduced.

Instead use hook_id, which *is* unique for a added GHook.
2018-11-06 10:04:00 +01:00
Matthew Waters
ddfcc28c8b gst/buffer: add a new function for wrapping GBytes
One restriction on the GBytes is that the data cannot be NULL as this is
explicitly forbidden by GstMemory.

Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/issues/318
2018-11-06 16:12:42 +11:00
Jan Schmidt
80015d69a7 segment: Allow stop == -1 in gst_segment_to_running_time() and rate < 0
If a segment has stop == -1, then gst_segment_to_running_time()
would refuse to calculate a running time for negative rates,
but gst_segment_do_seek() allows this scenario and uses a
valid duration for calculations.

Make the 2 functions consistent by using any configured duration
to calculate a running time too in that case.

https://bugzilla.gnome.org/show_bug.cgi?id=796559
2018-10-29 04:03:56 +11:00
Olivier Crête
5658ae9986 tests: Use GstTestClock for processing-deadline test
Use the test clock instead of using a real one to make it
easier to run in valgrind.

https://bugzilla.gnome.org/show_bug.cgi?id=797291
2018-10-17 16:42:50 -04:00
Tim-Philipp Müller
5947ff970e tests: pipeline: fix leak 2018-10-16 10:48:40 +01:00
Tim-Philipp Müller
af5717b364 tests: netclock-replay: fix build with new api export/import
Can't mix/match imports and exports from the same library
here, so just include all .c files needed instead and don't
link to gstnet at all then.

https://bugzilla.gnome.org/show_bug.cgi?id=797185
2018-09-24 08:39:39 +01:00
Jan Schmidt
01758dcf6a tests: Use a different rate in a segment test.
Using a rate of 1.1 in the test is causing the test to
fail on 32-bit because ceil(1.1 * 10) can round to 12.

Instead use a rate 2.0 that can be expressed as floating
point number and doesn't trigger the problem.

https://bugzilla.gnome.org/show_bug.cgi?id=797154
2018-09-17 22:13:22 +10:00
Nirbheek Chauhan
cbd02b9584 meson: Always use a dependency object for dependencies
Fixes a configure error with gst-build:

subprojects/gst-plugins-base/meson.build:235:2: ERROR:  Fetched variable 'gst_check_dep' in the subproject 'gstreamer' is not a dependency object.
2018-09-05 16:33:43 +05:30