Commit graph

7851 commits

Author SHA1 Message Date
Matthew Waters
7066c849e4 glcontext: add support for influencing the backing configuration
New API:
- gst_gl_context_get_config()
- gst_gl_context_request_config()

A GL context configuration is a GstStructure that has some well-known
names for common values that can also be extended in platform-specific
ways if necessary.

Wrapped OpenGL contexts may be able to retrieve the GL context
configuration depending on the platform.  If that information is
available, GstGLContext will attempt to create an context that matches
the shared OpenGL context config unless gst_gl_context_request_config()
has been called.

A new environment variable 'GST_GL_CONFIG' will be read to influence the
configuration chosen.  The environment variable will only be used as a
fallback if gst_gl_context_request_config() has not been called.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/809>
2021-05-13 16:44:28 +10:00
Matthew Waters
dfd749c5da gl/context/egl: change header guard to be unique
The header guard in gst/gl/egl/gstglcontext_egl.h was the same as
gst/gl/egl/egl.h

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/809>
2021-05-13 16:19:42 +10:00
Matthew Waters
f03071439f gl/api: improve the to/from string for GstGLAPI/GstGLPlatform
With unit tests now!

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/809>
2021-05-13 15:35:23 +10:00
Matthew Waters
3c3d978578 gl/framebuffer: expand documentation on valid usage
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/809>
2021-05-12 16:51:25 +10:00
Haihao Xiang
74129211e4 gl: add support for RGBP and BGRP formats
gst-launch-1.0 videotestsrc ! video/x-raw,format=RGBP ! glimagesink
gst-launch-1.0 videotestsrc ! video/x-raw,format=BGRP ! glimagesink

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1141>
2021-05-11 12:24:41 +08:00
Haihao Xiang
ca046ca73c video: add support for RGBP and BGRP formats
The two RGB planar formats are used in OpenVino [1]

gst-launch-1.0 videotestsrc ! video/x-raw,format=BGRP ! fakesink
gst-launch-1.0 videotestsrc ! video/x-raw,format=RGBP ! fakesink

[1] https://docs.openvinotoolkit.org/latest/openvino_docs_optimization_guide_dldt_optimization_guide.html

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1141>
2021-05-11 12:24:41 +08:00
Nicolas Dufresne
d3ac7bfcbf codec: Introduce GstVideoCodecAlphaMeta
This meta hold one buffer of the same codec data as the parent memory. This
extra frame luma will be used as the alpha values for the final combined
frame. This is notably used to support VP8/VP9 alpha as defined in WebM and
matroska specification.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1128>
2021-05-10 16:33:11 -04:00
Nicolas Dufresne
ac54f073d8 video: Sort includes in video.h
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1128>
2021-05-05 16:20:37 -04:00
Sebastian Dröge
02530e9d3e appsrc: Implement a leaky property similar to the queue element
This allows dropping the newest or oldest buffer when the internal queue
is full instead of blocking or continuing to grow.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1133>
2021-05-05 15:13:33 +00:00
Sebastian Dröge
d987ec21f2 appsrc: Add new max-buffers / max-time / current-level-buffers / current-level-time properties
These work the same way as the corresponding properties on queue and
allow to control the internal buffer size of the appsrc in a more
flexible way.

