Commit graph

7981 commits

Author SHA1 Message Date
Matthew Waters
e8c8c27ae8 utils: check the correct element's state on ghosting pads
Checking the current element's state when we're adding pads to
the parent element is checking the wrong thing.

Silences a 'attempting to add an inactive pad to a running element'
warning when adding a ghost pad to a running parent bin of the parent
bin of the element.

https://bugzilla.gnome.org/show_bug.cgi?id=764176
2016-04-06 23:26:41 +10:00
Matthew Waters
f876306638 utils: expose pad_link_maybe_ghosting
This is a useful function to automatically add ghost pads when linking
two elements across bin boundaries without know their exact parentage.

e.g. when using gst_parse_bin_from_description (with or without it ghosting pads),
one can simply retreive the src/sink pads from the bin to link to another pad.

Similar functionality is provided by gst_element_link_pads{_full}() however only
by pad name rather than by actual pads.

API: gst_pad_link_maybe_ghosting_full

https://bugzilla.gnome.org/show_bug.cgi?id=764176
2016-04-06 23:26:41 +10:00
Mark Combellack
b8f2929dac GST_REFCOUNTING: Add logging of pointer address for dispose, finalize, etc messages
Updated the GST_REFCOUNTING logging so that it includes the pointer
address of the object that is being disposed or finalized.

With this change is is then possible to match up GST_REFCOUNTING log messages
for object allocation/disposal/finalization. This can help with diagnosing
"memory leaks" in applications that have not correctly disposed of all the
GStreamer objects it creates.

https://bugzilla.gnome.org/show_bug.cgi?id=749427
2016-04-02 18:18:10 +01:00
Luis de Bethencourt
1bb699446a info: only open log file when adding it to the log function
This avoids the leak of opening it and then not passing it or closing it
before it goes out of scope.
2016-04-02 10:47:57 +01:00
Sebastian Dröge
c32ea3cb58 clock: Return FALSE in all paths that don't set out parameters in gst_clock_add_observation_unapplied()
It returned TRUE when regression failed, while not setting any of the out
parameters. This caused uninitialized data from the stack to be used for
setting the clock calibration.
2016-04-02 01:34:46 +03:00
Thiago Santos
368ee8a336 pad: rework probe's hook_marshall function
PUSH and PULL mode have opposite scenarios for IDLE and BLOCK
probes.

For PUSH it will BLOCK with some data type and IDLE won't have a type.
For PULL it will BLOCK before getting some data and will be IDLE when
some data is obtained.

The check in hook_marshall was specific for PUSH mode and would cause
PULL probes to fail to be called. Adding different checks for the mode
to fix this issue.

https://bugzilla.gnome.org/show_bug.cgi?id=761211
2016-03-28 11:14:41 -03:00
Thiago Santos
45b0e7aa16 pad: consider PROBE_TYPE_EVENT_FLUSH when using PROBE_TYPE_ALL_BOTH
When GST_PAD_PROBE_EVENT_FLUSH is used, the probes already have
a data type and it is not needed to automatically add the default
types.

https://bugzilla.gnome.org/show_bug.cgi?id=762330
2016-03-28 10:54:11 -03:00
Tim-Philipp Müller
9e83680563 debugutils: fix enum/flag properties printing for elements
We want to use the flag/enum nicks here, not only because they
are shorter but also because in case of element-specific enums
and flags we abuse the enum/flag name field for the description,
and we don't want that printed in the dot file.

https://bugzilla.gnome.org/show_bug.cgi?id=763814
2016-03-26 17:21:51 +00:00
Tim-Philipp Müller
a35dfb1b16 alloctrace: print size and allocator details for buffers and memories 2016-03-26 13:46:58 +00:00
Tim-Philipp Müller
50888062ba info: make it possible to remove default log handler before gst_init()
Make sure it's not even added then, so that we never output
anything via the default log handler then.

https://bugzilla.gnome.org/show_bug.cgi?id=751538
2016-03-26 11:40:43 +00:00
Tim-Philipp Müller
9df4bda65d miniobject, memory, uri: warn on unused return value of some funcs
Make compiler issue a warning for common beginner mistakes such as:

  ...
  gst_buffer_make_writable (buf);
  gst_buffer_map (buf, &map, GST_MAP_WRITE);
  ...

