Commit graph

290 commits

Author SHA1 Message Date
Tim-Philipp Müller
a79503a433 info: fix build with gst debugging disabled 2017-07-29 10:28:03 +01:00
Sebastian Dröge
ad0dd860c9 debug: Add a memory ringbuffer based debug logger
This stores debug logs in memory per thread and uses up to a
configurable amount of bytes per thread for the logs. Inactive threads
are timed out after a configurable amount of time.

https://bugzilla.gnome.org/show_bug.cgi?id=785035
2017-07-28 17:27:51 +01:00
Sebastian Dröge
04676df4a8 info: Move debug output in for_each_threshold_by_entry() to TRACE level
It's otherwise appearing many, many times in logs and usually is nothing
you're interested in.
2017-04-19 17:32:17 +01:00
Thibault Saunier
94da8f5d8d info: Check libunwind return codes 2017-01-27 16:49:56 -03:00
Thibault Saunier
a87b4551a6 Port gtk-doc comments to their equivalent markdown syntax
Modernizing our documentation and preparing a possible move to hotdoc.
This commits also adds missing @title metadatas to all SECTIONs
2017-01-27 16:36:38 -03:00
Stefan Sauer
ee52459a5e info: re-eval GST_DEBUG env var for late categories
When registering a new debug category after _debug_init(), we need to
re check the GST_DEBUG filter settings again.
In addition when parsing the filter setting, we need to already bump up
the min-debug level to not suppress debug log statments that dynamically
register a category. This happens in libraries that use a function to
register a category on first use.
2016-12-30 12:10:15 +01:00
Thibault Saunier
97b6d8fb12 gst: Fix building with msvc 2016-12-13 09:21:16 -03:00
Thibault Saunier
33616d47be info: Add a 'flags' parametter to gst_debug_get_stack_trace
This is an API break but that API has not been released yet.

We are passing a flag rather than a simple boolean as we can imagine
to implement more features in the future for example to retrieve a
stack trace for all the threads, etc..

Retrieving source file and line numbers is pretty
expensive while getting a stack trace, this new argument
allows the user to decide to retrieve a backtrace
without those infos instead which is much faster.

For example running $ GST_LEAKS_TRACER_STACK_TRACE=1 GST_DEBUG=GST_TRACER:7 \
GST_TRACERS=leaks time gst-launch-1.0 videotestsrc num-buffers=1 ! fakesink:

* With simple stack traces:

    0.04s user 0.02s system 99% cpu 0.060 total

* With full stack traces:

    0.66s user 0.23s system 96% cpu 0.926 total

https://bugzilla.gnome.org/show_bug.cgi?id=775423
2016-12-12 15:06:20 -03:00
Thibault Saunier
dbe3d2b328 info: Properly start and end dwfl sessions when getting stack traces
We were creating a new session to retrive each line of a stack trace
and we are supposed to start it once for a whole stack trace.

And pass the whole file to gst-indent.

https://bugzilla.gnome.org/show_bug.cgi?id=775365
2016-12-06 14:06:43 -03:00
Tim-Philipp Müller
66d2bae604 Add gst_print(), gst_println(), gst_printerr(), gst_printerrln()
Useful for debugging.

https://bugzilla.gnome.org/show_bug.cgi?id=766470
2016-11-12 10:43:55 +00:00
Guillaume Desmottes
24a09d1b6d info: add GstStream and GstStreamCollection support to gst_debug_print_object()
https://bugzilla.gnome.org/show_bug.cgi?id=769220
2016-11-11 13:22:25 +00:00
Thibault Saunier
e6c8c53fbe debug: Remove the Gst only based stack trace printing implementation
We now have 2 other implementations that should work better.

https://bugzilla.gnome.org/show_bug.cgi?id=772555
2016-11-04 14:22:05 -03:00
Thibault Saunier
a8d4857555 gst: Use libunwind/libdw to generate backtraces if avalaible
Making the gst_debug_print_trace function more generally useful.

API:
  + gst_debug_get_trace

https://bugzilla.gnome.org/show_bug.cgi?id=772555
2016-11-04 14:22:05 -03:00
Stian Selnes
287645c2d7 info: Replace %p and %r in GST_DEBUG_FILE
It's useful to be able to set a name pattern for GST_DEBUG_FILE so that
the same environment variable can be used for multiple processes and
still write to different files. Especially useful if these processes
run simultaneously.

