Add a new API to control logging behavior, particularly for implementing
"log once" functionality and periodic logging. This helps avoid spamming
logs with repetitive messages.
The API provides:
- Static and dynamic context creation
- Configurable message identity calculation
- Periodic reset capability
- Context-aware logging macros
- Element message variants with context support
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6855>
templ is the new one that is being stored and that needs to be ref-sinked,
padtempl is the old one that just needs to be unreffed.
Fixes leaking the old template, and also makes sure that the new template is not
floating which can cause use-after-frees with bindings as they might wrongly
take ownership of a still floating template.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8988>
When plugin_loader_load_and_sync returns false in plugin_loader_replay_pending,
the cur Glist l->pending_plugins will be added to the blacklist.
However, the l->pending_plugins might have already been loaded and freed in handle_rx_packet,
so causing a use-after-free issue.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8747>
On Windows, if the path to gst-plugin-scanner.exe contained
whitespace, gstreamer would via CreateProcessW attempt to execute
several files "up" the path tree; e.g. if the scanner path was
"C:\Program Files\gstreamer app\gst-plugin-scanner.exe", it would try
to execute C:\Program, C:\Program.exe, C:\Program Files\gstreamer.exe"
and so on.
This is how CreateProcessW behaves with unquoted whitespace arguments
in lpCommandLine if lpApplicationName is NULL.
By passing the binary path as lpApplicationName instead, the problem
is avoided.
Also quote arguments to gst-plugin-scanner.exe as they are paths as well.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8614>
The GST_TRACER_POOL_BUFFER_(DE)QUEUED macros used when tracer hooks are
disabled took only one argument, causing compile errors when building
with tracer hooks disabled.
Change-Id: I0958c0b018f1fc4a6d84ab0bdd9e42895ae1fe77
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8638>
Suppose you invoke gst-launch with this invalid pipeline:
```
$ gst-launch-1.0 videotestsrc num-buffers=10 ! x264enc name=enc ! mux.sink_0 \
mpegtsmux name=mux ! fakesink
0:00:00.018631594 351169 0xb523090 ERROR GST_PIPELINE
subprojects/gstreamer/gst/parse/grammar.y:1151:gst_parse_perform_link:
could not link enc to mux
WARNING: erroneous pipeline: could not link enc to mux
```
The error message you get is not very helpful. This is a pity, because
this is where the error comes from:
```c
static GstPad *
gst_base_ts_mux_request_new_pad (GstElement * element, GstPadTemplate * templ,
const gchar * name, const GstCaps * caps)
{ // [...]
GST_ELEMENT_ERROR (element, STREAM, MUX,
("Invalid Elementary stream PID (0x%02u < 0x40)", pid), (NULL));
return NULL;
```
mpegtsmux posted an error with an explanation of why the linking failed.
However, since the error ocurred within gst_parse_launchv(), gst-launch
could not have set a bus handler, and the error message got discarded.
This patch attempts to make gst-launch more user-friendly by setting a
temporary bus handler during early bin construction to catch error
messages like this.
The errors are logged as ERROR level in the GST_PIPELINE category.
However, this is not enough, as GST_LEVEL_DEFAULT defaults to
GST_LEVEL_NONE in releases. In other words, outside of the dev
environment, GStreamer won't print ERROR logs by default.
To make sure the errors can reach users of packaged versions of
GStreamer, a new AtomicRcBox-based struct is added: reason_receiver_t.
graph_t owns a reference to reason_receiver_t and so does the temporary
bus handler.
When the temporary bus handler receives an error message, the `reason`
field of `reason_receiver_t` is filled with the error message.
Later, when SET_ERROR() is called as a consequence of the operation that
posted the error having returned failure, the reason message is
extracted and added to the GError message.
This is how the resulting error would look in the example from above:
WARNING: erroneous pipeline: could not link enc to mux --
GstMpegTsMux <mux> posted an error message: Invalid Elementary
stream PID (0x00 < 0x40)
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8417>
Suppose you're trying to debug why this pipeline doesn't work:
```
$ GST_DEBUG=GST_PIPELINE:DEBUG gst-launch-1.0 \
videotestsrc num-buffers=10 ! x264enc name=enc ! mux.sink_0 \
mpegtsmux name=mux ! fakesink
```
You will encounter this line in the logs:
> gst_parse_perform_link: linking some pad of GstX264Enc named enc to
> pad mux of GstMpegTsMux named mux (0/1) with caps "(NULL)"
It would seem that the element name is being read as a pad name as well,
and that made me wonder if the parsing was not working. However, it was
just a bug in the code printing that log. This patch fixes that bug.
Note that it is possible to specify more than one pad name for each side
of the link. For instance, the following is a valid pipeline that will
remux the video and audio of an MP4 file into MKV:
```
$ GST_DEBUG=GST_PIPELINE:DEBUG gst-launch \
filesrc location=input.mp4 ! qtdemux name=demux \
multiqueue name=mq \
matroskamux name=mux ! filesink location=output.mkv \
demux.video_0,audio_0 ! mq.sink_0,sink_1 \
mq.src_0,src_1 ! mux.video_0,audio_0
```
The new logging accomodates this by using a new utility function to join
strings of pad name lists instead of `PRETTY_PAD_NAME_FMT` (which only
supports one pad name). For example:
> linking pads {video_0, audio_0} of GstQTDemux named demux to pads
> {sink_0, sink_1} of GstMultiQueue named mq with caps "(NULL)"
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8415>
"undefined reference to `GST_TRACER_PAD_SEND_EVENT_PRE'
undefined reference to `GST_TRACER_PAD_SEND_EVENT_POST'"
errors are generated when trying to build GStreamer with
the following build configuration:
meson setup -Dgstreamer:tracer_hooks=false build
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8419>
Similar to de30de865cd, this allows to follow the flow of events as they
arrive to a pad rather than only when they are pushed to a peer.
The hook is installed in gst_pad_send_event_unchecked() instead of
gst_pad_send_event() because the latter is often omitted: that is the
case especifically in gst_pad_push_event_unchecked(), where most event
propagation occurs.
This patch also makes use of the new hooks in the log tracer to log the
begining and end of the send_event processing.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8330>
Previously, the tracer pad-push-event was only signalled on
gst_pad_push_event(). However, the sticky event handling code in
GStreamer uses gst_pad_push_event_unchecked() instead, which meant those
events were not logged.
This patch extends the definition of the pad-push-event tracer to cover
both calls to gst_pad_push_event() and any direct calls to
gst_pad_push_event_unchecked() that skip the former inside GstPad
private code.
gst_pad_push_event_unchecked() returns GstFlowReturn instead of
gboolean like gst_pad_push_event(). To maintain API compatibility, the
GstFlowReturn is converted to gboolean.
Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/4182
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8342>
With this patch, configure time is identical no matter whether doc is
enabled or not.
The configuration files also now contain explicitly-listed sources with
no wildcards.
For the four libraries where hotdoc needs to use clang to generate the
documentation (as opposed to the rest of the libraries where hotdoc uses
the gir), the script will call pkg-config to determine the appropriate
C flags.
This means a side effect of this patch is that pkg-config files are now
generated for the gstadaptivedemux and gstopencv libraries.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8312>