Commit graph

87151 commits

Author SHA1 Message Date
Nirbheek Chauhan ab6faaeeb4 gstptpclock: Don't leak the GList
120 bytes in 5 blocks are definitely lost in loss record 7,615 of 9,510
   at 0x484486F: malloc (vg_replace_malloc.c:380)
   by 0x58A2938: g_malloc (gmem.c:106)
   by 0x58BA1F4: g_slice_alloc (gslice.c:1069)
   by 0x588F059: g_list_prepend (glist.c:335)
   by 0x5B9C5C0: select_best_master_clock (gstptpclock.c:756)
   by 0x5B9CA8E: cleanup_cb (gstptpclock.c:1930)
   by 0x589AD20: g_timeout_dispatch (gmain.c:4889)
   by 0x589A4CE: UnknownInlinedFun (gmain.c:3337)
   by 0x589A4CE: g_main_context_dispatch (gmain.c:4055)
   by 0x58EE4E7: g_main_context_iterate.constprop.0 (gmain.c:4131)
   by 0x5899A92: g_main_loop_run (gmain.c:4329)
   by 0x5B9BA4C: ptp_helper_main (gstptpclock.c:1980)
   by 0x58C8C31: g_thread_proxy (gthread.c:826)

576 bytes in 24 blocks are definitely lost in loss record 8,782 of 9,510
   at 0x484486F: malloc (vg_replace_malloc.c:380)
   by 0x58A2938: g_malloc (gmem.c:106)
   by 0x58BA1F4: g_slice_alloc (gslice.c:1069)
   by 0x588F059: g_list_prepend (glist.c:335)
   by 0x5B9C5C0: select_best_master_clock (gstptpclock.c:756)
   by 0x5B9EFA0: handle_announce_message (gstptpclock.c:934)
   by 0x5B9EFA0: handle_ptp_message (gstptpclock.c:1765)
   by 0x5B9EFA0: have_stdin_data_cb (gstptpclock.c:1851)
   by 0x589A4CE: UnknownInlinedFun (gmain.c:3337)
   by 0x589A4CE: g_main_context_dispatch (gmain.c:4055)
   by 0x58EE4E7: g_main_context_iterate.constprop.0 (gmain.c:4131)
   by 0x5899A92: g_main_loop_run (gmain.c:4329)
   by 0x5B9BA4C: ptp_helper_main (gstptpclock.c:1980)
   by 0x58C8C31: g_thread_proxy (gthread.c:826)
   by 0x5DA4298: start_thread (pthread_create.c:481)

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/852>
2021-07-19 15:28:05 +00:00
Nirbheek Chauhan 60a7a2e705 gstpad: Don't spam INFO when default-chaining a buffer list
This is being logged for each buffer, so it should not use INFO.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/853>
2021-07-19 20:05:29 +05:30
Michael Olbrich 5bfb78aa28 decodebin3: improve decoder selection
Currently the decoder selection is very naive: The type with the highest
rank that matches the current caps is used. This works well for software
decoders. The exact supported caps are always known and the static caps are
defined accordingly.
With hardware decoders, e.g. vaapi, the situation is different. The decoder
may reject the caps later during a caps query. At that point, a new decoder
is created. However, the same type is chosen an after several tries,
decodebin fails.

To avoid this, do the caps query while adding the decoder and try again
with other decoder types if the query fails:

1. create the decoder from the next matching type
2. add and link the decoder
3. change the decoder state to READY
4. do the caps query
   if it fails then remove the decoder again and go back to 1.
5. expose the source pad
6. sync the decoder state with the parent.

This way, the decoder is already part of the pipeline when the state change
to READY happens. So context handling should work as before.