Unlike in queue the max-buffers and max-time properties are 0 (i.e.
disabled) by default for backwards compatibility reasons.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1133>
2021-05-05 15:13:33 +00:00
Matthew Waters
a77c316590 rtp/hdrext: correct gst_rtp_get_header_extension_list() docs
The return value is a list of GstElementFactory's that when
gst_element_factory_create()ed will create a GstRTPHeaderExtension.

Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/issues/897

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1136>
2021-05-04 15:40:30 +10:00
Sebastian Dröge
da9a3da8aa appsrc: Don't leak buffer list while wrongly unreffing buffer on EOS/flushing
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1134>
2021-05-03 05:42:07 +00:00
Sebastian Dröge
fc7d65b107 app: Add gstappsrc.h to the enum headers in meson.build
It's already indirectly included but let's better be explicit here.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1134>
2021-05-03 05:42:07 +00:00
Matthew Waters
1ca747436f sdp/caps: support translating transport-cc rtcp-fb from caps to sdp attributes
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1130>
2021-04-29 21:16:57 +10:00
Doug Nazar
7725c90d5c rtp: Fix request-extension signal call
Signal is registered as taking a guint however was being passed a
guint64 which fails on 32-bit.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1102>
2021-04-28 22:50:53 -04:00
Matthew Waters
c16412dd63 gl/download: add support for output memory:NVMM buffers
Currently RGBA-only.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1071>
2021-04-28 12:44:38 +10:00
Matthew Waters
94f0d9c69b gl/bufferpool: add api for retrieving the configure gl allocation params
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1071>
2021-04-28 12:44:38 +10:00
Matthew Waters
2f35aeca8c glupload: add support for uploading memory:NVMM buffers
Currently RGBA-only.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1071>
2021-04-28 12:42:15 +10:00
Matthew Waters
f770982635 glupload: guard against glEGLImageTexture2D not existing
e.g. if targetting EGL/opengl, we would attempt to use this GLES
function when wrapping EGLImage's.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1071>
2021-04-28 12:42:15 +10:00
Xavier Claessens
4ef5c91697 gstgl: Fix build when Meson >= 0.58.0rc1
"implicit_include_directories: false" now also means that current build
directory is not added to include paths by default any more. We have to
add it manually because we have some custom_target() that generate
headers in current build directory.

See https://github.com/mesonbuild/meson/issues/8700.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1125>
2021-04-27 08:26:18 +00:00
Doug Nazar
b14c2e6fb0 opengl: Silence macOS OpenGL deprecations
As of macOS 10.14 the entire OpenGL system is deprecated. No need to
log the general warnings about it. Specific warnings are still enabled.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1123>
2021-04-24 22:26:36 -04:00
Jakub Adam
538e2ef1d0 rtpbasedepay: fix locking of GstRTPHeaderExtension
'ext' object unlocked if gst_rtp_header_extension_read() fails was never
locked in the first place.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1118>
2021-04-21 17:34:18 +02:00
Jordan Petridis
df88b10c7f gstvideoencoder: make sure the buffer is writable before modifying metadata
Similar to ae8d0cf3ac

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1112>
2021-04-20 16:01:15 +00:00
Stéphane Cerveau
ada8b07be2 videodecoder: use DTS if PTS unknown
The buffer should be set according to DTS if exists
when we are guessin the PTS instead of segment start.
The decoder can receive buffers which are before the segment
in case of seek for example.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1111>
2021-04-19 13:28:39 +02:00
Marijn Suijten
33167573e1 Drop @ documentation references from functions and external types
`@` references are used to reference function parameters, struct members
or enum variants _within_ the current type/function.  It cannot and
should not be used to reference to types outside that.

Since C has no notion of member functions it makes little sense to
prefix these with `@`; most of the documentation here was referencing
functions on _different_ types anyway.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1090>
2021-04-15 15:49:39 +02:00
Tim-Philipp Müller
5b754c381c gl: fix up Since markers for newly-added _get_type() functions
Follow-up to !999 which wasn't backported into 1.18 in the end
after all.

Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/issues/857

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1101>
2021-04-11 23:50:35 +01:00
Doug Nazar
1d5ad7d1da audio/alsa: Exit write loop if underlying device is already paused.
If the alsasink thread starts the write loop but another thread pauses
the underlying alsa device, the sink thread will endlessly loop.

