Commit graph

246 commits

Author SHA1 Message Date
Nicolas Dufresne 8a6d9748b6 gleglimage: Fix GL_OES_EGL_image_external name in debug trace
There is a debug log when this extension is missing, but it was
reporting the wrong extension name, which was confusing.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3748>
2023-01-18 22:47:42 +00:00
Nirbheek Chauhan ed1bdf9b1a gl: Fix crash in cocoa due to race in gst_gl_context_activate()
We create a new context in `gst_gl_context_create_thread()` and then
activate it on the current thread. Thereafter we assume that the
current thread continues to be the active thread for that context and
call `gst_gl_context_fill_info()` which asserts that the current
thread is the active thread.

However, if at the same time a different thread calls
`send_message_async()`, it will call into
`gst_gl_window_cocoa_send_message_async()` which will schedule the
message to be invoked using GCD. That anonymous function will also
call `gst_gl_context_activate()`, which creates a race, which can lead
to:

```
gst_gl_context_fill_info: assertion 'context->priv->active_thread == g_thread_self ()' failed
```

Fix it by using `gst_gl_context_thread_add()` to invoke `fill_info()`
on the context.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3732>
2023-01-17 21:56:41 +00:00
Sebastian Dröge 086c8da446 gl/cocoa: Store a weak reference to the GstGLWindow instead of the GstGLContext
We can't rely on the `GstGLContext` to stay alive and need to keep track
of it. For that we keep track of the `GstGLWindow` in a weak reference
to avoid a reference cycle, and get the corresponding `GstGLContext`
whenever needed.

With contributions from Nirbheek Chauhan.

Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/1697

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3729>
2023-01-17 22:35:29 +05:30
Thibault Saunier d8ba721d82 glbasefilter: Copy metas when they only contain they "video" tag
Same logic as in `GstVideoFilter`

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3716>
2023-01-12 14:41:24 -03:00
Olivier Crête f97ff39358 audioenc/dec: Avoid adding temporary structure
As a minor optimisation

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3673>
2023-01-04 11:09:31 +00:00
Olivier Crête e03a10a0f2 audioenc/dec: Preserve downstream caps preference in get caps
This should fix pipelines such as this one to work as expected
  ... ! opusenc ! capsfilter caps='audio/x-opus,
  channels=1; audio/x-opus, channels=2' ! ...

The expectation is that the encoder will propose the first structure
before the second one to the source.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3673>
2023-01-04 11:09:31 +00:00
Sebastian Dröge 19603248c2 gl: Mark gst_gl_context_new_wrapped() return value as nullable
If a GL context is requested for which no API support is compiled in
then `NULL` is returned.

Also remove a useless `NULL` check: `g_object_new()` can't possibly
return `NULL`, ever.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3656>
2022-12-29 09:03:53 +00:00
F. Duncanh b713c141e0 plugins-base/tests/check/meson.build: add omitted Wayland dependence
SUSE places Wayland include files in /usr/include/wayland, and needs
a Cflag added to wayland_client_deps by pkg-config, which is added to
gl_winsys_deps: add this as a dependency in gstgl_dep to fix issue.

Fixes #1607

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3638>
2022-12-28 20:04:49 -05:00
Nirbheek Chauhan 36a619ba60 meson: Add gstreamer-gl-1.0 pkgconfig vars to internal dependency
So we can fetch gl_winsys, gl_platforms, etc directly using
gst_gl_dep.get_variable() when building gstreamer as a subproject, or
when building gst-plugins-rs's gtk4 plugin.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3654>
2022-12-29 03:52:42 +05:30
Thibault Saunier f7b342f1dd base:navigation: Cleanup navigation key modifiers enum
We were exposing the 'ALT' modifier as if we were guaranteeing its
accuracy but truth is we were only exposing configuration dependent
values.

