Commit graph

2665 commits

Author SHA1 Message Date
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
Jan Schmidt
4aeac4b551 gstsegment: Add check for gst_segment_offset_running_time()
Add a check for gst_segment_offset_running_time() that values
are taken directly from the segment base if possible.
2018-08-28 01:54:02 +10:00
Jan Schmidt
260b9791fc gstsegment: Handle positions before the segment properly
Fixes for gst_segment_position_from_running_time_full() when
converting running_times that precede the segment start (or
stop in a negative rate segment)

The return value was incorrectly negated in those cases.

Add some more unit test checks for those cases, and especially
for segments with offsets.
2018-08-28 01:54:02 +10:00
Tim-Philipp Müller
f87d38c186 tests: meta: fix msvc compiler warnings
gstmeta.c(167): warning C4090: 'function': different 'const' qualifiers
gstmeta.c(172): warning C4090: 'function': different 'const' qualifiers
gstmeta.c(211): warning C4090: 'function': different 'const' qualifiers
gstmeta.c(216): warning C4090: 'function': different 'const' qualifiers
2018-08-26 11:45:58 +02:00
Sebastian Dröge
3ee4896bef filesink: Use SYNC_AFTER flag in seeking test
Otherwise it's not guaranteed that buffers are actually on disk after
pushing them, and reading the file via g_file_get_contents() might not
include them yet.
2018-08-17 17:26:17 +03:00
Tim-Philipp Müller
6d34f57cb6 meson: add option to disable build of GStreamer unit test library 2018-08-10 01:23:35 +01:00
Tim-Philipp Müller
ce4698487e meson: add option to disable parse-launch pipeline string parser 2018-08-10 00:08:43 +01:00
Tim-Philipp Müller
e5ad55d649 meson: add options to disable tests, examples, benchmarks and tools
And remove duplicate option 'poisoning' and unused 'build_tools' one.
2018-08-09 23:32:49 +01:00
Nirbheek Chauhan
09f67fe76a meson: Add feature options for optional deps
Everything should be behind an option now.

https://bugzilla.gnome.org/show_bug.cgi?id=795107
2018-07-27 16:14:29 +05:30
Nirbheek Chauhan
38ec95460f meson: Don't add static printf library to executables
They should only need to link to libgstreamer.
2018-07-25 16:02:06 +05:30
Sebastian Dröge
2aa9ad9c62 Revert "pad: Handle changing sticky events in pad probes"
This reverts commit 11e0f451eb.

When pushing a sticky event out of a pad with a pad probe or pad offset,
those should not be applied to the event that is actually stored in the
event but only in the event sent downstream. The pad probe and pad
offsets are conceptually *after* the pad, added by external code and
should not affect any internal state of pads/elements.

Also storing the modified event has the side-effect that a re-sent event
would arrive with any previous modifications done by the same pad probe
again inside that pad probe, and it would have to check if its
modifications are already applied or not.

For sink pads and generally for events arriving in a pad, some further
changes are still needed and those are tracked in
  https://bugzilla.gnome.org/show_bug.cgi?id=765049

In addition, the commit also had a refcounting problem with events,
causing already destroyed events to be stored inside pads.
2018-07-23 23:17:54 +03:00
Olivier Crête
f79b871a6a pipeline tests: Add test for processing latency 2018-07-16 11:54:15 -04:00
Sebastian Dröge
cb51bd6b31 bufferlist: Prevent gst_buffer_list_foreach() from modifying non-writeable lists
Previously gst_buffer_list_foreach() could modify (drop or replace)
buffers in non-writable lists, which could cause all kinds of problems
if other code also has a reference to the list and assumes that it stays
the same.