and similar. Only do this for some functions for now.
2016-03-26 11:35:39 +00:00
Tim-Philipp Müller
f02d09c362 registry: allow plugin and feature filter funcs to call registry API
Don't keep the registry locked whilst iterating over the plugins
or features with a filter function. This would deadlock if the
callback tried to access the registry from the function. Instead,
make a copy of the feature/plugin list and then filter it without
holding the registry lock. This is still considerably faster than
the alternative which would be to use a GstIterator.

https://bugzilla.gnome.org/show_bug.cgi?id=756738
2016-03-26 11:13:09 +00:00
Carlos Rafael Giani
fdd5d22828 parse-launch: Add flag for placing elements in a bin instead of a pipeline
By default, gst_parse_launch_full() creates a GstPipeline if there's more
than one toplevel element. Add a flag to let it use a GstBin instead.

Also fix the parser to let it use this flag for GST_TYPE_ELEMENT property
values, to avoid having GstPipelines inside other GstPipelines.

https://bugzilla.gnome.org/show_bug.cgi?id=763457
2016-03-24 14:50:12 +02:00
Vineeth TM
8cc3e908c3 gstreamer: use new gst_element_class_add_static_pad_template()
https://bugzilla.gnome.org/show_bug.cgi?id=763020
2016-03-24 14:43:41 +02:00
Stian Selnes
7dd76b626e pad: Fix race between gst_element_remove_pad and state change
When going from READY to NULL all element pads are deactivated. If
simultaneously the pad is being removed from the element with
gst_element_remove_pad() and the pad is unparented, there is a race
where the deactivation will assert (g_critical) if the parent is lost at
the wrong time.

The proposed fix will check parent only once and retain it to avoid the
race.

https://bugzilla.gnome.org/show_bug.cgi?id=761912
2016-03-24 14:39:47 +02:00
Sebastian Dröge
d7c8ce0947 preset: Use GST_PRESET_PATH as an extension of the system path, not a replacement of the user path
First load all system presets, then all from the environment variable, then
from the app directory, then from the user directory. Any one in the chain
with the highest version completely replaces all previous ones, later ones
with lower versions are merged in without replacing existing presets.

This is basically the same behaviour as before, just that GST_PRESET_PATH is
inserted as another source of directories between the system and app presets.

It was added in ca08af1f17, but was
accidentially overriding the user preset path there. Which caused inconsistent
behaviour as new presets were still stored in the system path, just not loaded
from there. Meaning you could store a new preset (in the user path), just for
GstPreset to not find it anymore later (because it only looked in the
GST_PRESET_PATH instead of the user path).

https://bugzilla.gnome.org/show_bug.cgi?id=764034
2016-03-22 19:32:48 +02:00
Aurélien Zanelli
94036e86c0 utils: add 'transfer full' annotation to gst_pad_peer_query_caps
https://bugzilla.gnome.org/show_bug.cgi?id=763912
2016-03-21 10:23:53 +02:00
Aurélien Zanelli
b7cffa4522 pad: add 'transfer full' and 'nullable' annotations to gst_pad_get_current_caps
and also change the description accordingly since function returns an
incremented caps object or NULL if there is no caps set.

https://bugzilla.gnome.org/show_bug.cgi?id=763912
2016-03-21 10:23:53 +02:00
Ben Iofel
53f2fb93e8 utils: fix gir annotation for gst_element_query_convert()
https://bugzilla.gnome.org/show_bug.cgi?id=763895
2016-03-18 20:35:27 +00:00
Carlos Rafael Giani
f70dc95c35 docs: Flesh out element and object macro accessor docs a bit
https://bugzilla.gnome.org/show_bug.cgi?id=763213
2016-03-10 10:07:07 +00:00
Víctor Manuel Jáquez Leal
c1f2775dcb gstbuffer: fix GstParentBufferMeta GType name
The alias define GST_TYPE_PARENT_BUFFER_META_API_TYPE is wrong and
breaks the usage of gst_buffer_get_parent_buffer_meta().

This patch fixes the GType alias and make another alias to keep the API
compatibility guarded by GST_DISABLE_DEPRECATED.

Also added a unit test.

https://bugzilla.gnome.org/show_bug.cgi?id=763112
2016-03-07 12:02:00 +01:00
Sebastian Dröge
c904e00661 tracerrecord: Remove useless NULL check and add assertion for making assumptions explicit
gst_structure_new_empty() is not returning NULL in any valid scenarios,
checking for NULL here is useless. Especially because we would dereference any
NULL right after the NULL check again.
CID 1352037.

