Commit graph

8033 commits

Author SHA1 Message Date
Sebastian Dröge 4ff2721810 bus: Make sure to always read the control after popping a message
It might happen that we popped the message before writing of the control
happened. In this case we just have to retry again a bit later, and failure to
do so will cause an additional byte in the control and the GSource /
gst_poll_wait() to always wake up again immediately.

https://bugzilla.gnome.org/show_bug.cgi?id=750397
2016-06-29 21:21:04 +02:00
Sebastian Dröge 149127b755 systemclock: Improve GstPoll handling and don't check for impossible errno values
Also just read/write control every time, GstPoll is optimized by itself
already to only do I/O if switching between empty and one byte.

https://bugzilla.gnome.org/show_bug.cgi?id=750397
2016-06-29 21:21:04 +02:00
Sebastian Dröge cda3f1213b poll: Clarify when FALSE is returned from read/write_control()
And also mention what the expected values of errno are going to be.

write_control() will only ever return FALSE if there was a critical error. It
will never return because of EINTR, EAGAIN or EWOULDBLOCK.

read_control() will return FALSE if there was no byte to read, in which case
errno would be EWOULDBLOCK.
In all other cases there was a critical error.

https://bugzilla.gnome.org/show_bug.cgi?id=750397
2016-06-29 21:21:04 +02:00
Sebastian Dröge 254955df62 poll: set_controllable(), restart() and set_flushing() are only valid for non-timer GstPolls
On timer GstPolls it will cause the control socket state to become
inconsistent as now one less read_control() than write_control() be would
needed.

Similarly, read_control() and write_control() are only valid on timer
GstPolls.

https://bugzilla.gnome.org/show_bug.cgi?id=750397
2016-06-29 21:21:04 +02:00
Sebastian Dröge 0bfc9fb212 poll: Warn if the return value of gst_poll_read_control() is unused
This might fail even under correct usage, e.g. if read_control() is called
from another thread before write_control() finished in another. It has to be
retried then, or other measures have to be taken, depending on how it is used
by the surrounding code.

https://bugzilla.gnome.org/show_bug.cgi?id=750397
2016-06-29 21:21:04 +02:00
Matthew Gruenke cd06aea103 poll: Fix various race conditions with read_control() and write_control()
This addresses slightly different race conditions on Linux and Windows, and
fixes gst_poll_read_control() when control_pending == 0.

On Linux, the socketpair() used for control should not be made O_NONBLOCK.
If there's any propagation delay between set->control_write_fd.fd and
set->control_read_fd.fd, even the mutex now held will not be sufficient to
prevent a race condition.  There's no benefit to using O_NONBLOCK, here.
Only liabilities.

For Windows, it's necessary to fix the race condition between testing
set->control_pending and performing WAKE_EVENT()/RELEASE_EVENT().  This is
accomplished by acquiring and holding set->lock, for both of these operations.
We could optimize the Linux version by making this Windows-specific.

For consistency with the Linux implementation, Windows' RELEASE_EVENT()
has also been made to block, although it should never happen.

Also, changed release_wakeup() to return TRUE and decrement control_pending
only when > 0.  Furthermore, RELEASE_EVENT() is called only when
control_pending == 1.

Finally, changed control_pending to use normal, non-atomic arithmetic
operations, since it's now protected by set->lock.

Note: even though the underlying signaling mechanisms are blocking,
release_wakeup() is effectively non-blocking, as it will only attempt to read
from control_read_fd.fd after a byte has been written to control_write_fd.fd
or WaitForSingleObject() after it's been signaled.

https://bugzilla.gnome.org/show_bug.cgi?id=750397
2016-06-29 21:21:04 +02:00
Guillaume Desmottes e11539c30b bus: chain up GObject::constructed() to the parent class' implementation
Needed so GstBus can be tracked by the leaks tracer.

https://bugzilla.gnome.org/show_bug.cgi?id=768141
2016-06-28 17:23:17 +03:00
Nirbheek Chauhan 54fa564e01 gstconfig.h: Don't use extern with dllexport
GCC emits an error for this with -Werror:

plugin.c:22:1: error: 'gst_plugin_desc' initialized and declared 'extern' [-Werror]

This matches how glib does symbol exporting.

https://bugzilla.gnome.org/show_bug.cgi?id=767463
2016-06-24 01:09:32 +01:00
Nirbheek Chauhan 48088867db win32: Don't use dllexport/import when only building statically
If the prototypes in the public API have dllimport in them when building
statically on Windows, the compiler will look for symbols with symbol
mangling and indirection corresponding to a DLL. This will cause a build
failure when trying to link tests/examples/etc.

External users of GStreamer also need to define -DGST_STATIC_COMPILATION
if they want to link to static gstreamer libraries on Windows.

A similar version of this patch has been committed to all gstreamer
repositories.

https://bugzilla.gnome.org/show_bug.cgi?id=767463
2016-06-23 23:39:45 +01:00
Sebastian Dröge 6b9e70d193 device: Fix typo
paramater -> parameter
2016-06-15 16:12:36 +02:00
Tim-Philipp Müller 09d5ff4097 info: flesh out GST_PTR_FORMAT docs a bit 2016-06-14 19:16:33 +01:00
Sebastian Dröge 37713c3388 pad: Log pad offsets as signed times 2016-06-11 22:18:22 +03:00
Tim-Philipp Müller 665de91347 gstconfig.h.in: indent #if #else jungle for better readability 2016-06-09 17:48:40 +01:00
Sebastian Dröge 1dbb27f3a7 utils: Add gst_pad_link_maybe_ghosting() for consistency
We already had a _full() version, but having that alone seems inconsistent.
Add a non-full version that mirrors the behaviour of gst_pad_link() vs
gst_pad_link_full().
2016-06-08 12:12:28 +03:00
Tim-Philipp Müller 56b9290073 deviceprovider: remove base_class_finalize function
It's not going to get called anyway.

https://bugzilla.gnome.org/show_bug.cgi?id=765540
2016-06-04 13:35:12 +01:00
Tim-Philipp Müller 38c74e41c7 element: remove base_class_finalize_func which is never called
Won't be called for static types, so no point keeping it around.

https://bugzilla.gnome.org/show_bug.cgi?id=765540
2016-06-04 13:11:55 +01:00
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