Exposing the source pad after the query was successful is important:
Otherwise the thread from the decoder source pad may block in a blocked pad
downstream in the playsink waiting for other pads to be ready.
The thread now blocks trying to set the state back to NULL while holding
the SELECTION_LOCK. Other streams may block on the SELECTION_LOCK and the
playsink never unblocks the pad. The result is a deadlock.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1201>
2021-07-19 08:56:35 +00:00
Víctor Manuel Jáquez Leal de19e8a84f va: vp9dec: Minor cleanups.
Added a comment with a future to-do, enhanced another comment and
fixed a typo in an error log message.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2417>
2021-07-17 20:53:32 +02:00
Víctor Manuel Jáquez Leal b45754b478 va: decoder: Group decoder methods.
Move up gst_va_decoder_get_config() to group decoders function in the
same file area.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2417>
2021-07-17 20:53:29 +02:00
Víctor Manuel Jáquez Leal ea8b372ceb va: Refactor _format_changed() to _config_is_equal().
Change gst_va_decoder_format_changed() to
gst_va_decoder_config_is_equal(), which is more similar with other
GStreamer API.

The function call is replaced but it has to be negated because the
return value is the opposite.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2417>
2021-07-17 20:51:29 +02:00
Víctor Manuel Jáquez Leal d2d7ce7157 va: Refactor _change_resolution() to _update_frame_size().
Rename gst_va_decoder_change_resolution() to
gst_va_decoder_update_frame_size() which resembles
gst_va_decoder_set_frame_size().

Also added a comment to clarify the function use and makes more
specific the error message.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2417>
2021-07-17 20:51:29 +02:00
Víctor Manuel Jáquez Leal 1bf2805560 va: Refactor _set_format() to _set_frame_size().
Renamed gst_va_decoder_set_format() to
gst_va_decoder_set_frame_size_with_surfaces() which resembles better
the passed parameters. Internally it creates the vaContext.

Added gst_va_decoder_set_frame_size() which is an alias of
gst_va_decoder_set_frame_size_with_surfaces() without surfaces. This
is the function which replaces gst_va_decoder_set_format() where
used.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2417>
2021-07-17 20:51:27 +02:00
He Junyan 4299596d16 codecs: h265decoder: Fix a typo of NumPocTotalCurr when process ref pic list.
We should use the NumPocTotalCurr value stored in decoder, which is a calculated
valid value, rather than use the invalid value in the slice header. Most of the
time, the NumPocTotalCurr is 0 and make the tmp_refs a very short length, and
causes the decoder's wrong result.
By the way, the NumPocTotalCurr is not the correct name specified in H265 spec,
its name should be NumPicTotalCurr. We change it to the correct name.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2414>
2021-07-16 23:05:18 +08:00
He Junyan 6a9f84a2de va: h265dec: Do not add non reference frames into ref list.
The VA's ReferenceFrames should only contain the reference frame, we
should not add the non reference frames into this list.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2414>
2021-07-16 15:50:47 +08:00
Seungha Yang 26fe552707 tests: Enable closedcaption test on Windows
... if closedcaption plugin is available

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2411>
2021-07-15 17:25:37 +00:00
Seungha Yang 9becc1fe7e mfvideoenc: Disable RGB format support
Some GPUs support BGRA format and it will be converted to subsampled
YUV format by GPU internally. Disable this implicit conversion
since the conversion parameters such as input/output colorimetry
are not exposed nor it's written in bitstream (e.g., VUI).
We prefer explicit conversion via our conversion elements.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2410>
2021-07-15 16:50:26 +00:00
Nicolas Dufresne 210cf85fdc gl: x11: Issue XSync to close our top level window
This is similar action as when the window handle is modified, we now issue
XSync whenever we destroy our internal window. This ensure that the window is
properly closed before the connecgtion is dropped.

Fixes #815

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1226>
2021-07-15 16:22:48 +00:00
Nicolas Dufresne 3e69c5546b gl: wayland: Fix hinding the window on close()
When the window is called, we properly destroy all surfaces, which effectively
will unmap that surface and should make it disapear on screen, but we also
destroy the wl_source, a GSource that is resposibble of dispatching and executing
messages to/from the Wayland server.