snd_pcm_writei() will return 0 if the state is SND_PCM_STATE_PAUSED
and the loop will never make any progress.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1097>
2021-04-08 07:28:21 +00:00
Xavier Claessens
f38d2d3820 meson: Fix gstreamer-gl-prototypes-1.0.pc
This fix a warning because we were generating 2 pc files for gstgl
library. Also fix missing glesv2 in Requires.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1099>
2021-04-08 06:09:36 +00:00
Matej Knopp
e0623aa03a codec-utils: properly determine AAC Level
Table 1.10 – "Levels for the AAC Profile" only goes to 5 max channels
/ 7 max channel post amendmend, so I assume the number of channels
should not include LFE, otherwise there's no valid level for 5.1 resp.
7.1 (post amendmend)

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/680>
2021-04-07 23:28:22 +00:00
Binh Truong
a5e2883ff0 Fix build issue on MinGW64
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1094>
2021-04-04 21:18:59 +07:00
Jakub Adam
50c32a8963 rtpbuffer: make sure header extension buffer is initialized
Based upon valgrind finding:

Conditional jump or move depends on uninitialised value(s)
   at 0x4AFF589: read_rtp_header_extensions (gstrtpbasedepayload.c:1197)
   by 0x4AFF9E5: gst_rtp_base_depayload_set_headers
(gstrtpbasedepayload.c:1298)
   by 0x4AFFEE0: gst_rtp_base_depayload_do_push
(gstrtpbasedepayload.c:1413)
   by 0x4AFFF53: gst_rtp_base_depayload_push
(gstrtpbasedepayload.c:1448)
   by 0x4AFDEBA: gst_rtp_base_depayload_handle_buffer
(gstrtpbasedepayload.c:801)
   by 0x4AFE41E: gst_rtp_base_depayload_chain_list
(gstrtpbasedepayload.c:899)
   by 0x48F262C: gst_pad_chain_data_unchecked (gstpad.c:4414)
   by 0x48F3333: gst_pad_push_data (gstpad.c:4655)
   by 0x48F3DF8: gst_pad_push_list (gstpad.c:4814)
   by 0x4AFAD87: gst_rtp_base_payload_push_list
