Commit graph

17733 commits

Author SHA1 Message Date
Tim-Philipp Müller 7ea4152323 gstvalue: allocate slightly larger than needed tables at startup
If we pre-allocate only *exactly* as many nodes as we need for the
core types, we are practically guaranteed a re-alloc when external
code like GstVideoTimeCode or GstEncodingProfile register their
own GstValue things. So allocate a bit more than strictly needed.
2017-11-23 13:56:51 +01:00
Mathieu Duponchelle c01949a99e pad templates: Allow specifying GType
See https://bugzilla.gnome.org/show_bug.cgi?id=731301

https://bugzilla.gnome.org/show_bug.cgi?id=789986
2017-11-22 16:44:08 +01:00
Tim-Philipp Müller 02d678a2f8 win32: update for latest promise api changes 2017-11-22 15:59:39 +01:00
Matthew Waters 86abf49c23 gst: add a promise object
An object that can be waited on and asked for asynchronous values.
In much the same way as promise/futures in js/java/etc

A callback can be installed for when the promise changes state.

Original idea by
Jan Schmidt <jan@centricular.com>

With contributions from
Nirbheek Chauhan <nirbheek@centricular.com>
Mathieu Duponchelle <mathieu@centricular.com>

https://bugzilla.gnome.org/show_bug.cgi?id=789843
2017-11-23 00:48:30 +11:00
Edward Hervey 40c5396c24 registrychunks: Make sure we use aligned memory
This is in the same vein as for all other features. Some systems
might not allow unaligned read.
2017-11-20 17:01:04 +01:00
Tim-Philipp Müller b8b03f69b0 tools: gst-inspect: stop printing element state_change function
This is really not interesting at all, not sure why we print this.
2017-11-17 00:15:17 +00:00
Tim-Philipp Müller 465094f071 tools: gst-inspect: fix double empty line after pad templates 2017-11-17 00:14:35 +00:00
Edward Hervey d915dd4b20 gstpad: Make pad (de)activation atomic
The following could happen previously:
* T1: calls gst_pad_set_active()
* T2: currently (de)activating it
* T1: gst_pad_set_active() returns, caller assumes that the pad has
  completed the requested (de)activation ... whereas it is not
  the case since the actual (de)activation in T2 might still be
  going on.

To ensure atomicity of pad (de)activation, we use a internal
variable (and cond) to ensure only one thread at a time goes through
the actual (de)activation block

https://bugzilla.gnome.org/show_bug.cgi?id=790431
2017-11-16 10:55:36 +01:00
Edward Hervey 80262013ca gstpad: Make calls to GstPadActivateFunction MT-safe
checking whether we already were in the target GstPadMode was being
done too early and there was the risk that we *would* end up
(de)activating a pad more than once.

Instead, re-do the check for pad mode when entering the final pad
(de)activation block.

https://bugzilla.gnome.org/show_bug.cgi?id=790431
2017-11-16 08:29:22 +01:00
Nicolas Dufresne 7595c38a73 paramspec: Move condition check inside the g_return
It's mostly a debug check and crash avoidance, it's better to
keep all the condition inside the macro.
2017-11-10 12:09:41 -05:00
Nicolas Dufresne 98f4ff8331 paramspec: Add missing since for _spec_array() 2017-11-10 12:09:41 -05:00
Edward Hervey f03443f90c concat: Handle single-pad use-cases
When EOS reaches concat, it will switch to the next candidate as its
activate pad.

The problem arises when there is only one sinkpad, the "active" pad
becomes NULL. This results in concat becoming unusable after it receives
a *single* EOS on its single sinkpad.

If we detect there is a single sinkpad and there is no current active pad:
* If we are waiting (from selected sink event/buffer), become the current
  active pad.
* If there is a seek request, send it upstream. We don't switch the
  active_sinkpad property at that point in time, since the seek could
  fail. If the seek succeeds, the following SEGMENT (or STREAM_START)
  will cause the pad_wait() to elect that pad as the new active one.
* Flush events get forwarded

https://bugzilla.gnome.org/show_bug.cgi?id=790167
2017-11-10 14:15:46 +01:00
Edward Hervey 08ad748ced concat: Make QoS forward MT-safe
In the same way it's done for other event forwarding.
2017-11-09 17:41:51 +01:00
Guillaume Desmottes 4670036691 latency tracer: add timestamp to tracer records
Include the timestamp of the recorded log as in the 'stats' tracer.
This can be useful, for example, to plot a graph showing the latency
over time.

https://bugzilla.gnome.org/show_bug.cgi?id=781315
2017-11-04 13:51:00 -04:00
Edward Hervey 40187f9247 typefindhelper: Fix overflow some more
Nothing guaranteed that off+size wouldn't exceed a 2**64 value.

Instead we reverse the operation and use a subtraction.
2017-11-04 11:48:40 +01:00
Edward Hervey 4ccdad084b typefindhelper: Fix signed integer overflow
Make sure the whole calculation is done with 64bit unsigned values