As a side effect, the server never gets the message and the surfaces are
"leaked" on the server. We fix this using wl_display_flush() before destroying
the wl_source.

Fixes #815

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1226>
2021-07-15 16:22:48 +00:00
Nicolas Dufresne 88e19f857a tests: example: Add missing glx_dep when building sdlshare
Might be realted to some recent Mesa cleanup, but GLX is not longer visible
through libOpenGL, so add the missing deps now.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1227>
2021-07-15 11:11:00 -04:00
He Junyan 67d482f8fb va: h265dec: Fix a temp var overflow bug when write pred weight table.
The temp guint8 var of delta_chroma_offset_l0 and delta_chroma_offset_l1
can not cover the full range of delta_chroma_weight_l0/1 in the slice
header. When overflow happens, the decoder result is wrong.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2412>
2021-07-15 14:25:09 +00:00
Philippe Normand bc09d8cc66 dash: Store entire ContentProtection node in protection event data
Some manifests use the ContentProtection node to store additional information
such as the license server url. Our MPD parser used to process the
ContentProtection node, extracting Playready PSSH boxes. However for other DRM
systems, only the `value` attribute was passed down to the protection event, so
for example, Widevine data was not parsed at all and "Widevine" was passed to
the event, which is not very useful for decryptors that require a PSSH init
data.

Parsing should now be done by decryptors which will receive the entire
ContentProtection XML node as a string. This gives more "freedom" to the
decryptor which can then detect and parse custom nodes as well.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2400>
2021-07-15 13:05:54 +00:00
He Junyan ff0e42eb30 va: vp9dec: We need to check the resolution changes for every frame.
The VP9 streams have the ability to change the resolution dynamically
at any time point. It does not send ad KEY frame before change the
resolution, even the INTER frame can change the resolution immediately.
So we need to check the resolution change for each frame and do the
re-negiotiation if needed.

Some insaned stream may play in resolution A first and then dynamically
changes to B, and after 1 or 2 frames, it use a show_existing_frame to
repeat the old frame of resolution A before. So, not only new_picture(),
but also duplicate_picture() need to check this.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2407>
2021-07-15 09:42:51 +00:00
He Junyan 458ac4a693 va: vp9dec: Do not re-create context for dynamical resolution change.
The driver for VP9 should have the ability to handle the dynamical resolution
changes. So if only the resolution changes, we should not re-create the config
and context in negotiation.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2407>
2021-07-15 09:42:51 +00:00
He Junyan 6887e77201 va: decoder: Add helper functions to get and change the resolution.
Some codecs such as VP9, its config and context have the ability to
dynamically. When we only change the width and height, no need to
re-create the config and context. The helper function can just change
the resolution without re-creating config and context.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2407>
2021-07-15 09:42:51 +00:00
Stéphane Cerveau 342c05e778 gitlab: add bug template
To clarify what is expected in an issue description and avoid
issue which is just an usage issue, add a bug template in gitlab.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/836>
2021-07-15 11:17:10 +02:00
Jan Schmidt 30e105561d mpegtsmux: Quieten "missed PCR" warnings in VBR mode.
When the muxer is operating in VBR mode, it's kind of expected
for now that we might not put the PCR in exactly the right place,
because the muxer doesn't schedule packets that way. In that case
don't warn constantly about the PCR ending up a few ms off target.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2295>
2021-07-15 04:46:03 +00:00
Matthew Waters fdca97eca8 rtmp2src: workaround a GLib race when destroying a GMainContext/GSource
https://gitlab.gnome.org/GNOME/glib/-/issues/803