(gstrtpbasepayload.c:1978)
   by 0x72B3154: gst_rtp_vp8_pay_handle_buffer (gstrtpvp8pay.c:672)
   by 0x4AF7031: gst_rtp_base_payload_chain (gstrtpbasepayload.c:868)
 Uninitialised value was created by a heap allocation
   at 0x483C77F: malloc (in
/usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
   by 0x4B8BA78: g_malloc (gmem.c:106)
   by 0x4BA3A9D: g_slice_alloc (gslice.c:1069)
   by 0x488D777: _sysmem_new_block (gstallocator.c:413)
   by 0x488DB28: default_alloc (gstallocator.c:512)
   by 0x488D3E8: gst_allocator_alloc (gstallocator.c:310)
   by 0x4AE97E3: gst_rtp_buffer_set_extension_data (gstrtpbuffer.c:856)
   by 0x4AF9EC6: set_headers (gstrtpbasepayload.c:1757)
   by 0x489FE4D: gst_buffer_list_foreach (gstbufferlist.c:287)
   by 0x4AFA87A: gst_rtp_base_payload_prepare_push
(gstrtpbasepayload.c:1915)
   by 0x4AFAD06: gst_rtp_base_payload_push_list
(gstrtpbasepayload.c:1970)
   by 0x72B3154: gst_rtp_vp8_pay_handle_buffer (gstrtpvp8pay.c:672)

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1075>
2021-04-03 09:39:02 +00:00
Matthew Waters
3d9e705621 videoaggregator: allow selecting an alpha output from non-alpha inputs
e.g. if we have:

video-x/raw,format=I420 ! compositor ! video/x-raw,format=BGRA

This will currently produce a warning as the alpha-ness of the chosen
'best' format (I420) will be different from the value restricted by the
downstream caps filter.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1059>
2021-03-31 01:55:17 +00:00
Matthew Waters
eb06907fb4 gl/wayland: provide a dummy global_remove function
Even if we don't care about any global objects being removed, wayland
will still error if globals are removed without a corresponding listener
set up for them.  e.g. wl_output hotplugging

Discovered by: Matthias Clasen

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1079>
2021-03-22 14:05:27 +11:00
Matthew Waters
98249a57db gst: don't use volatile to mean atomic
volatile is not sufficient to provide atomic guarantees and real atomics
should be used instead.  GCC 11 has started warning about using volatile
with atomic operations.

https://gitlab.gnome.org/GNOME/glib/-/merge_requests/1719

Discovered in https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/issues/868

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1073>
2021-03-19 04:20:19 +00:00
Jan Alexander Steffens (heftig)
a379e0e5f1 audioaggregator: Consider converting for equal audio formats
The converter might have a non-passthrough mix-matrix. The converter
can determine whether it should pass through, so let it, then remove it
if it's indeed a passthrough.

FIXME: Not converting when we need to but the config is invalid (e.g.
because the mix-matrix is not the right size) produces garbage. An
invalid config should cause a GST_FLOW_NOT_NEGOTIATED.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1070>
2021-03-16 13:46:56 +01:00
Jan Alexander Steffens (heftig)
43449d9fb2 audioaggregator: Clean up _convert_pad_update_converter
No functional change.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1070>
2021-03-16 13:46:55 +01:00
Nirbheek Chauhan
9b01036664 rtspconnection: Consistently translate GIOError to GstRTSPResult
The users of this API need to be able to differentiate between EINTR
and ERROR. For example, in rtspsrc, gst_rtsp_conninfo_connect()
behaves differently when gst_rtsp_connection_connect_with_response_usec()
returns an ERROR or EINTR. The former is an element error while the
latter is simple a GST_ERROR since it was a user cancellation of the
connection attempt.

Due to this, rtspsrc was incorrectly emitting element errors while
going to NULL, which would or would not reach the application in
a racy manner.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1069>
2021-03-16 08:18:11 +00:00
Tim-Philipp Müller
f4a1428a69 tag: id3v2: fix frame size check and potential invalid reads
Check the right variable when checking if there's
enough data left to read the frame size.

Closes https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/issues/876

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1065>
2021-03-15 11:44:22 +00:00
Jakub Adam
1a87a6572e rtpbasedepayload: handle caps change partway through buffer list
While preparing a blist for pushing, some RTP header extension may
request caps change for a specific buffer in the list. When this
happens, depayloader should immediately push those buffers from the list
that precede the currently processed buffer (for which the caps change
was requested) and only then apply the new caps to the src pad.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1011>
2021-03-12 18:45:04 +01:00
Jakub Adam
c222f322c0 rtphdrext: allow updating depayloader src caps
Add overridable method that updates depayloader's src caps based on
the data from RTP header.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1011>
2021-03-12 18:45:04 +01:00
Jakub Adam
899c69abad rtphdrext: allow the extension to inspect payloader's sink caps
Some header extensions may need to read information from the payloader's
sink caps. Introduce gst_rtp_header_extension_update_from_sinkcaps ()
that passes the caps to the extension, which can then use it to update
its internal state.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1011>
2021-03-12 18:45:04 +01:00
Guillaume Desmottes
b7c1810aa3 audioaggregator: fix input_buffer ownership
The way pad->priv->input_buffer reference was managed was pretty
spurious:
- it was overridden without unrefing it, which could potentially lead to
  leaks.
- we were unreffing it while keeping the pointer around, which could
  potentially lead to use-after-free or double-free.

As priv->input_buffer is actually no longer used outside of the
aggregate() method, remove it from pad->priv to simplify the code and
prevent the issues desribed above.

Fix a single buffer leak when shutting down the pipeline as the buffer
returned from gst_aggregator_pad_drop_buffer() was never unreffed.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1061>
2021-03-10 16:38:03 +01:00
Guillaume Desmottes
44358f1eaf audioaggregator: fix input buffer when converting
This code path is meant to convert the current buffer to the new format
on update. It was using priv->input_buffer as input which is either
priv->buffer or a converted version of it.
Use priv->buffer instead as priv->input_buffer may no longer be a valid
reference.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1061>
2021-03-10 16:34:28 +01:00
Alexander Vandenbulcke
ccebcaa586 gl/dispmanx: assign render_rect to window before window_resize
If the `render_rect` for a dispmanx display is set after calling
`window_resize` the resize defaults to the dp_width and dp_height to
determine the location of the render rectangle instead of the correct
dimensions that should be set on the window_egl.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1056>
2021-03-02 09:13:25 +01:00
Kristofer Björkström
11b5ebd058 gstrtspconnection: correct data_size when tunneled mode
gst_rtsp_connection_send_messages_usec in tunneled mode does base64
encode messages. When calculating data_size 1 bytes is added, which
results in ending the base64 with a NULL.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1051>
2021-02-25 12:21:53 +01:00
Robert Rosengren
e99a6f3142 audio: Use GST_BUFFER_PTS instead of deprecated GST_BUFFER_TIMESTAMP
GST_BUFFER_PTS already used in audio code base (e.g. gstaudiodecoder),
so migrate completely from deprecated GST_BUFFER_TIMESTAMP for better
readability, as gstcompat.h defines GST_BUFFER_TIMESTAMP directly to PTS
anyway.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1048>
2021-02-25 02:04:44 +00:00
Sebastian Dröge
f5381ba9f5 audioaggregator: Log if the sample rate of one sinkpad is not accepted
Otherwise this can silently cause not-negotiated errors without any
direct hint about what went wrong.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1049>
2021-02-24 19:53:02 +02:00
Vivia Nikolaidou
1517b7043d video-converter: Don't upsample/downsample/dither invalid lines
This is a fallout from the conversion to support multiple threads.
convert->upsample_p is never NULL now, it's always an allocated array of
n_threads potentially-null pointers.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1043>
2021-02-23 03:40:12 +00:00
Vivia Nikolaidou
2527c8f9f8 libs: audio: Handle meta changes in gst_audio_buffer_truncate
Set timestamp and duration to GST_CLOCK_TIME_NONE unless trim==0,
because that function doesn't know the rate and therefore can't
calculate them. Set offset and offset_end to appropriate values. Make it
clear in the documentation that the caller is responsible for setting
the timestamp and duration.

Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/issues/869

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1039>
2021-02-18 11:25:32 +02:00
Alicia Boya García
29aeba639a videodecoder: Fix racy critical when pool negotiation occurs during flush
I found a rather reproducible race in a WebKit LayoutTest when a player
was intantiated and a VP8/9 video was loaded, then torn down after
getting the video dimensions from the caps.

The crash occurs during the handling of the first frame by gstvpxdec.
The following actions happen sequentially leading to a crash.

(MT=Main Thread, ST=Streaming Thread)

MT: Sets pipeline state to NULL, which deactivates vpxdec's srcpad,
    which in turn sets its FLUSHING flag.

ST: gst_vpx_dec_handle_frame() -- which is still running -- calls
    gst_video_decoder_allocate_output_frame(); this in turn calls
    gst_video_decoder_negotiate_unlocked() which fails because the
    srcpad is FLUSHING. As a direct consequence of the negotiation
    failure, a pool is NOT set.

    gst_video_decoder_negotiate_unlocked() still assumes there is a
    pool, crashing in a critical in gst_buffer_pool_acquire_buffer()
    a couple statements later.

This patch fixes the bug by returning != GST_FLOW_OK when the
negotiation fails. If the srcpad is FLUSHING, GST_FLOW_FLUSHING is
returned, otherwise GST_FLOW_ERROR is used.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1031>
2021-02-16 16:57:54 +00:00