(To be ready for people want to typefind exabyte files).
2017-11-04 10:34:10 +01:00
Tim-Philipp Müller d106390adc element: add gst_element_foreach_*pad()
Add convenience API that iterates over all pads, sink pads or
source pads and makes sure that the foreach function is called
exactly once for each pad.

This is a KISS implementation. It doesn't use GstIterator and
doesn't try to do clever things like resync if pads are added
or removed while the function is executing. We can still do that
in future if we think it's needed, but in practice it will
likely make absolutely no difference whatsoever, since these
things will have to be handled properly elsewhere by the element
anyway if they're important.

After all, it's always possible that a pad is added or removed
just after the iterator finishes iterating, but before the
function returns.

This is also a replacement for gst_aggregator_iterate_sink_pads().

https://bugzilla.gnome.org/show_bug.cgi?id=785679
2017-11-02 15:59:22 +00:00
Mathieu Duponchelle f911fe4314 gstleaks.c: always log leaks listing
https://bugzilla.gnome.org/show_bug.cgi?id=789556
2017-11-02 14:53:48 +01:00
Sebastian Dröge 4c795924db net: Add new file to the meson.build 2017-11-01 12:27:31 +02:00
Sebastian Dröge ab7efda48d examples/netclock-replay: Fix build 2017-11-01 11:31:52 +02:00
Robert Rosengren 5d885b9dc7 netutils: Add util for setting socket DSCP
Util function for setting QoS DSCP added, to remove duplicated code in
netclientclock and nettimeprovider. Fix build error if missing IP_TOS.

https://bugzilla.gnome.org/show_bug.cgi?id=784737
2017-11-01 11:00:47 +02:00
Edward Hervey fb56ad6bee gstvalue: Cast GST_MAKE_FOURCC arguments
To make it explicit that we are dealing with uint32 targets

Avoids erroneous  runtime error: left shift of negative value -1

https://bugzilla.gnome.org/show_bug.cgi?id=789700
2017-10-31 12:02:18 +01:00
Nicolas Dufresne 41e35c334b latency-tracer: Exclude synchronization time
The goal of this tracer is to measure the processing latency between a
src and a sink. In push mode, the time was read after the chain function
have returned. As the amount of time we wait to get synched is reverse
to the amount of latency the source introduced, the result was quite
surprising.

This patch moves the latency calculation in the pre-push hook. When
there is no processing in a a pipeline (e.g. fakesrc ! fakesink), the
latency will now be 0 as it's supposed to. For pull mode, the code was
already correct. When GstBaseSink operate in pull mode, the processing
time is done durring the pull, so pull-post is the right hook. The
synchronization will happen after the pull has ended. Note that
GstBaseSink rarely operate in pull mode.

https://bugzilla.gnome.org/show_bug.cgi?id=788431
2017-10-30 15:33:15 -04:00
Edward Hervey c0c9a531ef event: Don't allow invalid SELECT_STREAMS event creation
Asking to select no streams makes no sense and can create various
issues.

If one doesn't one any stream it should deactivate (or not use) the
element in question.
2017-10-27 09:53:06 +02:00
Edward Hervey 4844adf193 gst: Fix build with option parsing disabled 2017-10-25 17:10:15 +02:00
Stefan Sauer 9f2d7d2378 segment: update the tests
Boy scout rule. Make is a little less painful to debug the tests by using
fail_unless_equals_{uint64,int64,float} where appropriate. Ideally the large
tests would be splitted to avoid guessing data dependencies.
2017-10-20 17:28:11 +02:00
Stefan Sauer 05ce354d3e segment: clarify the segment docs for the duration 2017-10-20 16:15:01 +02:00
Stefan Sauer 38dd43df29 Revert "segment: also intialize the duration"
This reverts commit f1baaae175.
2017-10-20 16:11:44 +02:00
Stefan Sauer f1baaae175 segment: also intialize the duration
If start and stop are set, calculate the duration and set it too.
2017-10-20 14:30:42 +02:00
Stefan Sauer 875903be3f gst-inspect: print more details for typefind and tracer features
Print full details for typefind features. Print some of the available features
for tracers and add some todos for the ones we'd like to see.
2017-10-20 13:13:52 +02:00
Stefan Sauer ef660a21d6 gst-inspect: reduce casting back and forth
Refactor the print_element_info() to take a GstPluginFeature. Reduces the need
to cast to and from GstElementFactory.
2017-10-20 11:16:46 +02:00
Stefan Sauer 2354c5b152 gst-inspect: simplify the code for printing feature info
Rename print_element_features() to print_feature_info() and move the code that
handles the ElementFactory there. This simplifies the calling code and improves
readability.