We previously check if the string ends on .class, as such strrchr() should
return something non-NULL. Add an assertion for that.
CID 1349642.
2016-03-02 10:37:09 +02:00
Tim-Philipp Müller
c7734d2711 element: minor docs fix
Make gtk-doc happy.
2016-03-01 19:50:26 +00:00
Sebastian Dröge
82e529cea5 Revert "bus: change GstBusSource to hold a weak ref to GstBus"
This reverts commit 894c67e642.
2016-02-29 23:33:03 +02:00
Sebastian Dröge
90b1b1dd96 Revert "bus: Make sure to remove the GPollFD from the GSources when destroying the bus"
This reverts commit 05700a7082.
2016-02-29 23:32:58 +02:00
Sebastian Dröge
01b2476d36 element: Remove GST_STATE_LOCK_FULL() / UNLOCK_FULL()
There is no corresponding API for that in GLib and nobody could've ever used
these macros without compiler errors anyway.
2016-02-29 17:07:26 +02:00
Sebastian Dröge
05700a7082 bus: Make sure to remove the GPollFD from the GSources when destroying the bus
Otherwise the GSource can look into our already destroyed bus where the
GPollFD is stored.

https://bugzilla.gnome.org/show_bug.cgi?id=762849
2016-02-29 13:41:15 +02:00
Tim-Philipp Müller
f02e52ba3f taglist: add guard to check writability when removing tags from a taglist
https://bugzilla.gnome.org/show_bug.cgi?id=762793
2016-02-28 13:59:48 +00:00
Tim-Philipp Müller
fa12d23a17 element: add gst_element_class_add_static_pad_template()
Pretty much every single element does

  gst_element_class_add_pad_template (element_class,
      gst_static_pad_template_get (&some_templ));

which is both confusing and unnecessary. We might just
as well add a function to do that in one step.

https://bugzilla.gnome.org/show_bug.cgi?id=762778
2016-02-28 13:10:03 +00:00
James Stevenson
5048155f57 bus: Prevent gst_bus_add_watch_full_unlocked from a segfault if priv->poll == NULL
This happens if the process runs out of file descriptors. Better print
a critical warning instead of just crashing.

https://bugzilla.gnome.org/show_bug.cgi?id=762702
2016-02-26 12:11:30 +02:00
Thiago Santos
894c67e642 bus: change GstBusSource to hold a weak ref to GstBus
When holding a regular ref it will cause the GstBus to never
reach 0 references and it won't be destroyed unless the application
explicitly calls gst_bus_remove_signal_watch().

Switching to weakref will allow the GstBus to be destroyed.
The application is still responsible for destroying the
GSource.

https://bugzilla.gnome.org/show_bug.cgi?id=762552
2016-02-25 14:08:50 -03:00
Edward Hervey
f7cba27157 buffer: Check return value of gst_memory_map()
Only do memory operations if the memory was succesfully map'ed

https://bugzilla.gnome.org/show_bug.cgi?id=728326
2016-02-23 17:23:43 +01:00
Adam Miartus
44423e8af3 taglist: add GST_TAG_CONDUCTOR
This is useful for metadata which explicitely distinguishes
between artist/composer and conductor.

https://bugzilla.gnome.org/show_bug.cgi?id=762450
2016-02-22 21:12:37 +00:00
Mark Nauwelaerts
0f63073c23 event: add some more documentation on stream-id
... where it might end up being used for.
2016-02-22 16:21:31 +01:00
Thibault Saunier
7e5a892f89 tracer: Initialize GstTracer _priv_tracers and quarks unconditionnally
Some people might use tracer hooks even if GST_TRACER_PLUGINS is not
set.

https://bugzilla.gnome.org/show_bug.cgi?id=760979
2016-02-22 13:23:24 +01:00
Nirbheek Chauhan
806dbeeef3 Whenever we include windows.h, also define WIN32_LEAN_AND_MEAN
This reduces the number of symbols and code pulled in drastically
2016-02-20 10:07:42 +00:00
Nirbheek Chauhan
55f9406f30 printf: On MSVC, also define HAVE_STDINT_H_WITH_UINTMAX
MSVC provides stdint.h but not inttypes.h, and we need to include stdint.h to
get intmax_t
2016-02-20 10:07:37 +00:00
Nirbheek Chauhan
c27e70e83f plugin: Only check for S_IFBLK if it is defined
Windows does not define S_IFBLK since it doesn't have block devices
2016-02-20 10:07:25 +00:00
Sebastian Dröge
42968bc949 Revert "pad: PULL probes are called without a buffer so don't require any of the data flags to be set"
This reverts commit b89fa4786b.

