Commit graph

8117 commits

Author SHA1 Message Date
Guillaume Desmottes 4a41468ce7 Use MAY_BE_LEAKED_FLAG
This helps having "make check" passing with the leaks tracer enabled.

https://bugzilla.gnome.org/show_bug.cgi?id=766008
2016-06-02 23:14:15 +01:00
Guillaume Desmottes 21070c8114 tracing: add hooks when objects or miniobjects are created and destroyed
https://bugzilla.gnome.org/show_bug.cgi?id=765052
2016-06-02 23:10:44 +01:00
Guillaume Desmottes 194964b4e0 gst_deinit: move down tracers cleaning
We want the tracer detecting leaks to be finalized as late as possible
to give the chance to other gst components to be properly cleaned first.

https://bugzilla.gnome.org/show_bug.cgi?id=765052
2016-06-02 23:08:04 +01:00
Guillaume Desmottes aa336008b3 tracerrecord: allow G_TYPE_POINTER for field types
Tracers may want to display the address of an object.

https://bugzilla.gnome.org/show_bug.cgi?id=765052
2016-06-02 22:53:28 +01:00
Stefan Sauer b23cb42ae9 docs: xref the free function and expand allocation query docs
Add xrefs for how to parse pool details from an allocation query.
2016-05-30 02:04:18 -07:00
Nicolas Dufresne 446778464b object: Notify name change when using _set_name()
There was a 0.11 FIXME about notifying the name change or removing that
function. Clearly we can't remove this function, so let's notify it.