Make the API simpler for now, the same way as Gtk3 was exposing it, and
when we have time to guarantee more values by making them take backends
configuration into account, we will expose those values in a accurate
way.

Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/1402

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3565>
2022-12-15 16:47:13 +00:00
Matthew Waters e59b3c93c7 glupload: add CAN_ACCEPT_RAW to all dma-buf uploaders
Fixes cases where a dma-buf would be uploaded using direct-dma-buf
into an external-oes texture (using video/x-raw caps) and then
attempting to reconfigure the same source.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3486>
2022-12-14 23:45:56 +00:00
Philippe Normand d98c78251c video-format: Add macro checking for validity of GstVideoFormatInfo
Mostly to maintain consistency with the GST_AUDIO_FORMAT_INFO_IS_VALID_RAW
macro.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2800>
2022-12-12 19:39:10 +00:00
Philippe Normand 3345d16aed audio-format: Add macro checking for validity of GstAudioFormatInfo
`gst_audio_format_info_fill_silence()` not properly checking the validity of its
input may lead it into an infinite loop.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2800>
2022-12-12 19:39:10 +00:00
Philippe Normand fa863b2b7f audiodecoder: Make data processing errors non-fatal by default
The previous default value of `max-errors` was too small and would potentially trigger the
decoder to emit errors too often for most cases.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3478>
2022-11-30 10:27:50 +00:00
Philippe Normand 9e5cce0ab9 videodecoder: Make data processing errors non-fatal by default
The previous default value of `max-errors` was too small and would potentially trigger the
decoder to emit errors too often for most cases.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3478>
2022-11-30 10:27:27 +00:00
Sebastian Dröge 12aa3925d0 sdpmessage: Annotate SDP message parameters for parse_uri() and parse_buffer() correctly
They are not actually `out` parameters but must be allocated and
initialized to a valid SDP message by the caller. Just allocating them
without initialization will cause memory corruptions because the
functions will try to clear/append to the existing SDP message.

As such they should be just marked as `transfer none`.

Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/1605

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3484>
2022-11-29 14:02:55 +02:00
Ignacio Casal Quinteiro 2aa34164f6 sdp: use g_strdup instead of strdup
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3475>
2022-11-28 09:36:18 +00:00
Tim-Philipp Müller dec3aa55e9 audioconvert, audioresample, audiofilter: fix divide by 0 for input buffer without caps
gst-launch-1.0 audiotestsrc ! udpsink host=127.0.0.1
gst-launch-1.0 udpsrc ! audioconvert ! autoaudiosink

would crash with a floating point exception when clipping the input
buffer owing to a division by zero because no caps event was received.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3469>
2022-11-26 08:47:49 +00:00
Matt Crane b11169bd32 rtpbasedepayload: Drop redundant reference timestamp buffer meta in RTP depayloaders
Currently, when rtspsrc property add-reference-timestamp-metadata=true,
a downstream rtph264depay element will attach multiple copies of the
same GstReferenceTimestampMeta to the depayloaded media buffers. This
can have signficant performance impacts further downstream in a pipeline
like the following:

    rtspsrc add-reference-timestamp-metadata=true ! rtph264depay ! h264parse ! ... ! rtph264pay ! ...

For example, if there are 10 packet buffers for a frame of RTP H.264
video, each of those packet buffers will contain the same reference
timestamp meta. The rtph264depay element will then attach all 10
metadata to the depayloaded frame. And then later when we payload the
frame buffer again for proxying, we now have 10 more buffers each with
10 instance of the same metadata. Allocating/deallocating 100+ instances
of metadata @ 30fps for multiple streams has a pretty large performance
impact.

Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/1578

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3431>
2022-11-19 07:57:44 +00:00
Nicolas Dufresne e60a94c27d video-frame: Avoid using tile width
The tile width in pixel is not always available. Notably for
8L128 10bit format, the tile is 8x128 bytes, and the pixel
format is fully packed. That means that the tile contains at
least 6 pixels per line, but it also hold some bits of the
pixel from the same line on the previous or next tile.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3424>
2022-11-18 22:59:29 +00:00
Nicolas Dufresne 5980fb76e7 video: Add arbitrary tile dimensions support
In current tile representation, only tiles with power of two
width and height in bytes are supported. This limitation
prevents adding more complex tiles formats.