%p: Replaced with PID
%r: Replaced with random number

%p is obviously useful. %r is useful when for instance running two
processes with same PID but in different containers.

https://bugzilla.gnome.org/show_bug.cgi?id=773092
2016-11-01 20:32:46 +02:00
Tim-Philipp Müller
89f5df1782 g-i: info: allow passing NULL to gst_debug_remove_log_function()
Useful for removing the default handler from bindings.
2016-08-26 12:05:16 +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
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
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
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
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
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
Jason Litzinger
1b881ecc26 gstinfo: fix infinite loop in gst_debug_unset_threshold_for_name()
Ensure iterator is advanced. The current list iteration code only
advances the iterator (walk) if a match is found, which results
in an infinite loop when more than one entry exists in the list.

https://bugzilla.gnome.org/show_bug.cgi?id=748321
2015-04-23 11:20:25 +01:00
Alex Ashley
abdafb0d64 protection: add GstProtectionMeta to support protected content
In order to support some types of protected streams (such as those
protected using DASH Common Encryption) some per-buffer information
needs to be passed between elements.

This commit adds a GstMeta type called GstProtectionMeta that allows
protection specific information to be added to a GstBuffer. An example
of its usage is qtdemux providing information to each output sample
that enables a downstream element to decrypt it.

This commit adds a utility function to select a supported protection
system from the installed Decryption elements found in the registry.
The gst_protection_select_system function that takes an array of
identifiers and searches the registry for a element of klass Decryptor that
supports one or more of the supplied identifiers. If multiple elements
are found, the one with the highest rank is selected.

This commit adds a unit test for the gst_protection_select_system
function that adds a fake Decryptor element to the registry and then
checks that it can correctly be selected by the utility function.

This commit adds a unit test for GstProtectionMeta that creates
GstProtectionMeta and adds & removes it from a buffer and performs some
simple reference count checks.

API: gst_buffer_add_protection_meta()
API: gst_buffer_get_protection_meta()
API: gst_protection_select_system()
API: gst_protection_meta_api_get_type()
API: gst_protection_meta_get_info()

https://bugzilla.gnome.org/show_bug.cgi?id=705991
2015-04-18 12:24:06 +01:00
Tim-Philipp Müller
bcbe8d0f01 docs: fix cross-reference to environment variables in GstInfo
https://bugzilla.gnome.org/show_bug.cgi?id=747416
2015-04-06 18:56:25 +01:00
Tim-Philipp Müller
2d92f5e6d8 info: move category level threshold check into log function dispatcher
Minor optimisation: check category log level earlier in the
log function dispatcher and not only in the default log
function.

https://bugzilla.gnome.org/show_bug.cgi?id=745213
2015-03-12 13:16:22 +00:00
Tim-Philipp Müller
bd7d1c8b61 Fix double semicolons 2015-03-10 09:24:28 +00:00
Tim-Philipp Müller
4e777233f5 info: avoid malloc/free if log object is NULL 2015-03-05 18:30:45 +00:00
Tim-Philipp Müller
5764316a8e info: move __FILE__ path shortening into default log handler
Instead of always shortening the __FILE__ path, even if the
log message is not actually printed, which might happen if
the log level is activated but the category is not, only
shorten the path if we're actually going to output it and
if it looks like it needs shortening. Log handlers had no
guarantee that they would get a name instead of a path
anyway on any architecture, so it shouldn't be a problem.

https://bugzilla.gnome.org/show_bug.cgi?id=745213
2015-03-05 17:57:58 +00:00
Peter Urbanec
6cbe86dc58 info: shorten __FILE__ on all platforms
This is useful not only for MSVC, but also with gcc/Linux
when doing cross-compilation builds and out-of-tree builds.

https://bugzilla.gnome.org/show_bug.cgi?id=745213
2015-03-05 17:53:16 +00:00
Tim-Philipp Müller
9f58aa080a info: nicer buffer offset printing when offsets are not set
Print unset offsets as 'none' instead of humongous numbers,
for better readability.
2015-02-16 19:36:11 +00:00
Sebastian Dröge
154eefecc9 Don't compare booleans for equality to TRUE and FALSE
TRUE is 1, but every other non-zero value is also considered true. Comparing
for equality with TRUE would only consider 1 but not the others.