Also don't leak the features for other factories.
2017-10-20 11:11:37 +02:00
Robert Rosengren 4c8058272e netclientclock: Add possibility to set QoS DSCP value
https://bugzilla.gnome.org/show_bug.cgi?id=784737
2017-10-19 16:14:17 +02:00
Robert Rosengren a3e1fca7ee nettimeprovider: Add possibility to set QoS DSCP value
https://bugzilla.gnome.org/show_bug.cgi?id=784737
2017-10-19 16:14:17 +02:00
Jan Schmidt 6adb6b478f seqnum: Never return a seqnum of 0, reset GST_SEQNUM_INVALID
Various plugins use the value of '0' as an invalid seqnum value
(qtdemux for matching duplicated seek events, for example). Make
that behaviour explicit, create a GST_SEQNUM_INVALID value,
and ensure gst_util_seqnum_next never returns it.
2017-10-18 02:31:12 +11:00
Ashish Kumar 250d3e7284 queuearray: Fix for possible crashes due to null pointer dereferencing
https://bugzilla.gnome.org/show_bug.cgi?id=788838
2017-10-16 14:04:58 +03:00
Stefan Sauer 7eea54d6a1 collectpads: mention the query function in the docs as well 2017-10-15 15:59:11 +02:00
Mathieu Duponchelle e838007d09 gstbuffer: fix meta removal in gst_buffer_foreach_meta
When updating the linked list, prev->next = next is correct
if prev is actually updated after being set to the head
of the list at the start.

https://bugzilla.gnome.org/show_bug.cgi?id=788617
2017-10-11 19:57:04 +02:00
fengalin 6617b01af9 flowcombiner: Fix version for ref and unref functions
The functions were introduced in version 1.12.1, GstFlowCombiner was
introduced in 1.4.

https://bugzilla.gnome.org/show_bug.cgi?id=788778
2017-10-10 18:39:26 +03:00
Tim-Philipp Müller 2841b8f0b2 basesink: use new gst_buffer_list_calculate_size() utility function 2017-10-05 13:35:14 +01:00
Ashish Kumar 0ca70247fc device-provider: gst_device_provider_unhide_provider() always fails
https://bugzilla.gnome.org/show_bug.cgi?id=788520
2017-10-05 09:42:39 +01:00
Havard Graff fee176d253 meson: remove vs_module_defs
The GST_EXPORT should handle it.
2017-10-05 09:35:41 +01:00
Reynaldo H. Verdejo Pinochet 402159fb88 Use proper GtkDoc notation for NULL/FALSE/TRUE 2017-10-03 13:54:25 -07:00
Edward Hervey ebad8c0094 bin: iterate_sorted: Ensure sources are always returned last
For linked elements, the resulting gst_bin_iterate_sorted() will
properly return elements from sink to sources.

If we have some elements that are not linked, we *still* want to
ensure that we return:
* In priority any sinks
* Last of all any sources
* And in between any element which is neither source nor sink

For this to work, when looking for the next candidate element,
not only check the degree order, but if there are two candidates
with the same degree order, prefer the non-source one.

Amongst other things, this fixes the case where we activating a
bin containing unlinked sources and other elements. Without this
we could end up activating sources (which might start adding pads
to be linked) before other (to which those new source element pads
might be linked) are not activated

https://bugzilla.gnome.org/show_bug.cgi?id=788434
2017-10-03 07:56:39 +02:00
Nicolas Dufresne beab4c8e50 tee-test: Test a real use case
The real use case is when downstream didn't set a pool or
allocation params, in which case we expect the tee to not
create a pool or param from thin air. Dowstream setting
an pool with size=0 was in fact testing a downstream element
bug. The fact we handle that is accidental.
2017-10-02 14:11:19 -04:00
Stefan Sauer 21c3f0ff22 tee: don't create a pool if none is needed
If the aggregated size is 0 and we create a pool, the pool would provide
buffers with no memory assigned. Handle that case and skip the pool.
This was the behaviour before cf803ea9f4.

Add a test for this scenario.

https://bugzilla.gnome.org/show_bug.cgi?id=730758
2017-10-02 13:58:04 -04:00
Nicolas Dufresne 944758aeda tee: Re-enabled alloc query + allow-not-linked test
In the unit test refactoring, the unlinked pad required to test
the different behaviour induced by "allow-not-linked" property
was removed.

  Commit e364d7944e

Move all the code for this test in the proper function, and re-add
the missing unlinked pad. This makes the test useful again.
2017-10-02 13:35:52 -04:00
Stefan Sauer e364d7944e tee: split the allocation query test
Split the large allocation_query test into seperate tests. Add a setup helper
to reduce code duplication. Fix the original test that used fail_unless instead
of ck_assert_int_eq and had it accidentially working.
2017-10-02 16:36:54 +02:00
Stefan Sauer eb329eec1c structure: add a todo comment
Printing NULL is confusing when the type is e.g. a GArray that is not empty.
2017-10-02 16:23:31 +02:00
Stefan Sauer e584886d06 query: doc consistency
Mention that it is the 'buffer size', like we do elsewhere.
2017-10-02 13:14:21 +02:00