Basically, if destruction of a GSource and its associated GMainContext are
not synchronised, Then the GSource destruction can access freed
GMainContext resources and cause a crash.  This is not super common but
can happen.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2405>
2021-07-15 14:10:04 +10:00
Mads Buvik Sandvei bc6b68215f codecs: h265decoder: Always free messages while parsing SEI
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2390>
2021-07-14 17:56:27 +00:00
Seungha Yang cd50b02bc9 vp9parse: Skip parsing decode-only frame
Decode-only frame (i.e., show_existing_frame == 1) doesn't hold
any valid information apart from the index of frame to be duplicated.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2408>
2021-07-14 14:32:57 +00:00
Philippe Normand 108eba3603 wpesrcbin: Use gst_buffer_new_memdup()
g_memdup() is deprecated.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2406>
2021-07-13 16:03:10 +00:00
He Junyan 55ccc581b2 codecs: vp9statefulparser: not init segmentation_abs_or_delta_update.
The segmentation_abs_or_delta_update is a stateful var, it should not
be inited every time when parsing the segmentation.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2403>
2021-07-13 15:34:57 +00:00
Matthew Waters 2ed12573b8 examples/qt/textureshare: add explicit dep on glx_dep
Fixes linking:

/usr/bin/ld: subprojects/gst-plugins-base/tests/examples/gl/qt/qglwtextureshare/qglwtextureshare.p/qglrenderer.cpp.o: undefined reference to symbol 'glXGetCurrentContext'
/usr/bin/ld: /usr/lib64/libGLX.so.0: error adding symbols: DSO missing from command line

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1143>
2021-07-13 13:42:13 +00:00
Haelwenn (lanodan) Monnier e08dcdf622 gl: Try GLVND 'opengl' and 'glx' first
This fixes targetting desktop OpenGL without libGL.so

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1143>
2021-07-13 13:42:13 +00:00
Mathieu Duponchelle 2c85fd1be9 deinterlace: reduce noise when gst_pad_set_caps fails
It may be that downstream is simply flushing, in which case logging
an error is misleading.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/1029>
2021-07-13 06:52:26 +00:00
Seungha Yang 051b5de39e tests: wasapi2: Add more device reuse cases
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2402>
2021-07-13 03:36:37 +09:00
Seungha Yang 5932a853f8 wasapi2ringbuffer: Close IAudioClient on GstAudioRingBuffer::release
IAudioClient interface is not reusable once it's initialized.
So we should close the handle and reopen it.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2402>
2021-07-13 03:36:37 +09:00
Seungha Yang fa4fb4c47f wasapi2ringbuffer: Run gst-indent
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2402>
2021-07-13 03:36:37 +09:00
Daniel Almeida d0e614b354 codecparsers: av1: fix underflow in last_frame_idx
The spec mandates this field be parsed using unsigned arithmetic. Nevertheless,
av1parser will use -1 apparently as an uninitialized value in
gst_av1_parse_frame_header. This immediately underflows last_frame_idx
though, since its type was defined as guint8. Fix this by converting to gint8.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2401>
2021-07-12 17:49:17 +00:00
Jakub Janků 211f968981 wasapi: fix reinit of audioclient in prepare()
When the sink goes from PLAYING to READY and then back to PLAYING,
the initialization of the audioclient in prepare() fails with the
error AUDCLNT_E_ALREADY_INITIALIZED. As a result, the playback
stops.

To fix this, we need to drop the AudioClient in unprepare() and
grab a new one in prepare() to be able to initialize it again
with the new buffer spec.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2096>
2021-07-12 13:47:07 +02:00
Jakub Janků 766a126380 wasapi: split gst_wasapi_util_get_device_client()
The functionality now resides in
gst_wasapi_util_get_device() and
gst_wasapi_util_get_audio_client().

This is a preparatory patch. It will be used in the following
patch to init/deinit the AudioClient separately from the device.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2096>
2021-07-12 13:47:06 +02:00
Jakub Janků d83881d43a tests: wasapi: check PLAYING -> READY -> PLAYING
Such sequence of state changes is valid and no error should happen.
At the moment, the test fails. Following patches aim to fix it.

Partially based on the code in tests/check/elements/wasapi2.c

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2096>
2021-07-12 13:47:06 +02:00
Sebastian Dröge 9243418a23 audioaggregator: Only post QoS messages if the property is enabled
Previously one of the branches did not check for the property value. To
avoid this in the future, check inside the QoS calculation function
instead.