Also normalize booleans in a few places.
2014-12-01 09:51:37 +01:00
Tim-Philipp Müller
70d692c431 info: remove confusing warning about running under valgrind
We're not actually doing anything differently anywhere when
we detect that we're running under valgrind, so let's not
print that confusing message that makes people wonder how
they can switch it off so they can valgrind the normal
code paths. Seeing that we're not doing that nor have done
so in the last 10 years we might just as well remove the
entire check actually.
2014-09-25 18:55:03 +01:00
Stefan Sauer
a528dadb98 info: avoid global variable for log_file
Use user_data to pass the log_file handle to the logger-function.

If one wants to change the log target (e.g. GST_DEBUG_FILE), simply call
gst_debug_remove_log_function() and re-add the handler with the new log-target
using gst_debug_add_log_function ().
2014-09-17 09:47:36 +02:00
Tim-Philipp Müller
b65a7a7034 info: make printing datetimes work with GST_PTR_FORMAT 2014-06-03 23:49:26 +01:00
Wim Taymans
36d4c4c218 info: first handle all miniobjects, then GObjects
First handle all miniobjects before we attempt to dereference the first
field pointer and look at the GType. With the recent glib change to
speed up G_IS_OBJECT, this causes crashes on miniobjects otherwise.
2014-06-03 14:47:17 +02:00
Wim Taymans
460be3e124 info: GstDateTime does not have a GType as first field
GstDateTime does not have the GType as the first field so we can't use
it to detect its type.
2014-06-03 14:46:11 +02:00
Wim Taymans
e457739ac9 info: use macros to check types
Use the macros to check the type of objects instead of directly poking
at the first field.
2014-06-03 14:45:22 +02:00
Evan Nemerson
e10266e3f3 docs: convert NULL, TRUE, and FALSE to %NULL, %TRUE, and %FALSE
This should help improve documentation generated for
languages other than C.

https://bugzilla.gnome.org/show_bug.cgi?id=730961
2014-05-30 00:20:27 +01:00
Stefan Sauer
c068b225fe docs: convert the examples to use gtk-doc markup, instead of docbook
The gtk-doc markup is less intrusive and better handled when creating docs for
language bindings. The titles (where used) where not adding much.
2014-02-27 18:11:35 +01:00
Stefan Sauer
0264bbdb46 info: move some env-var checks from gst to gstinfo as well
We were doing some log related initialisation in gst.c after calling
_priv_gst_debug_init(). Just move it there for consistency.
2014-01-16 20:47:53 +01:00
Wim Taymans
42d36b9495 info: debug segment offset field as well 2014-01-08 15:04:00 +01:00
Víctor Manuel Jáquez Leal
24a766a13b info: return existing category if a debug category is registered twice
If a category with the same name is found when creating a new
one, the found category is returned instead of an invalid pointer.
Fixes issue with gst-vaapi (which uses an internal copy of the
codec parsers) caused by commit ccba9130.

https://bugzilla.gnome.org/show_bug.cgi?id=720036
2013-12-07 19:03:23 +00:00
Olivier Crête
ccba91308d info: Make sure the same category is not added twice 2013-12-04 17:35:18 -05:00
Olivier Crête
e0317288ba info: Protect __categories list in get_category with lock too 2013-12-04 17:35:02 -05:00
Tim-Philipp Müller
4afa63a8ba gst: g_memmove() is deprecated
Just use plain memmove(), g_memmove() is deprecated in
recent GLib versions.

https://bugzilla.gnome.org/show_bug.cgi?id=712811
2013-11-21 15:04:04 +00:00
Tim-Philipp Müller
9f669e5ea5 docs: cosmetic since marker fixes 2013-11-16 16:09:40 +00:00
Sebastian Dröge
4d367dc1b0 context: Change GstContext to contain only a single context
It was unintuitive that GstContext was actually a list of different
contexts. GstContext now is only a type string and a structure to
contain the actual context.
2013-09-17 13:28:42 +02:00
Edward Hervey
29353c1b59 gst: minor docstring fixups to make g-i happy
note: the #ifndef move is actually a move of the "SECTION" docstring
2013-08-14 07:05:04 +02:00
David Schleef
f599019a99 info: parse debug levels > 9 2013-07-24 10:30:09 -07:00