https://bugzilla.gnome.org/show_bug.cgi?id=766923
2016-05-26 15:36:05 -04:00
Edward Hervey 6bfb88b410 gst_private: Fix gstconfig include
Since it's a generated header, we need to specify the gst subdir so
that it gets properly included in out-of-dir compilation
2016-05-25 15:31:52 +02:00
Tim-Philipp Müller 5628f7ea73 gst: make sure to include gstconfig.h also in gst_private.h
For GST_EXPORT define and also things like GST_DISABLE_REGISTRY.
Hopefully fixes the following build failure on cerbero-cross-mingw32:
helpers/gst-plugin-scanner.c:50: undefined reference to `_imp___gst_disable_registry_cache'
2016-05-25 10:48:05 +01:00
Tim-Philipp Müller 0274650e42 g-i: pass compiler env to g-ir-scanner
It's what introspection.mak does as well. Should
fix spurious build failures on gnome-continuous.
2016-05-24 00:40:27 +01:00
Tim-Philipp Müller af47500d12 gst: g-i: pass compiler with quotes
So CC="ccache gcc" works properly.
2016-05-23 21:15:48 +01:00
Ray Strode 4152f266f7 gst: attempt to fix/track-down mysterious gnome-continuous build failures 2016-05-23 21:08:07 +01:00
Tim-Philipp Müller e0de5ed915 iterator: only unset GValue if it was inited
And add some function guards. From GLib 2.48 on it is
allowed to pass an uninitialised GValue to g_value_unset().

https://bugzilla.gnome.org/show_bug.cgi?id=763762
2016-05-23 18:09:48 +01:00
Nirbheek Chauhan 1c8711816e gst/parse: Also pass -DGST_EXPORTS here
This static library gets included directly into libgstreamer-1.0.so, so it needs
the same GST_EXPORTS definition as the rest of the code that's compiled into
that otherwise it will try to find the constants it uses from gstinfo via DLL
importing (__declspec(dllimport)).

Fixes https://ci.gstreamer.net/job/cerbero-cross-mingw32/4393/
2016-05-23 14:24:16 +01:00
Nirbheek Chauhan 161eee6694 gstconfig.h: Always use dllexport/import on Windows
__declspec(dllexport/import) are supported by GCC and are needed for
properly generating code that fetches the values of constants from DLLs
built with __declspec(dllexport) which happens when anything using
GST_EXPORT is built with MSVC.

See: https://msdn.microsoft.com/en-us/library/619w14ds.aspx

Essentially, if you built gstreamer with MSVC and then tried to use
constants from it (such as GST_TYPE_CAPS) in a plugin, GCC would
retrieve the address of the value instead of the value itself.
2016-05-23 12:13:53 +01:00
Guillaume Desmottes 56ee365077 (mini)object: add MAY_BE_LEAKED flag
https://bugzilla.gnome.org/show_bug.cgi?id=766008
2016-05-20 09:11:08 +01:00
Tim-Philipp Müller ef1444cfe4 bin: emit deep-element-{added,removed} for children of newly-added/removed bin
https://bugzilla.gnome.org/show_bug.cgi?id=578933
2016-05-16 09:10:09 +01:00
Tim-Philipp Müller 81dec8cc4d bin: add "deep-element-added" and "deep-element-removed" signals
This means applications and bin sub-classes can easily track when
a new child element is added to the pipeline sub-hierarchy or
removed.

Currently doesn't signal deep added/removed for elements inside
a bin if a bin is added/removed.

https://bugzilla.gnome.org/show_bug.cgi?id=578933
2016-05-16 09:10:09 +01:00
Sebastian Dröge edb27a8ec2 pad: Improve IDLE probe docs
Make it explicit that the pad is only blocked while the callback is running,
and the pad will be unblocked again once the callback returned.

If BLOCK and IDLE behaviour is needed, both need to be used.

https://bugzilla.gnome.org/show_bug.cgi?id=766002
2016-05-15 15:02:49 +03:00
Jan Schmidt 174a5e93e2 bin: Fix EOS forwarding on PLAYING->PLAYING
When doing a transition from PLAYING to PLAYING, we will fail
to forward an EOS message on the bus, and noone else will ever
send it because there'll be no actual state changed message.

Allow EOS through directly in that case.
2016-05-14 23:46:47 +10:00
Edward Hervey 794944f779 pad: Don't drop LATENCY queries with default implementation
If there is only one pad in the internal pads, when folding for
LATENCY queries it will just drop the response if it's not live.

This is maybe not the proper fix, but it will just accept the first
peer responses, and if there are any other pads, it will only take
them into account if the response is live.

This *should* properly handle the aggregation/folding behaviour of
multiple live peer responses, while at the same time handling the
simple one-pad-only-and-forward use-case

https://bugzilla.gnome.org/show_bug.cgi?id=766360
2016-05-13 11:36:12 +02:00
Jan Schmidt fe3180dcca debug: Instantiate GType when dumping debug categories.
A lot of debug categories are declared in element class_init
functions, which don't get run until the element is first created
(not just registered in the plugin load function). This means
that --gst-debug-help doesn't print out a lot of categories.

Creating an instance of each element from the element factory
makes them visible, at some extra cost - 2-3 times longer, which can
be a full second or two of extra waiting. Yikes!

https://bugzilla.gnome.org/show_bug.cgi?id=741001
2016-05-13 18:05:39 +10:00
Wonchul Lee 58f964da96 debugutils: fix warning on enum properties printing
https://bugzilla.gnome.org/show_bug.cgi?id=766251
2016-05-11 10:02:49 +03:00
Sebastian Dröge 14f71d2e27 pad: Fix pad state when deactivating from one mode and then trying to activate another and failing
When activating a pad in PULL mode, it might already be in PUSH mode. We now
first try to deactivate it from PUSH mode and then try to activate it in PULL
mode. If the activation fails, we would set the pad to flushing and set it
back to its old mode. However the old mode is wrong, the pad is not in PUSH
mode anymore but in NONE mode.

This fixes e.g. typefind in decodebin reactivating PUSH/PULL mode if upstream
actually fails to go into PULL mode after first PUSHING data to typefind.
2016-05-10 15:07:51 +03:00
Guillaume Desmottes 30ee36e630 utils: fix element leak in find_common_root()
The root element was not unreffed when iterating over ancestors.

https://bugzilla.gnome.org/show_bug.cgi?id=765961
2016-05-04 12:03:53 +03:00
Guillaume Desmottes 0ff10ac3ca uri: unref instead of using _gst_uri_free() directly
This confuses gst_tracing as we shortcut the mini object reference
system.

https://bugzilla.gnome.org/show_bug.cgi?id=765958
2016-05-04 10:08:24 +03:00
Guillaume Desmottes 782bc97e6f deviceproviderfactory: fix factory leak
The code path when early returning was leaking the extra reference on
the factory.

https://bugzilla.gnome.org/show_bug.cgi?id=765904
2016-05-03 10:49:24 +03:00
Tim-Philipp Müller c7bb52934e query: fix compiler warning
C4146: unary minus operator applied to unsigned type, result still unsigned
2016-05-02 10:53:04 +01:00
Tim-Philipp Müller 12a1418f7f Fix some nonsensical g-i annotations 2016-04-30 14:15:08 +01:00
Sebastian Dröge 8177173db0 element: Add gst_element_call_async()
This calls a function from another thread, asynchronously. This is to be
used for cases when a state change has to be performed from a streaming
thread, directly via gst_element_set_state() or indirectly e.g. via SEEK
events.

Calling those functions directly from the streaming thread will cause
deadlocks in many situations, as they might involve waiting for the
streaming thread to shut down from this very streaming thread.

This is mostly a convenience function around a GThreadPool and is for example
used by GstBin to continue asynchronous state changes.

https://bugzilla.gnome.org/show_bug.cgi?id=760532
2016-04-27 18:51:33 +03:00
Guillaume Desmottes 8daad351a4 caps: add cleanup priv function
Those are allocated in _priv_gst_caps_initialize() so it makes
sense to have a symetric cleanup functions called by gst_deinit().

https://bugzilla.gnome.org/show_bug.cgi?id=765606
2016-04-26 14:29:08 +01:00
Guillaume Desmottes 21a2b26bb2 capsfeature: add cleanup priv function
Those are allocated in _priv_gst_caps_features_initialize() so it makes
sense to have a symetric cleanup functions called by gst_deinit().

https://bugzilla.gnome.org/show_bug.cgi?id=765606
2016-04-26 14:29:01 +01:00
Sebastian Dröge 2076be19ed datetime: Sanity check year, month and day when parsing ISO-8601 strings
Passing years > 9999, months > 12 or days > 31 to gst_date_time_new() will
cause an assertion and generally does not make much sense. Instead consider it
as a parsing error like hours > 24 and return NULL.
2016-04-21 13:49:32 +03:00
Guillaume Desmottes 1ea831bd6c allocator: add cleanup method
Make tracking memory leaks easier.

https://bugzilla.gnome.org/show_bug.cgi?id=765212
2016-04-18 11:33:32 -04:00
Sebastian Dröge 3f3af84a8f meta: Warn if a meta implementation is registered without init function
This previously caused uninitialized memory unless something else was
initializing all the fields explicitly to something.

To be on the safe side, we also allocate metas without init function to all
zeroes now as it was relatively common.

https://bugzilla.gnome.org/show_bug.cgi?id=764902
2016-04-13 10:21:15 +03:00
Tim-Philipp Müller 6e3fb7af52 element: add API to get property change notifications via messages
Be notified in the application thread via bus messages about
notify::* and deep-notify::* property changes, instead of
having to deal with it in a non-application thread.

API: gst_element_add_property_notify_watch()
API: gst_element_add_property_deep_notify_watch()
API: gst_element_remove_property_notify_watch()
API: gst_message_new_property_notify()
API: gst_message_parse_property_notify()
API: GST_MESSAGE_PROPERTY_NOTIFY

https://bugzilla.gnome.org/show_bug.cgi?id=763142
2016-04-08 13:27:59 +01:00
Tim-Philipp Müller e3cc67a133 memory: fix C++ compiler warnings with GST_MAP_INFO_INIT 2016-04-06 17:46:31 +01:00
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
Tim-Philipp Müller f90126a62e uri: add guard to make sure gstreamer is initialized
https://bugzilla.gnome.org/show_bug.cgi?id=761448
2016-02-02 10:56:35 +00:00
Tim-Philipp Müller 63421675b1 tracer: rename GST_TRACER_PLUGINS env var to GST_TRACERS 2016-01-22 12:50:08 +00:00
Stefan Sauer ec75b68984 tracerrecord: don't leak the spec structures
Change the gst_tracer_record_new() api to take the parameters the make the
spec structure directly. This allows us to own the top-level structure and
also collect the args so that we can take ownership of the sub-structures.

https://bugzilla.gnome.org/show_bug.cgi?id=760821
2016-01-22 10:07:26 +01:00
Tim-Philipp Müller 05a9655523 device: fix comparison in _has_classesv()
We're comparing a pointer type with '\0' here, which
probably isn't right, and the loop condition made sure
that classes[0] is != NULL already, so it's pointless.
Was probaby meant to check if the string pointed to is
not empty, so make it do that instead.
2016-01-21 15:45:30 +00:00
Florin Apostol f0e94b4cdf systemclock: fixed race condition in handling alarms
When choosing the first entry from the list, gst_system_clock_async_thread
must set the entry state to busy before releasing the clock lock. Otherwise
a new entry could be added to the beginning of the list and
gst_system_clock_async_thread will be unaware and keep waiting on the entry
it has already chosen.

Also improved messages about expected state and bumped them to ERROR level
to detect unexpected state changes.

https://bugzilla.gnome.org/show_bug.cgi?id=760757
2016-01-20 13:47:20 +02:00
Tim-Philipp Müller 5ce5549ce0 utils: remove duplicate check 2016-01-20 11:07:17 +00:00
Stefan Sauer eaa992825d gstvalue: remove a half finishesh sentence in the docs
No idea what was the idea here. SO lets just drop it.
2016-01-20 10:02:37 +01:00
Vineeth TM 7738236968 tracerrecord: Fix self->spec structure invalid free
self->spec is got using g_value_get_boxed(), which is a transfer none function.
So the same should not be freed, which is resulting in wrong behavior.

https://bugzilla.gnome.org/show_bug.cgi?id=760821
2016-01-20 09:28:07 +01:00
Vineeth TM fc02815459 tracerrecord: Initialise flags to avoid wrong comparision
GstTracerValueFlags is not being initialized and the same could result in wrong
comparision and behavior. Hence initializing it to GST_TRACER_VALUE_FLAGS_NONE.

https://bugzilla.gnome.org/show_bug.cgi?id=760821
2016-01-20 09:25:44 +01:00
Stefan Sauer 4859494945 tracer: add an internal ptr format for tracer serialisation
We need to apply the string wrapping that value serialisation does also in the
tracer logging, otherwise we can't parse nested structures.
2016-01-20 09:14:12 +01:00
Luis de Bethencourt 227c387b43 tracerrecord: avoid overwriting value
res value is overwritten, remove the assignment.
priv__gst_structure_append_template_to_gstring () always returns TRUE
anyway.

CID 1349645
2016-01-19 12:04:19 +00:00
Edward Hervey 128760f246 tracerrecord: Disable logging if GST_DISABLE_GST_DEBUG
Make the gst_tracer_record_log() a no-op if the gst-debug subsystem
is disabled.
2016-01-19 11:12:21 +01:00
Tim-Philipp Müller eb4c5498b5 value: fail flag deserialization on invalid flag names 2016-01-18 19:39:11 +00:00
Vineeth TM 843d120c2f gst: ref/unref new enum types in gst_init/deinit
https://bugzilla.gnome.org/show_bug.cgi?id=760767
2016-01-18 09:11:00 +02:00
Philip Van Hoof cb625698a2 tracer.h: don't include private noinst header gsttracerutils.h in a public header
https://bugzilla.gnome.org/show_bug.cgi?id=760732
2016-01-17 00:00:51 +00:00
Stefan Sauer d15da9e221 tracer: update the docs
Add the new enum and flags. Remove the GstTracerRecordPrivate.
2016-01-16 21:04:46 +01:00
Stefan Sauer af91d23204 tracer: use the new flags to create the optional field in the format string
This spares us explicitly listing the field in the spec. and thus hide this
implementation detail.
2016-01-16 19:21:00 +01:00
Stefan Sauer 8cd76a918a tracer: add a GstTracerValueFlags and replace strings
This allows us to document the flags and makes the logs a bit smaller.
2016-01-16 18:52:32 +01:00
Tim-Philipp Müller dfb782ca97 message: add function guard to gst_message_set_buffering_stats()
https://bugzilla.gnome.org/show_bug.cgi?id=760704
2016-01-16 16:01:38 +00:00
Tim-Philipp Müller 8b88fc487f gst.h: Don't spew warnings if GST_USE_UNSTABLE_API is not defined
Only hide GstTracer and GstTracerRecord API behind GST_USE_UNSTABLE_API,
but don't spew any warnings, otherwise everyone has to define this
to avoid compiler warnings.

This reverts parts of commit 89ee5d948d.
2016-01-16 16:00:16 +00:00
Stefan Sauer 89ee5d948d tracer: add a GFlag for the tracer scope
Port all tracers. Add the GST_USE_UNSTABLE_API flag to the internal CFLAGS so
that we don't have to specify this for gir, docs, mkenum, ...
2016-01-16 13:31:51 +01:00
Stefan Sauer 10b78d872b tracerrecord: add a log record class
We use this class to register tracer log entry metadata and build a log
template. With the log template we can serialize log data very efficiently.
This also simplifies the logging code, since that is now a simple varargs
function that is not exposing the implementation details.

Add docs for the new class and basic tests.

Remove the previous log handler.

Fixes #760267
2016-01-15 21:54:01 +01:00
Nirbheek Chauhan 20c89fa8bc GstDeviceMonitor: Clarify the behaviour of gst_device_monitor_add_filter 2016-01-14 22:07:51 +00:00
Nirbheek Chauhan 4d6c7ccd08 GstDeviceMonitor: Don't remove unmatched class filters
If no providers for a particular class could be found, then removing unmatched
filters would cause all devices to be returned instead which is not at all what
the user intended. We still return 0 for unmatched filters.
2016-01-14 22:07:51 +00:00
Matthew Waters 347734e529 info: expose debugging printf functions
Other gst libraries and/or elements may want to add some debug logging to an
external debug system or implement delayed debugging for performance reasons.

Exposes the internal __gst_vasprintf as gst_info_vasprintf which has a fallback
to g_vasprintf if the debug system is disabled.

API: gst_info_vasprintf
API: gst_info_strdup_vprintf
API: gst_info_strdup_printf

https://bugzilla.gnome.org/show_bug.cgi?id=760421
2016-01-13 11:56:14 +11:00
Tim-Philipp Müller 4febebb962 info: add buffer list support to GST_PTR_FORMAT 2016-01-08 19:25:24 +00:00
Aurélien Zanelli 6b71877692 controlsource: fix GetValue and GetValueArray documentation
GstControlSourceGetValue() value paramater is a gdouble, not a GValue
and GstControlSourceGetValueArray doesn't return a GstValueArray but
an array of double.

https://bugzilla.gnome.org/show_bug.cgi?id=758668
2016-01-08 18:24:06 +00:00
Stefan Sauer 2f41e7bc6a tracer: harmonize the query hooks
In post hooks always pass the return value as the last param. Pass the query
also to post hooks since it is still alive.
2016-01-07 23:03:48 +01:00
Stefan Sauer 281f792042 tracerutils: update #endif comment
We changed the define, but left the comment inconsistent.
2016-01-07 22:43:58 +01:00
Stefan Sauer 8968af3589 tracerutils: document the tracer hook functions
Document all tracer hook function pointer together with the detail string that
one needs to use with gst_tracing_register_hook().
2016-01-07 22:41:32 +01:00
Sebastian Dröge 9d91ad0b85 tracer: Use GST_DISABLE_GST_TRACER_HOOKS instead of GST_DISABLE_GST_DEBUG everywhere
Previously we used the latter one still for the tracer utility code, causing
undefined references in the resulting binary if the debugging system was
disabled but the tracer system not.
2016-01-07 18:46:21 +02:00
Sebastian Dröge d787105fd5 gst: Rename _priv_gst_info_start_time to _priv_gst_start_time and initialize it centrally
It's used by the debugging and tracer subsystem and in various files, make it
a central thing that is initialized independ of the existence of those
subsystems.
2016-01-07 18:41:25 +02:00
Stefan Sauer 555f48da4b structure: log a warning if we can't serialize a field
The function always returns TRUE right now, so atleast log something.
2016-01-06 21:25:32 +01:00
Stefan Sauer 5e40639be7 tracer: make gst_tracing_register_hook_id static
We don't need to expose this as public API. Change the only plugin that was
using it.
2016-01-06 20:46:58 +01:00
Sebastian Dröge 5fe1b7efe3 clock: adjust/unadjust_with_calibration() have a clock parameter but it's useless
Document this, for 2.0 we should just remove that parameter.
2016-01-06 16:25:38 +02:00
Sebastian Dröge fb01dd000b clock: Add gst_clock_unadjust_with_calibration()
We already have gst_clock_adjust_with_calibration() and
gst_clock_unadjust_unlocked(), having the other variant is useful.
2016-01-06 16:25:38 +02:00
Stefan Sauer efa316d666 docs: add the tracer to the docs
Add GstTracer and GstTracerFactory to the core docs.
2016-01-06 13:05:53 +01:00
Stefan Sauer 1af0a3ce6f tracerutils: move header to noinst section
This is internal code, that is only to be used in core.
2016-01-06 11:37:12 +01:00
Stefan Sauer e5ca47236e configure: add a new option to disable the tracer hooks
This was previously done via {enable,disable}-gst-debug. Since both subsystems
are independent having separate options is better.
2016-01-06 11:33:34 +01:00
Sebastian Dröge 01ba6d40a8 clock: Fix typo
clocked -> clock
2016-01-05 16:44:53 +02:00
Sebastian Dröge 2f776d679f clock: Don't allow setting an unsynced clock as master 2016-01-05 14:23:26 +02:00
Sebastian Dröge ab827eca2e clock: Don't try to slave unsynced clocks
They will return useless values from get_time().
2016-01-05 14:21:58 +02:00
Stefan Sauer bdc60306c7 parse_launch: make nicer log messages
Add two macros to build nicer element/pad name strings. The macros avoid
printing "(NULL)" and print the element type in addition to the name.
2016-01-03 22:58:06 +01:00
Stefan Sauer 46a851b279 parse-launch: warn when still waiting to plug sub-pipelines after no-more-pads
The parse-launch API automagically handles dynamic pads and performs delayed
linking as needed, without any feedback about whether the linking succeeded or
not however. If a delayed dynamic link can't be completed for whatever reason,
parse-launch will simply wait in case a suitable pad appears later. This may
never happen though, in which case the pipeline may just hang forever.

Try to improve this by connecting to the "no-more-pads" signal of any element
with dynamic pads and posting a warning message for the related outstanding
dynamic links when "no-more-pads" is emitted.

Fixes #760003
2016-01-03 22:58:06 +01:00
Tim-Philipp Müller 7c992cfbe0 docs: fix some warnings and add some since markers 2016-01-03 17:50:35 +00:00
Stefan Sauer 583304959a grammar.y: remove trailing whitespace 2016-01-03 11:39:56 +01:00
Tim-Philipp Müller 433581c05a gst: fix typo in comment 2015-12-31 12:20:59 +00:00
Sebastian Dröge 2c272d74fd caps: Add (transfer full) annotation to simplify() and subtract() return value
https://bugzilla.gnome.org/show_bug.cgi?id=759948
2015-12-29 14:32:47 +02:00
Aurélien Zanelli 2ee33237c8 caps: add 'transfer full' annotation to caps returned by interserction functions
To make clear caller is responsible to unref them.

https://bugzilla.gnome.org/show_bug.cgi?id=759948
2015-12-29 14:30:29 +02:00
Xavier Claessens 46f83f5fcd core: Add g_autoptr() support to all types
https://bugzilla.gnome.org/show_bug.cgi?id=754464
2015-12-14 12:06:55 -05:00
Sebastian Dröge 615af0b1b0 element: Unref event if GstElement::send_event() is not implemented
Otherwise we'll take ownership of the event only if it's implemented, and
leak the event in all other situations.
2015-12-14 10:10:04 +01:00
Aurélien Zanelli 51a70dd586 element: unref message in _post_message when there is no implementation
'gst_element_post_message' takes the ownership of the message, so it
shall unref it when there is no post_message implementation. Otherwise
message is leaked.

https://bugzilla.gnome.org/show_bug.cgi?id=759300
2015-12-10 16:44:31 +02:00
Sebastian Dröge b427997119 element: Don't hold state lock all the time while sending an event
This lock seems to exist only to prevent elements from changing states while
events are being processed. However events are going to be processed
nonetheless in those elements if sent directly via pads, so protection must
already be implemented inside the elements for event handling if it is needed.

As such having the lock here is not very useful and is actually causing
various deadlocks in different situations as described in
https://bugzilla.gnome.org/show_bug.cgi?id=744040
2015-12-10 11:35:05 +02:00
Sebastian Dröge 2d427c75ae bin: Post a LATENCY message with async-handling=TRUE if the PLAYING state is reached
Otherwise each bin might have a different latency in the end, causing
synchronization problems.

The bin will still first handle latency internally as before, but gives the
overall pipeline the opportunity to update the latency of the whole pipeline
afterwards.

https://bugzilla.gnome.org/show_bug.cgi?id=759125
2015-12-09 11:13:22 +02:00
Sebastian Dröge c247117990 element: Check for an activated pad before adding, not a non-flushing one
The pad could be activated but flushing because of a FLUSH_START event. That's
not what we're looking for here, we want to check for activated pads.

https://bugzilla.gnome.org/show_bug.cgi?id=758928
2015-12-07 12:59:39 +02:00
Wim Taymans 87ab2603da query: fix docs
The allocation query has parameters with the meta API, not flags.
2015-12-04 11:57:45 +01:00
Edward Hervey 56d4650789 pad: Implement GstPadEventFullFunction
API: GstPadEventFullFunction

Returns a GstFlowReturn, allows asynchronous elements to properly
propagate flow returns

https://bugzilla.gnome.org/show_bug.cgi?id=757821
2015-12-02 16:04:03 +01:00
Edward Hervey e5d5f99a9e gstclock: Fix GST_STIME_ARGS
It wasn't properly handling GST_CLOCK_STIME_NONE and always use the
sign marker (+/-) to make it easier to identify signed values in
logs

https://bugzilla.gnome.org/show_bug.cgi?id=758870
2015-12-01 17:13:41 +01:00
Thibault Saunier 3737466563 controlsource: Annotate get_value[_array] as (method)
As the names clash with gst_object_get_value[_array]

https://bugzilla.gnome.org/show_bug.cgi?id=756950
2015-11-30 23:17:32 +01:00
Nicolas Dufresne c47e1383ca plugin: Add prefix support to dependencies
This adds a new flags, GST_PLUGIN_DEPENDENCY_FLAG_FILE_NAME_IS_PREFIX,
which allow using the names as prefix for plugin depencies.

https://bugzilla.gnome.org/show_bug.cgi?id=758083
2015-11-25 14:26:11 -05:00
Nicolas Dufresne 79b935b304 plugin: Allow device nodes as dependency
This is useful for feature that are produced after probing a specific
node. You want to reload this plugin if the specific node(s) have been
removed, added, or reloaded.

https://bugzilla.gnome.org/show_bug.cgi?id=758080
2015-11-25 14:26:11 -05:00
Nicolas Dufresne 446b3e6ddc plugin: Don't do lossy shift on hash
In plugin is responsible for calculating a hash of the dependencies
in order to determine if the cache should be invalidated or not.
Currently, the hash combining method removes a bit of the original
have before combining with an addition. As we use 32bits for our hash
and shift 1 bit for each file and directory, that resulting hash only
account for the last 32 files. And is more affected by the last file.

Rotating technique (shifting, and adding back the ending bit), can be
use to make the addition non-commutative. In a way that different order
gives different hashes. In this case, I don't preserve this behaviour
because the order in which the files are provided by the OS is
irrelevant.

In most cases, the XOR operation is used to combine hashes. In this
code we use the addition. I decided to preserve the addition because
we make use of non-random hash ((guint) -1) in the algorithm for
matching files that are not really part of the hash (symlinks, special
files). Doing successive XOR on this value, will simply switch from
full ones, to full zero. The XOR used with whitelist has been preserved
as it's based on a fairly randomized hash (g_str_hash).

https://bugzilla.gnome.org/show_bug.cgi?id=758078
2015-11-25 14:26:11 -05:00
Lukasz Forynski 7e2aae7942 info: fix compiler warning with -Wpedantic and gcc 5
Gstreamer compiled with gcc 5.2 and -Wpedantic produces the
following warning:

'ISO C does not support '__FUNCTION__' predefined identifier [-Wpedantic]
  const char *s = __FUNCTION__;'

Since gcc 5 enables C99 by default, use __func__ if it's available
instead of the non-standard __FUNCTION__ (as suggested in [2]).

[1]: https://gcc.gnu.org/gcc-5/changes.html
[2]: https://gcc.gnu.org/gcc-5/porting_to.html

https://bugzilla.gnome.org/show_bug.cgi?id=758541
2015-11-24 09:34:59 +00:00
Ravi Kiran K N 9fbecd6b6d tags: add GST_TAG_PRIVATE_DATA
Can be used to represent private data that may be
contained in tags, such as ID3v2 PRIV frames.

https://bugzilla.gnome.org/show_bug.cgi?id=730926
2015-11-20 19:43:31 +00:00