The changes break various tests.
2016-02-18 11:43:22 +02:00
Sebastian Dröge
5664fd7635 buffer: Protect against failing to map input memory when merging memories
https://bugzilla.gnome.org/show_bug.cgi?id=762239
2016-02-18 11:09:36 +02:00
Sebastian Dröge
b89fa4786b pad: PULL probes are called without a buffer so don't require any of the data flags to be set
https://bugzilla.gnome.org/show_bug.cgi?id=761211
2016-02-18 09:44:00 +02:00
Sebastian Dröge
a0b3a7f658 Revert "element: Don't hold state lock all the time while sending an event"
This reverts commit b427997119.

It breaks things that used to work before, even if the change by itself is
correct and the previous code is just working around deeper bugs in the async
state change code. Let's go back to what previously worked and then fix async
state changes in general.

https://bugzilla.gnome.org/show_bug.cgi?id=760532
2016-02-17 16:41:02 +02:00
Edward Hervey
899060d579 Revert "ghostpad: Do nothing in _internal_activate_push_default"
That commit would break scheduling reconfiguration with ghostpads

This reverts commit ab55ad7eaa.
2016-02-17 15:26:49 +01:00
Stian Selnes
ab55ad7eaa ghostpad: Do nothing in _internal_activate_push_default
When calling gst_pad_activate_mode() on a ghostpad
gst_ghost_pad_activate_push_default() will be called. This will call
gst_pad_activate_mode() on the proxypad (which is internal of the
ghostpad), calling gst_ghost_pad_internal_activate_push_default(), which
again will call gst_pad_activate_mode() on the original ghostpad.

By simply returning TRUE in
gst_ghost_pad_internal_activate_push_default() the redundant call to
gst_pad_activate_mode() (for the same pad) is avoided.

https://bugzilla.gnome.org/show_bug.cgi?id=761913
2016-02-17 12:26:12 +02:00
Thiago Santos
6f4bb8850b registrychunks: remove unused macro
macro was added in 2011 and isn't used anymore
2016-02-16 17:53:10 -03:00
Evan Nemerson
d11e657412 docs: annotate C examples as such
https://bugzilla.gnome.org/show_bug.cgi?id=731292
2016-02-15 17:45:15 +00:00
Thiago Santos
5b64123c54 protection/harness/systemclock: move declaration out of for loop initialization
C90 compilers complain about it
error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode

Also run gst-indent on systemclock tests.
2016-02-15 12:33:46 -03:00
Víctor Manuel Jáquez Leal
b92d639fbf bufferpool: pass acquire params to alloc_buffer
When allocating a new buffer in the pool, both the do_alloc_buffer() and the
vmethod, alloc_buffer(), receive the parameter GstBufferPoolAcquireParams.

Nonetheless, when default_acquire_buffer() calls the do_alloc_buffer() it does
not pass the received GstBufferPoolAcquireParams, so when the user pass those
parameters they are ignored by alloc_buffer() vmethod.

This one-liner patch pass the received acquire params to do_alloc_buffer().

https://bugzilla.gnome.org/show_bug.cgi?id=761824
2016-02-11 12:11:20 -05:00
Stian Selnes
2b0ff13d07 systemclock: Fix wait/unschedule race
Fixes a race where an entry is set to BUSY in
gst_system_clock_id_wait_jitter() and is UNSCHEDULED before
gst_system_clock_id_wait_jitter_unlocked() starts processing it. The
wakeup added by gst_system_clock_id_unschedule() must be cleaned up.

Two stress tests are added. One test that triggers the specific issue
described above. The second stresses the code path where a wait is
rescheduled because the poll returned early.

https://bugzilla.gnome.org/show_bug.cgi?id=761586
2016-02-10 08:59:33 -03:00
Thiago Santos
77a98d98cb systemclock: handle unschedule of late entries
If the clockentry is too late and is unscheduled before it gets
a change to detect its lateness the wakeup count and the poll are
used but never properly cleaned up. This leaves it in a dirty state
that is going to mess with the next clock entry waiting requests.

https://bugzilla.gnome.org/show_bug.cgi?id=761586
2016-02-10 08:59:33 -03:00