Commit graph

8049 commits

Author SHA1 Message Date
Tim-Philipp Müller
d052ae63d8 element: fix GST_ELEMENT_ERROR() error code expansion
In some corner cases, the error 'code' part passed to
GST_ELEMENT_ERROR() is a valid define as well, in which
case it won't survive two levels of macro expansion, but
only one. Fixes:

oss4-sink.c: In function ‘gst_oss4_sink_open’:
error: ‘GST_RESOURCE_ERROR_0x00000002’ undeclared (first use in this function)
GST_ ## domain ## _ERROR_ ## code, __txt, __dbg, __FILE__,

which is from GST_ELEMENT_ERROR(el,RESOURCE,OPEN_WRITE,..)
and OPEN_WRITE happens to be defined to 2 here.

https://bugzilla.gnome.org/show_bug.cgi?id=756806
https://bugzilla.gnome.org/show_bug.cgi?id=769117
2016-07-24 01:35:41 +01:00
Tim-Philipp Müller
12a10980b3 message: fix some nonsensical annotations 2016-07-22 17:32:33 +01:00
Vincent Penquerc'h
1105caa805 message: new API for additional custom data to error messages
https://bugzilla.gnome.org/show_bug.cgi?id=756806
2016-07-22 14:16:34 +01:00
Guillaume Desmottes
31ef105110 message: fix annotation of parse_stream_{collection,streams_selected}
gst_structure_id_get() returns a new reference so the returned object is
actually (transfer full).

The unit tests was already unreffing the objects.

https://bugzilla.gnome.org/show_bug.cgi?id=768776
2016-07-15 12:57:49 +01:00
Guillaume Desmottes
514beb7d60 message: fix annotation of parse_device_{added,removed}
gst_structure_id_get() returns a new reference so the returned device is
actually (transfer full).

The code using this API was already correct but the code example in
comments was not.

https://bugzilla.gnome.org/show_bug.cgi?id=768776
2016-07-15 12:56:52 +01:00
Guillaume Desmottes
2a0bba69e1 pad: add g-i transfer annotatation to _store_sticky_event()
For clarity.

https://bugzilla.gnome.org/show_bug.cgi?id=768810
2016-07-15 12:50:21 +01:00
Guillaume Desmottes
e73650e5f9 miniobject: weak_unref: display the pointer of the object if failing
That's generally the most useful information to help debugging the
problem.

https://bugzilla.gnome.org/show_bug.cgi?id=768579
2016-07-08 17:52:48 +01:00
Guillaume Desmottes
757a8b04c0 bin: properly display the type of the removed message
Makes debugging easier.

https://bugzilla.gnome.org/show_bug.cgi?id=768579
2016-07-08 17:52:40 +01:00
Tim-Philipp Müller
7a0f4422fa element: re-create threadpool after cleaning up tasks
We don't free this from gst_deinit() but from gst_task_cleanup_all(),
so more GStreamer API may be called. In particular makes unit tests
work again with CK_FORK=no.

https://bugzilla.gnome.org/show_bug.cgi?id=768577
2016-07-08 17:46:06 +01:00
Guillaume Desmottes
40727d9c83 element: clean up thread pool from gst_task_cleanup_all()
This ensures that all async operations (started from gst_element_call_async())
have been completed and so there is no extra thread running.

Fix races when checking for leaks on unit tests as some of those
operations were still running when the leaks tracer was checking for
leaked objects.

https://bugzilla.gnome.org/show_bug.cgi?id=768577
2016-07-08 17:27:32 +01:00
Miguel París Díaz
9f982e2d75 pad: check query caps answered and caps not NULL
https://bugzilla.gnome.org/show_bug.cgi?id=768450
2016-07-07 10:08:15 +03:00
Jan Schmidt
17f9ac5657 gstinfo: Avoid gcc 6 warning that breaks the tests build
gcc 6 has problems detecting and avoiding throwing
a warning for tautological compares in macros (they
should only trigger for compares outside macros).

Avoid them with a nasty cast of one parameter to void *

https://bugzilla.gnome.org/show_bug.cgi?id=764526
2016-07-01 22:38:01 +10:00
Tim-Philipp Müller
3623f168e9 streams: sprinkle some Since: markers for docs 2016-06-30 15:07:28 +01:00
Edward Hervey
63f6f05d66 gst: New Stream listing/selection system
* GstStream
* GstStreamCollection
* GST_EVENT_SELECT_STREAMS
* GST_MESSAGE_STREAM_COLLECTION
2016-06-30 12:31:06 +02:00
Sebastian Dröge
241d0f16f6 poll: #define EWOULDBLOCK to EAGAIN if it's not defined on Windows 2016-06-29 23:24:02 +02:00
Sebastian Dröge
60a2087cb1 bufferpool: Fix handling of the GstPoll
Especially if multiple threads are waiting for buffers to be available again,
the current code was wrong. Fix this and document clearly how the GstPoll is
supposed to be used.

Also fix some potential races with reading from the GstPoll before writing
actually happened.

https://bugzilla.gnome.org/show_bug.cgi?id=767979
2016-06-29 21:21:04 +02:00
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