In this patch, we deprecate tile_ws and tile_hs from GstVideoFormatInfo and
replace if with an array of GstVideoTileInfo. Each plane tiles are then
described with their pixels width/height, line stride and total size.
The helper gst_video_format_info_get_tile_sizes() that depends on the
deprecated API is also being removed. This can simply be removed as it wasn't
in any stable release yet.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3424>
2022-11-18 22:59:29 +00:00
Mathieu Duponchelle b5cd758230 aggregator: Implement force_live API
Setting force_live lets aggregator behave as if it had at least one of
its sinks connected to a live source, which should let us get rid of the
fake live test source hack that is probably present in dozens of
applications by now.

+ Expose API for subclasses to set and get force_live
+ Expose force-live properties in GstVideoAggregator and GstAudioAggregator
+ Adds a simple test

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3008>
2022-11-18 18:14:26 +00:00
Víctor Manuel Jáquez Leal f74fb5142d pbutils: Fix vp9 mime mapping when caps when no chroma-site.
It's possible to have 4:2:0 chroma format without chroma-site in caps, but it
isn't validated by the current code. This patch fixes it.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3405>
2022-11-16 01:29:50 +00:00
Sebastian Dröge 416dae67b2 videodecoder: Consider having output data when the subclass drops a frame
The subclass might drop a frame for QoS reasons (e.g. vpxdec) and if all
frames are dropped because of that it wouldn't make sense to post an
error message on EOS.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3408>
2022-11-15 21:18:50 +00:00
Edward Hervey 7988144048 pbutils/encoding-profile: Streamline cleanup
Cleanup all local variables in one place, and ensure failure cases go through there.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3390>
2022-11-13 06:59:11 +01:00
Edward Hervey 872b0a65cb pbutils/encoding-profile: Don't leak string array
It was never freed

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3390>
2022-11-12 10:33:51 +01:00
Nicolas Dufresne aaa01ac30a gstgl: Fix handling of padded tile formats
When a tile format is padded and imported as DMABuf, the stride
contains the information about the actual width and height in
number of tiles. This information is needed by the detiling shader
in order accuratly calculate the location of pixels. To fix that,
we also copy the offset and strides into the otuput format and
the converter will ensure that the shader is recompiled whenever
the stride changes.

This fixes video corruptions observed when decoding on MT8195
with videos that aren't not aligned to 64bytes in width.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3365>
2022-11-09 17:15:32 +00:00
Sebastian Dröge 40800fa117 discoverer: Annotate DiscovererInfo::get_audio_streams() and others with the concrete stream info type
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3353>
2022-11-07 19:04:49 +00:00
Matthew Waters 1c835695a3 pbutils: add correct mime mapping for vp9
Based on https://www.webmproject.org/vp9/mp4/#codecs-parameter-string

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3260>
2022-10-28 00:06:07 +00:00
Sebastian Dröge c878d0f68b core/base: Only post latency messages if the latency values have actually changed
Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/1525

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3282>
2022-10-27 15:25:22 +00:00
Edward Hervey 8f286fc388 videodecoder: Only post latency message if it changed
Posting latency messages causes a full and potentially expensive latency
recalculation of the pipeline. While subclasses should check whether the latency
really changed or not before calling this function, we ensure that we do not
post such messages if it didn't change.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3282>
2022-10-27 15:25:22 +00:00
Sebastian Dröge 366893e9ac Fix various warnings from gobject-introspection
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3261>
2022-10-25 09:45:25 +03:00
Nirbheek Chauhan a083280a58 gl/vulkan: Fix static linking on macOS
duplicate symbol '__invoke_on_main' in:
    /Library/Frameworks/GStreamer.framework/Versions/1.0/lib/libgstvulkan-1.0.a(cocoa_gstvkwindow_cocoa.m.o)
    /Library/Frameworks/GStreamer.framework/Versions/1.0/lib/libgstgl-1.0.a(cocoa_gstglwindow_cocoa.m.o)
ld: 1 duplicate symbol for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Also make the same change in iOS for consistency.

Continuation of https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/issues/1132

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3242>
2022-10-24 00:48:08 +00:00
Matthew Waters 5ddb347a23 build/gl: fix automatic dispmanx detection for rpi4
rpi4 doesn't contain dispmanx but still contains bcm_host.pc which
confuses the configure detection.  Add an explicit check for
EGL_DISPMANX_WINDOW_T to ensure that we only build with dispmanx when
the types are available.