As a side effect this now always prints the debug messages into the logs
when samples are dropped, which is useful information even without the
QoS messages.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1224>
2021-07-12 09:42:39 +03:00
Sebastian Dröge 71e46bcf38 audioaggregator: Resync on the next buffer when dropping a buffer on discont resyncing
If a buffer is dropped during resyncing on a discont because either its
end offset is already before the current output offset of the
aggregator or because it fully overlaps with the part of the current
output buffer that was already filled, then don't just assume that the
next buffer is going to start at exactly the expected offset. It might
still require some more dropping of samples.

This caused the input to be mixed with an offset to its actual position
in the output stream, causing additional latency and wrong
synchronization between the different input streams.

Instead consider each buffer after a discont as a discont until the
aggregator actually resynced and starts mixing samples from the input
again.

Also update the start output offset of a new input buffer if samples
have to be dropped at the beginning. Otherwise it might be mixed too
early into the output and overwrite part of the output buffer that
already took samples from this input into account.

Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/issues/912
which is a regression introduced by https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1180/

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1224>
2021-07-12 09:42:39 +03:00
Guido Günther f331082b20 play: Emit correct signal
SIGNAL_MEDIA_INFO_UPDATED should be emitted on media info changes,
not SIGNAL_VIDEO_DIMENSIONS_CHANGED.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2398>
2021-07-12 06:28:41 +00:00
Víctor Manuel Jáquez Leal c22ae0700b vulkan: Declare missing auto-pointer cleanup functions.
Also removed a couple guards since, given the glib dependency, they
are set.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2396>
2021-07-12 05:08:09 +00:00
Víctor Manuel Jáquez Leal 9c3363a25d vulkan: filter: Use filter variable name for choosing queue.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2396>
2021-07-12 05:08:09 +00:00
Víctor Manuel Jáquez Leal 1a32deefa6 vulkansink: Fix element metadata.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2396>
2021-07-12 05:08:09 +00:00
Yinhang Liu 2c70641b42 msdkvpp: use NV12 as default format on srcpad
By default, sinkpad is NV12 format and srcpad is BGRA format, the
different format will trigger an implicit format conversion in
msdkvpp, which will cause performance drop.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2394>
2021-07-09 17:31:10 +00:00
Dominique Martinet ff6442f6f9 gst-libs/gst/wayland: handle display passing better
failure to pass a display in 'handle' would result in uninitialized value
being returned, which would often segfault later down the road when trying
to initialize gstreamer context with it.
Check the return value of gst_structure_get() to make sure we return valid
data.

Furthermore, the gstglimagesink in gst-plugins-base also has a similar
mechanism but uses 'display' as field name to pass the value; instead of
requiring the application to behave differently depending on what sink
was automatically detected just try to read both values here, with display
being the new default.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2292>
2021-07-09 13:15:54 +00:00
Olivier Crête e8b4164a1f audiomixer: Add test for QoS message posting
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1209>
2021-07-08 23:01:13 -04:00
Olivier Crête 49f6d3bf33 audio aggregator: Post QoS message when dropping audio
Post a QoS message every time some audio samples are dropped.
Also print log messages to make it easier to debug

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1209>
2021-07-08 23:01:13 -04:00
Olivier Crête ea516aee33 audio aggregator: Count samples that are dropped or processed
Keep a count of samples that are dropped or processed as statistics

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1209>
2021-07-08 23:01:13 -04:00
Olivier Crête e3be1b8490 audio aggregator: Add QoS property to pad
Add a property to emit a QoS message whenever any data is dropped.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1209>
2021-07-08 23:01:13 -04:00
Olivier Crête 1eff5ffef6 audio aggregator: Rename property enum to match class name
Add "CONVERT" into the property enum as we're going to add an
enum specifically for the base pad.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1209>
2021-07-08 22:34:49 +00:00