https://bugzilla.gnome.org/show_bug.cgi?id=796692
2018-07-09 09:45:45 +02:00
Sebastian Dröge
111faa58c0 buffer: Add test to ensure that memories in a non-writable buffer are not writable
https://bugzilla.gnome.org/show_bug.cgi?id=796692
2018-07-09 09:45:45 +02:00
Sebastian Dröge
13a45c0a38 bufferlist: Add test to ensure that buffers in an non-writable list are not writable
https://bugzilla.gnome.org/show_bug.cgi?id=796692
2018-07-09 09:45:45 +02:00
Tim-Philipp Müller
2db8e3705f Update for g_type_class_add_private() deprecation in recent GLib
https://gitlab.gnome.org/GNOME/glib/merge_requests/7
2018-06-24 12:49:14 +02:00
Guillaume Desmottes
6dba0d91ed gst_structure_to_string: display actual value of pointers
We used to always display "NULL" which was pretty confusing when
debugging.

https://bugzilla.gnome.org/show_bug.cgi?id=794355
2018-06-15 11:37:24 +02:00
Sreerenj Balachandran
9ad634029a bitwriter: Add unit tests
https://bugzilla.gnome.org/show_bug.cgi?id=707543
2018-05-06 17:05:27 +02:00
Nirbheek Chauhan
4fb02fc85b meson: Update option names to omit disable_ and with- prefixes
Also yield common options to the outer project (gst-build in our case)
so that they don't have to be set manually.
2018-05-05 20:30:43 +05:30
Tim-Philipp Müller
a5ecb465a9 bufferlist: fix abort due to underflow when creating 0-sized list
gst_buffer_list_new_sized(0) will cause an underflow in a calculation
which then makes it try to allocate huge amounts of memory, which
may lead to aborts.

https://bugzilla.gnome.org/show_bug.cgi?id=795758
2018-05-05 16:20:05 +02:00
luz.paz
98200ddd8d Source code typo fixes
https://bugzilla.gnome.org/show_bug.cgi?id=795610
2018-05-01 11:25:21 +01:00
luz.paz
4a402c1c7d Fix typos in comments and docs
Found via `codespell`

https://bugzilla.gnome.org/show_bug.cgi?id=795610
2018-05-01 11:18:03 +01:00
Thibault Saunier
11e0f451eb pad: Handle changing sticky events in pad probes
In the case where the user sets a new padprobeinfo->data in a probe
where the data is a sticky event, the new sticky event should be automatically
sticked on the probed pad.

https://bugzilla.gnome.org/show_bug.cgi?id=795330
2018-04-17 13:36:26 -03:00
Mathieu Duponchelle
03e27aa5f0 API: gst_queue_array_peek_nth
https://bugzilla.gnome.org/show_bug.cgi?id=795157
2018-04-14 00:14:56 +02:00
Jan Alexander Steffens (heftig)
6436437d83 gstinfo: fix debug levels being applied in the wrong order
Remove unneeded reapplication of patterns. Besides being
superfluous (gst_debug_reset_threshold already applies
patterns) it was also wrong and didn't stop checking patterns
after the first match (broken in 67e9d139).

Also fix up unit test which checked for the wrong order.

https://bugzilla.gnome.org/show_bug.cgi?id=794717
2018-04-05 11:00:09 +01:00
Nicolas Dufresne
ca89302234 test: Pool now try to reset the size
As a side effect, buffers are no longer expected to be discarded on
resize.
2018-03-21 20:02:50 -04:00
Olivier Crête
23b32d5600 queue: Ignore thresholds if a query is queued
The queue gets filled by the tail, so a query will always be the tail
object, not the head object. Also add a _peek_tail_struct() method to the
GstQueueArray to enable looking at the tail.

With unit test to prevent future regression.

https://bugzilla.gnome.org/show_bug.cgi?id=762875
2018-03-01 16:31:57 -05:00
Mathieu Duponchelle
8c10f1e2b4 gstaggregator: pads must inherit from #GstAggregatorPad
Document this, and take advantage of that fact to use
GstAggregator.srcpad.segment instead of GstAggregator.segment

https://bugzilla.gnome.org/show_bug.cgi?id=793942
2018-03-01 15:25:53 +01:00