Fixes: https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/issues/893
Fixes: https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/issues/952
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3230>
2022-10-20 22:29:16 +00:00
Matthew Waters 5fed85c465 docs/glcontextconfig: rename title to not be GstGLContext
Can be confusing havint two pages that both have GstGLContext as the
title.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3227>
2022-10-19 13:01:06 +00:00
Sebastian Dröge 2650bba844 sdp: Add/fix various annotations
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3194>
2022-10-18 13:51:17 +03:00
Sebastian Dröge 4617b63b5f tag: Add/fix various annotations
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3194>
2022-10-18 13:51:17 +03:00
Sebastian Dröge 2b91f7e165 allocators: Add/fix various annotations
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3194>
2022-10-18 13:51:17 +03:00
Sebastian Dröge 39591cb13d gl: Add/fix various annotations
And fix a memory leaks in gst_gl_display_egl_new() error cases.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3194>
2022-10-18 08:56:58 +00:00
Sebastian Dröge 533ea9bd7c pbutils: Add/fix various annotations
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3194>
2022-10-18 08:56:58 +00:00
Sebastian Dröge 47e4110a1b rtp: Add/fix various annotations
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3194>
2022-10-18 08:56:58 +00:00
Sebastian Dröge 84ab8c9e12 rtsp: Add/fix various annotations
Also initialize out parameters so that they don't have an undefined
value in case of errors.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3194>
2022-10-18 08:56:58 +00:00
Sebastian Dröge 75731aec53 app: Add/fix various annotations
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3194>
2022-10-18 08:56:58 +00:00
Sebastian Dröge e0b06df223 audio: Add/fix various annotations
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3194>
2022-10-18 08:56:58 +00:00
Sebastian Dröge 2e5c73fff7 video: Add/fix various annotations
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3194>
2022-10-18 08:56:58 +00:00
Sebastian Dröge 4df3da3bab rtpbuffer: Initialize extended timestamp to the first wraparound period
This allows correct handling of wrapping around backwards during the
first wraparound period and avoids the infamous "Cannot unwrap, any
wrapping took place yet" error message.

It allows makes sure that for actual timestamp jumps a valid value is
returned instead of 0, which then allows the caller to handle it
properly. Not having this can have the caller see the same timestamp (0)
for a very long time, which for example can cause rtpjitterbuffer to
output the same timestamp for a very long time.

Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/1500

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3202>
2022-10-18 06:09:08 +00:00
Julian Bouzas 9197235539 riff: Mark jpeg as parsed
This is needed so that autoplugging works with avidemux and JPEG decoders that
need parsed sink caps (eg rockchip 'mppjpegdec' decoder). It also works fine
with 'jpegdec' decoder regardless.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3175>
2022-10-13 13:53:29 -04:00
Nicolas Dufresne 82f63b0d64 opengl: Fix usage of eglCreate/DestroyImage
The implementation was inconsistent between create and destroy. EGLImage
creation and destruction is requires for EGL 1.5 and up, while
otherwise the KHR version is only available if EGL_KHR_image_base
feature is set. Not doing these check may lead to getting a function
pointer to a stub, which is notably the case when using apitrace.

Fixes #1389

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2925>
2022-10-11 08:23:45 +00:00
Seungha Yang c9f12b5086 videosink: Don't return unknown end-time from get_times()
... in case of reverse playback. Otherwise basesink will not
wait for clock

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3121>
2022-10-06 06:36:42 +00:00
Haihao Xiang 8f5399b156 eglimage: fix Y412_LE DMABuf import support
This fixed the error below:

GST_GL_PLATFORM=egl gst-launch-1.0 videotestsrc ! msdkvpp !
"video/x-raw(memory:DMABuf),format=Y412_LE" ! glimagesink

0:00:00.063737691 576978 0x557c11266920 ERROR             gleglimage
gsteglimage.c:577:_drm_rgba_fourcc_from_info: Unsupported format for
DMABuf.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1389>
2022-10-05 04:21:03 +00:00