platform/upstream/gstreamer.git
2 years agowebrtcbin: Add a signal to plug bandwidth estimator elements
Thibault Saunier [Sat, 4 Jun 2022 22:07:16 +0000 (18:07 -0400)]
webrtcbin: Add a signal to plug bandwidth estimator elements

We need GStreamer elements to do the bandwidth estimation as this way
they can also control the pacing of the transmission flow as specified
 in the [GCC] algorithm for example.

Bandwidth estimator element are placed right before the "RTPSession" as
an "rtp-aux-sender" element. This way they can use the "Transport-wide
Congestion Control" RTCP feedback messages through the "RTPTwcc" custom
events that are sent by the rtpsession.

Applications are responsible to react to the bandwidth estimator element
and set the encoder target bitrate etc... which means that we can not
pass an estimator as an element factory, so a signal as been chosen
instead.

[GCC]: https://datatracker.ietf.org/doc/html/draft-ietf-rmcat-gcc-02

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2562>

2 years agotracers: leaks: fix object-refings.class flags
Corentin Damman [Tue, 12 Jul 2022 10:49:27 +0000 (10:49 +0000)]
tracers: leaks: fix object-refings.class flags

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2749>

2 years agodevicemonitor: Use a sync bus handler for the provider to avoid accumulating all...
Sebastian Dröge [Sat, 9 Jul 2022 15:05:58 +0000 (18:05 +0300)]
devicemonitor: Use a sync bus handler for the provider to avoid accumulating all messages until the provider is stopped

Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/issues/981

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2741>

2 years agosplitmuxsink: Fix memory leak
Jan Schmidt [Tue, 12 Jul 2022 11:19:35 +0000 (21:19 +1000)]
splitmuxsink: Fix memory leak

Fix a leak of the buffer info struct when reaching
EOS without data on the reference input.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2751>

2 years agortsp-client: Fix url for generating key in media factory
Bruce Liang [Tue, 12 Jul 2022 08:58:00 +0000 (16:58 +0800)]
rtsp-client: Fix url for generating key in media factory

The mount point at / can be accessed by both the URL forms rtsp://<IP>:<PORT> and rtsp://<IP>:<PORT>/.
To make media factory generating the same key for both the URL forms, the url sent to gst_rtsp_media_factory_construct() needs to be normalized first.
This commit creates a new GstRTSPUrl as the normalized url to send to gst_rtsp_media_factory_construct().

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

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2681>

2 years agoglupload: Add raw caps to sink pad when needed.
Jan Schmidt [Thu, 7 Jul 2022 13:40:22 +0000 (23:40 +1000)]
glupload: Add raw caps to sink pad when needed.

When checking if the current upload method can support
the requested caps filter in _transform_caps(),
make sure the sink pad reports raw caps.

Fixes #1311

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2725>

2 years agogstglupload: Remove raw caps from individual methods
Jan Schmidt [Thu, 7 Jul 2022 13:54:44 +0000 (23:54 +1000)]
gstglupload: Remove raw caps from individual methods

Raw memory upload should always be the least preferred input
caps, only added by the raw memory uploader as the last thing
in the caps.

Caps negotiation should still choose raw data when it needs to,
and other upload methods that can accept raw data buffers will still do so.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2725>

2 years agovideoaggregator: always convert when user provides converter-config
Mathieu Duponchelle [Mon, 11 Jul 2022 18:12:30 +0000 (20:12 +0200)]
videoaggregator: always convert when user provides converter-config

The `converter-config` property may be used to perform cropping,
conversion should always be performed when the user set the property
to a non-NULL value.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2746>

2 years agortpjitterbuffer: Fix calculation of RFC7273 RTP time period start
Sebastian Dröge [Fri, 24 Jun 2022 10:32:34 +0000 (13:32 +0300)]
rtpjitterbuffer: Fix calculation of RFC7273 RTP time period start

This has to be based directly on the current estimated clock time and
has to allow for negative period starts.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2655>

2 years agoh265decoder: Report latency
Seungha Yang [Thu, 7 Jul 2022 15:16:02 +0000 (00:16 +0900)]
h265decoder: Report latency

Similar to that of h264decoder

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2726>

2 years agoglwindow_cocoa: fix a leak of the GstNSView
Andoni Morales Alastruey [Fri, 8 Jul 2022 18:49:21 +0000 (20:49 +0200)]
glwindow_cocoa: fix a leak of the GstNSView

This leak is also causing a leak of the GstGLCAOpenGLLayer
which leaks the GstGLWrappedContext and the GstGLDisplay

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2736>

2 years agogl: Fix leak of the whole CGL context
Andoni Morales Alastruey [Fri, 8 Jul 2022 18:38:51 +0000 (20:38 +0200)]
gl: Fix leak of the whole CGL context

This was leaking the CGL context and several resources
allocated in the context, around 70MB for a 1080p clip

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2736>

2 years agova: baseenc: Do not use codec frame structure again after finish_frame().
He Junyan [Fri, 8 Jul 2022 14:05:12 +0000 (22:05 +0800)]
va: baseenc: Do not use codec frame structure again after finish_frame().

In _push_out_one_buffer(), we use codec frame structure again for error handling
after we already call finish_frame(), which is a latent segment fault.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2739>

2 years agova: baseenc: Do not clear the codec frame twice when error.
He Junyan [Fri, 8 Jul 2022 13:57:40 +0000 (21:57 +0800)]
va: baseenc: Do not clear the codec frame twice when error.

The current manner will clear the input codec frame twice if we fail
to push the output data, which will trigger an assert.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2739>

2 years agofluiddec: Remove workaround for version 1.1.9
Jordan Petridis [Tue, 5 Jul 2022 15:21:12 +0000 (18:21 +0300)]
fluiddec: Remove workaround for version 1.1.9

We require >= 2.1 version since the previous commit

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2718>

2 years agofluidsynth: update from now deprecated api
Jordan Petridis [Tue, 5 Jul 2022 14:32:12 +0000 (17:32 +0300)]
fluidsynth: update from now deprecated api

fluid_synth_set_chorus_on and fluid_synth_set_reverb_on were
deprecated in favor of new funtions where you can also specify
the fx_group the effect would apply.

The behavior of the set_* variants was to apply to all groups
so we pass -1 to the new functions as per documentation.

https://www.fluidsynth.org/api/group__chorus__effect.html#ga3c48310eecdca9cd338799d19f19c32d

and

https://www.fluidsynth.org/api/group__reverb__effect.html#gacb7917564c988cf54f2e35189b509c8e

and the introduction of the change:

https://github.com/FluidSynth/fluidsynth/pull/673

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2718>

2 years agobase: lookup RGB format without alpha
Marc Leeman [Tue, 14 Jun 2022 10:22:22 +0000 (12:22 +0200)]
base: lookup RGB format without alpha

librfb requests a colour space for depth 32 and bpp 32 with alpha set to
0x0, treat this the same as depth 24 with bpp 32.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2627>

2 years agod3d11: Use scoped device lock
Seungha Yang [Thu, 7 Jul 2022 17:24:56 +0000 (02:24 +0900)]
d3d11: Use scoped device lock

Make code simpler and more deadlock-free

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2728>

2 years agogstinfo: Parse "NONE" as a valid level name
Jan Alexander Steffens (heftig) [Fri, 8 Jul 2022 14:37:51 +0000 (16:37 +0200)]
gstinfo: Parse "NONE" as a valid level name

This allows using `NONE` in `GST_DEBUG`,
`gst_debug_set_threshold_from_string`, etc. It was accessible before,
but only via the integer `0`.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2734>

2 years agopython: Fix the audiotestsrc example
Thibault Saunier [Tue, 28 Jun 2022 20:38:09 +0000 (16:38 -0400)]
python: Fix the audiotestsrc example

Since 830d1595b94ee855b664b2101f0832fbd0181b9c AudioInfo::from_caps has been hidden in python

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2675>

2 years agopython: Add a Gst.init_python function to be called from plugins
Thibault Saunier [Tue, 28 Jun 2022 20:35:58 +0000 (16:35 -0400)]
python: Add a Gst.init_python function to be called from plugins

Plugins know that they will be initialized after Gst was initialized
so they can call the initialization function dedicated for the python
bindings

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2675>

2 years agopython: Do not call gst_init when it is already is_initialized
Thibault Saunier [Tue, 28 Jun 2022 15:02:37 +0000 (11:02 -0400)]
python: Do not call gst_init when it is already is_initialized

GStreamer plugins written in python need to call `Gst.init` to ensure
that GStreamer is initialized so when loading a python plugin, we might
be recursively calling `gst_init` which is not a good idea.

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

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2675>

2 years agolibav: Fix for APNG encoder property registration
Seungha Yang [Thu, 7 Jul 2022 13:16:30 +0000 (22:16 +0900)]
libav: Fix for APNG encoder property registration

The AVClass name of Animated PNG in FFmpeg 5.x is "(A)PNG"
and it will be converted to "-a-png" through
g_ascii_strdown() and g_strcanon(). But GLib disallow leading '-'
character for a GType name. Strip leading '-' to workaround it.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2724>

2 years agoqsvencoder: Fix for latency report when B-frame is enabled
Seungha Yang [Fri, 8 Jul 2022 09:53:01 +0000 (18:53 +0900)]
qsvencoder: Fix for latency report when B-frame is enabled

QSV runtime will introduce additional delay when B-frame is enabled

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2730>

2 years agoqsvencoder: Do not query again if previous call succeeded
Seungha Yang [Fri, 8 Jul 2022 10:05:19 +0000 (19:05 +0900)]
qsvencoder: Do not query again if previous call succeeded

Don't need to query multiple times

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2730>

2 years agod3d11screencapturesrc: Set colorimetry to caps
Seungha Yang [Thu, 7 Jul 2022 18:38:30 +0000 (03:38 +0900)]
d3d11screencapturesrc: Set colorimetry to caps

Make use of reported DXGI colorspace if possible

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2729>

2 years agod3d11: Update colorspace map
Seungha Yang [Fri, 8 Jul 2022 11:11:00 +0000 (20:11 +0900)]
d3d11: Update colorspace map

Map DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709 to sRGB colorimetry

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2729>

2 years agod3d11: Add an utility method for DXGI colorspace conversion
Seungha Yang [Thu, 7 Jul 2022 19:37:33 +0000 (04:37 +0900)]
d3d11: Add an utility method for DXGI colorspace conversion

Add a method for DXGI_COLOR_SPACE_TYPE -> GstVideoColorimetry conversion

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2729>

2 years agod3d11: Serialize ensure_element_data() call
Seungha Yang [Thu, 7 Jul 2022 16:30:13 +0000 (01:30 +0900)]
d3d11: Serialize ensure_element_data() call

It can be called any time from random thread. Thus, multiple
device objects can be created for the same physical device
if the call is not serialized, that's not a scenario we expect.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2727>

2 years agoproxysink: Fix GstProxySrc leak
Seungha Yang [Wed, 6 Jul 2022 17:17:56 +0000 (02:17 +0900)]
proxysink: Fix GstProxySrc leak

Clear weak pointer to peer src when disposing.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1552>

2 years agoproxysink: Make sure stream-start and caps events are forwarded
Seungha Yang [Tue, 5 Jul 2022 18:14:25 +0000 (03:14 +0900)]
proxysink: Make sure stream-start and caps events are forwarded

There might be a sequence of event and buffer flow:
- Got stream-start/caps/segment events
- Got flush events
- And then buffers with a new segment event

In the above case, stream-start and caps event might not be reached to
peer proxysrc if peer proxysrc is not ready to receive them.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1552>

2 years agosplitmuxsink: Don't crash on EOS without buffer
Seungha Yang [Wed, 13 Apr 2022 16:19:51 +0000 (01:19 +0900)]
splitmuxsink: Don't crash on EOS without buffer

Fix a case where upstream pushed EOS without buffers.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2174>

2 years agowebrtc: implement support for asynchronous host resolution
Matthew Waters [Fri, 4 Mar 2022 03:28:21 +0000 (14:28 +1100)]
webrtc: implement support for asynchronous host resolution

Doesn't block anymore if a mdns host resolution takes multiple seconds
to complete in e.g. stun/turn/ice candidate usage.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1961>

2 years agovideoconvertscale: ensure writable caps when fixating format
Matthew Waters [Mon, 4 Jul 2022 07:27:50 +0000 (17:27 +1000)]
videoconvertscale: ensure writable caps when fixating format

gst_video_convert_scale_get_fixed_format() receives 'othercaps' from
basetransforms' fixate_caps() vmethod which explicitly mentions that
'`othercaps` may not be writable'.

The gst_caps_intersect() call just before may or may not produce new
caps. Particularly in cases like EMPTY or ANY caps on either of the
inputs, only a ref is taken and returned to the caller.

As a result, gst_video_convert_scale_fixate_format() may have attempted
to modify a non-writable caps structure.

Fix by adding a gst_caps_make_writable().

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2709>

2 years agortprtx: Fix copying extension headers
Thibault Saunier [Thu, 30 Jun 2022 15:15:22 +0000 (15:15 +0000)]
rtprtx: Fix copying extension headers

There was a typo leading to reading memory from the buffer we were
writing to.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2696>

2 years agod3d11converter: Remove convert() method
Seungha Yang [Mon, 4 Jul 2022 13:27:34 +0000 (22:27 +0900)]
d3d11converter: Remove convert() method

Expose only single convert_buffer() method. It's safer approach than
passing arbitrary list of SRV/RTV pointers.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2713>

2 years agod3d11testsrc: Use convert_buffer() method
Seungha Yang [Mon, 4 Jul 2022 13:26:19 +0000 (22:26 +0900)]
d3d11testsrc: Use convert_buffer() method

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2713>

2 years agod3d11: Remove video processor
Seungha Yang [Mon, 4 Jul 2022 13:01:49 +0000 (22:01 +0900)]
d3d11: Remove video processor

Processing using ID3D11VideoProcessor was integrated into
GstD3D11Converter and GstD3D11VideoProcessor implementation is
not used anymore.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2713>

2 years agod3d11memory: Update alloc_wrapped() API to avoid staging texture alloc
Seungha Yang [Mon, 4 Jul 2022 12:57:42 +0000 (21:57 +0900)]
d3d11memory: Update alloc_wrapped() API to avoid staging texture alloc

Add size parameter and use it for CPU accessible memory size
instead of allocating staging texture per API call.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2713>

2 years agowasapi: Implement default audio channel mask
Ignazio Pillai [Thu, 30 Jun 2022 09:04:29 +0000 (11:04 +0200)]
wasapi: Implement default audio channel mask

Some multichannel capture devices does not provide a channel mask value
which will result in a pipeline failure due to the empty channel mask.

Implemented the same fix used for wasapi2

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

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2692>

2 years agoexamples/webrtc/signalling: Fix compatibility with Python 3.10
Matthew Waters [Fri, 1 Jul 2022 05:20:31 +0000 (15:20 +1000)]
examples/webrtc/signalling: Fix compatibility with Python 3.10

- ssl module requires an explicit TLS_SERVER role
- asyncio throws a deprecation warning when using
  asyncio.get_event_loop().  Remove custom event loop handling entirely
- No need to keep the websocket server in a member variable, can use
  a future to signal exit case along with the async with context manager
  of websockets.serve()

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2698>

2 years agov4l2videodec: replace multiple decoder bug warnings with single one
fduncanh [Sat, 28 May 2022 19:04:10 +0000 (15:04 -0400)]
v4l2videodec: replace multiple decoder bug warnings with single one

Achieve this by dropping frames after a drain if the driver failed to so.
This works around RaspberryPi driver issue [1].

[1] https://github.com/raspberrypi/linux/issues/5059#issuecomment-

Fixes #1103

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2518>

2 years agod3d11videosink: Add support for rotation
Seungha Yang [Sat, 2 Jul 2022 16:22:10 +0000 (01:22 +0900)]
d3d11videosink: Add support for rotation

Adding "rotate-method" property

Fixes: https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/issues/1396
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2708>

2 years agod3d11videosink: Protect window with lock at every place
Seungha Yang [Sat, 2 Jul 2022 16:18:19 +0000 (01:18 +0900)]
d3d11videosink: Protect window with lock at every place

Access to the object should be thread safe to support runtime
property update

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2708>

2 years agod3d11convert: Add support for GstVideoOrientationMethod
Seungha Yang [Fri, 1 Jul 2022 19:23:41 +0000 (04:23 +0900)]
d3d11convert: Add support for GstVideoOrientationMethod

Add flip/rotation support via GstVideoDirectionInterface

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2708>

2 years agod3d11converter: Add support for GstVideoOrientationMethod
Seungha Yang [Fri, 1 Jul 2022 17:15:00 +0000 (02:15 +0900)]
d3d11converter: Add support for GstVideoOrientationMethod

Shader can handle rotation/flip with other conversions
at once in a single pipeline, and depending on device
capability, videoprocessor may support it too.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2708>

2 years agotests: udpsink: make test work in environments without IPv6
Tim-Philipp Müller [Sat, 25 Jun 2022 18:23:11 +0000 (19:23 +0100)]
tests: udpsink: make test work in environments without IPv6

Part-fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/issues/939

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2659>

2 years agod3d11videosink: Use single GstD3D11Converter object
Seungha Yang [Fri, 1 Jul 2022 14:49:49 +0000 (23:49 +0900)]
d3d11videosink: Use single GstD3D11Converter object

GstD3D11Converter supports videoprocessor and texture upload.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2697>

2 years agod3d11memory: Add private method for texture wrapped memory allocation
Seungha Yang [Fri, 1 Jul 2022 12:35:15 +0000 (21:35 +0900)]
d3d11memory: Add private method for texture wrapped memory allocation

Unlike public method gst_d3d11_allocator_alloc_wrapped(), newly
added method by this commit will not calculate CPU accessible memory
size, since staging texture must be allocated to calculate the size.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2697>

2 years agod3d11: Use library private header in plugin
Seungha Yang [Fri, 1 Jul 2022 12:20:02 +0000 (21:20 +0900)]
d3d11: Use library private header in plugin

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2697>

2 years agod3d11compositor: Use single GstD3D11Converter object
Seungha Yang [Fri, 1 Jul 2022 11:47:37 +0000 (20:47 +0900)]
d3d11compositor: Use single GstD3D11Converter object

... and remove unnessary videoprocessor/upload/copy code

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2697>

2 years agod3d11convert: Add border-color property
Seungha Yang [Thu, 30 Jun 2022 19:12:23 +0000 (04:12 +0900)]
d3d11convert: Add border-color property

Use user specified border-color instead of black color

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2697>

2 years agod3d11convert: Use single GstD3D11Converter object
Seungha Yang [Fri, 1 Jul 2022 11:13:29 +0000 (20:13 +0900)]
d3d11convert: Use single GstD3D11Converter object

... and don't use GstD3D11VideoProcessor. Now GstD3D11Converter will
be able to convert using videoprocessor, and texture upload is also supported by
GstD3D11Converter. All the noisy code can be removed therefore.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2697>

2 years agod3d11converter: Add support conversion using videoprocessor
Seungha Yang [Tue, 21 Jun 2022 17:44:26 +0000 (02:44 +0900)]
d3d11converter: Add support conversion using videoprocessor

* Add videoprocessor feature to d3d11converter, in order to unifiy
  conversion flow.
* Add convert_buffer() method to support automatic shader/videoprocessor
  selection. The method also supports texture upload if input memory
  cannot be used for conversion (e.g., system memory or so)

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2697>

2 years agod3d11overlaycompositor: Objectify overlay render implementation
Seungha Yang [Tue, 21 Jun 2022 14:43:46 +0000 (23:43 +0900)]
d3d11overlaycompositor: Objectify overlay render implementation

Be consistent with other implementations

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2697>

2 years agod3d11: Don't use const pointer to GstDxgiColorSpace
Seungha Yang [Tue, 21 Jun 2022 13:44:55 +0000 (22:44 +0900)]
d3d11: Don't use const pointer to GstDxgiColorSpace

Instead, fill values of passed GstDxgiColorSpace struct

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2697>

2 years agosamiparse: clean up some GString usage
Tim-Philipp Müller [Wed, 29 Jun 2022 23:39:50 +0000 (00:39 +0100)]
samiparse: clean up some GString usage

There's no need to re-assign the return value of
g_string_append_*() functions and such to the variable
holding the GString. These return values are just for
convenience so function calls can be chained. The actual
GString pointer won't change, it's not a GList after all.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2685>

2 years agosamiparse: micro-optimise entity handling
Tim-Philipp Müller [Wed, 29 Jun 2022 23:31:24 +0000 (00:31 +0100)]
samiparse: micro-optimise entity handling

Avoid relocations and hard-code entity string length
in the struct, since we basically get it for free here.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2685>

2 years agosamiparse: fix handling of self-closing tags
Tim-Philipp Müller [Wed, 29 Jun 2022 23:13:19 +0000 (00:13 +0100)]
samiparse: fix handling of self-closing tags

We would check the wrong string (rest of line rather than element)
for the / suffix of self-closing tags, which is not only wrong but
also has atrocious performance with certain strings like the garbled
nonsense clusterfuzz feeds us, which might cause discoverer to time
out when processing garbled SAMI files.

Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=47461

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2685>

2 years agoRevert "glupload: Fix caps query with no filter"
Jan Schmidt [Fri, 1 Jul 2022 13:57:08 +0000 (23:57 +1000)]
Revert "glupload: Fix caps query with no filter"

This reverts commit 6f9ae5d7580763b5d18badb76f2166ff0012886a.

The _transform_caps() function can't tell the difference
between the caller wanting to know the output caps
for the current method, or all possible output caps. If
it includes caps for all possible methods, glupload can
end up negotiating and sending the wrong output caps
downstream.

Partially reverts !2687
Fixes #1310

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2699>

2 years agodecklinkvideosink: Pass video frames directly to the Decklink SDK without copying
Sebastian Dröge [Tue, 28 Jun 2022 13:40:55 +0000 (16:40 +0300)]
decklinkvideosink: Pass video frames directly to the Decklink SDK without copying

If the video frame is stored in PBO memory then we need to copy anyway as
it might be stored in CPU-accessible GPU memory that can't be accessed
from the Decklink driver.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2674>

2 years agomsdkmjpegdec: Add support for error report
Vincent Cheah Beng Keat [Tue, 10 May 2022 06:11:06 +0000 (14:11 +0800)]
msdkmjpegdec: Add support for error report

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2401>

2 years agoglvideomixer: Only consider property changes a geometry change if there as an actual...
Sebastian Dröge [Tue, 28 Jun 2022 06:38:34 +0000 (09:38 +0300)]
glvideomixer: Only consider property changes a geometry change if there as an actual change

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2669>

2 years agoglvideomixer: Add crop-{left,right,top,bottom} pad properties for cropping inputs
Sebastian Dröge [Mon, 27 Jun 2022 18:28:07 +0000 (21:28 +0300)]
glvideomixer: Add crop-{left,right,top,bottom} pad properties for cropping inputs

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2669>

2 years agonvencoder: Add support for dynamic GPU device selection
Seungha Yang [Wed, 22 Jun 2022 16:10:38 +0000 (01:10 +0900)]
nvencoder: Add support for dynamic GPU device selection

Adding nvautogpu{h264,h265}enc class which will accept upstream logical
GPU device object (GstCudaContext or GstD3D11Device) instead of
using pre-assigned GPU instance.

If upstream logical GPU device object is not NVENC compatible
(e.g., D3D11 device of non-NVIDIA GPU) or it's system memory,
then user specified "cuda-device-id" or "adapter-luid" property
will be used for GPU device selection.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2666>

2 years agocuda: Protect gst_cuda_ensure_element_context() with lock
Seungha Yang [Mon, 27 Jun 2022 11:50:15 +0000 (20:50 +0900)]
cuda: Protect gst_cuda_ensure_element_context() with lock

Serialize the order of context setup since it can be called
from multiple threads

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2666>

2 years agocuda: Add YUY2 and UYVY formats for GL interop
Seungha Yang [Thu, 30 Jun 2022 07:45:46 +0000 (16:45 +0900)]
cuda: Add YUY2 and UYVY formats for GL interop

Those formats are not supported conversion formats by CUDA convert/scale elements
but would be useful for GL <-> CUDA interop use case.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2691>

2 years agocudadownload: Passthrough in case of CUDA -> SYSTEM
Seungha Yang [Thu, 30 Jun 2022 08:47:05 +0000 (17:47 +0900)]
cudadownload: Passthrough in case of CUDA -> SYSTEM

GstCudaMemory supports CPU access via CUDA pinned host memory already
and it would show faster memory transfer performance between
GPU and CPU than copying from/to normal system memory.
If downstream supports video meta, we can passthrough CUDA memory.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2690>

2 years agowebrtcbin: Reject caps that are not valid for creating an SDP media.
Sebastian Dröge [Thu, 30 Jun 2022 06:09:02 +0000 (09:09 +0300)]
webrtcbin: Reject caps that are not valid for creating an SDP media.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2689>

2 years agosdpmessage: Don't set SDP medias from caps without media/payload/clock-rate fields
Sebastian Dröge [Thu, 30 Jun 2022 06:02:00 +0000 (09:02 +0300)]
sdpmessage: Don't set SDP medias from caps without media/payload/clock-rate fields

Previously it would've silently failed reading the payload/clock-rate
and instead would've used some random value that happened to be on the
stack.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2689>

2 years agoglupload: Fix caps query with no filter
Jan Schmidt [Thu, 30 Jun 2022 02:50:17 +0000 (12:50 +1000)]
glupload: Fix caps query with no filter

If no filter caps are provided with a caps query, always
generate a full set of all caps from all upload methods,
not just the configured one. This is needed to handle
renegotiation when dealing with raw sysmem caps - as the upload
method might accept raw sysmem caps, but only the raw data
uploader adds those to the caps query.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2687>

2 years agoRevert "glupload: allow system memory for dmabuf in transform_caps"
Jan Schmidt [Thu, 30 Jun 2022 02:46:31 +0000 (12:46 +1000)]
Revert "glupload: allow system memory for dmabuf in transform_caps"

This reverts commit f3292dc1561a8d62812c3f1a2bb3de5c5bb6a807.

Only the raw data uploader should add sysmem caps to the
actual caps query, because we want them to be at the
lowest priority. If upstream does select to send raw
caps, then the correct upload method will still
be chosen because the accept_caps implementation
will accept them

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2687>

2 years agogl: Don't use the full transform_caps() method for reconfiguration check
Jan Schmidt [Thu, 30 Jun 2022 08:41:01 +0000 (18:41 +1000)]
gl: Don't use the full transform_caps() method for reconfiguration check

When checking if we need to reconfigure when uploading, check
specifically the output caps of the current method will
result in compatible/incompatible caps, not the full set
of output caps from all upload methods.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2687>

2 years agocudaformat: add support for planar 4:2:2 YUV formats in CUDA D3D11 interop
Corentin Damman [Fri, 22 Apr 2022 14:37:34 +0000 (16:37 +0200)]
cudaformat: add support for planar 4:2:2 YUV formats in CUDA D3D11 interop

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2269>

2 years agocudamemory: add support for planar 4:2:2 YUV formats
Corentin Damman [Fri, 22 Apr 2022 13:58:13 +0000 (15:58 +0200)]
cudamemory: add support for planar 4:2:2 YUV formats

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2269>

2 years agovideo: Include new video-sei.h in video.h
Sebastian Dröge [Thu, 30 Jun 2022 05:42:43 +0000 (08:42 +0300)]
video: Include new video-sei.h in video.h

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2688>

2 years agotracing: add hooks for gst_pad_chain() / gst_pad_chain_list()
Sebastian Dröge [Wed, 29 Jun 2022 05:57:42 +0000 (08:57 +0300)]
tracing: add hooks for gst_pad_chain() / gst_pad_chain_list()

This allows tracing buffers when they arrive in a pad instead of just
when they are pushed out of a pad.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2682>

2 years agov4l2videodec: replace multiple decoder bug warnings by a single warning
fduncanh [Sat, 28 May 2022 20:47:42 +0000 (16:47 -0400)]
v4l2videodec: replace multiple decoder bug warnings by a single warning
(warning due to incorrectly dropped frames at initial caps adjustment)

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2517>

2 years agov4l2codecs: enumerate all possible formats
Benjamin Gaignard [Tue, 22 Jun 2021 12:43:29 +0000 (14:43 +0200)]
v4l2codecs: enumerate all possible formats

Some decoder may also allow to (down) scale the decoded video.
Use VIDIOC_ENUM_FRAMESIZES iotcl to enumerate the possible output
formats resolutions.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2589>

2 years agonvcodec: Add cuda-device-id read-only property to stateless decoders
Seungha Yang [Sun, 26 Jun 2022 13:26:29 +0000 (22:26 +0900)]
nvcodec: Add cuda-device-id read-only property to stateless decoders

... and remove unnecessary intermediate subclass from class hierarchy

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2665>

2 years agonvcodec: Add cuda-device-id read-only property to CUVID decoders
Seungha Yang [Sun, 26 Jun 2022 12:09:50 +0000 (21:09 +0900)]
nvcodec: Add cuda-device-id read-only property to CUVID decoders

Similar to the other hardware decoder plugins, provides assigned
device id via property

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2665>

2 years agoadaptivedemux2: Ignore stopped stream flow state
Jan Schmidt [Tue, 28 Jun 2022 14:51:28 +0000 (00:51 +1000)]
adaptivedemux2: Ignore stopped stream flow state

When calculating the combined stream flow state
for a period, don't consider stopped streams.

Fixes switching to the next period in DASH streams
with multiple video/audio/subtitle streams.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2684>

2 years agoadaptivedemux2: Clean up stream parsebins on finalize
Jan Schmidt [Tue, 28 Jun 2022 15:25:41 +0000 (01:25 +1000)]
adaptivedemux2: Clean up stream parsebins on finalize

Remove the parsebin for a stream from the overall
bin when cleaning up the stream, to avoid
keeping around old ones when moving between periods

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2676>

2 years agoadaptivedemux2: Fix memory leaks and use-after-free
Jan Schmidt [Thu, 23 Jun 2022 16:54:22 +0000 (02:54 +1000)]
adaptivedemux2: Fix memory leaks and use-after-free

Fix various small memory leaks, and an invalid
access to GstEvent after giving away the ref
via gst_pad_push_event()

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2676>

2 years agohlsdemux2: Fix potential segfault
Jan Schmidt [Thu, 23 Jun 2022 16:57:54 +0000 (02:57 +1000)]
hlsdemux2: Fix potential segfault

Fix a potential segfault if we receive a ISO-FF stream
with moof before moov.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2676>

2 years agohlsdemux2: Fix memory leaks
Jan Schmidt [Thu, 23 Jun 2022 16:57:03 +0000 (02:57 +1000)]
hlsdemux2: Fix memory leaks

Clean up various memory leaks

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2676>

2 years agohlsdemux2: Free current_segment on finalize
Jan Schmidt [Thu, 23 Jun 2022 09:24:03 +0000 (19:24 +1000)]
hlsdemux2: Free current_segment on finalize

Avoid a memory leak by making sure to release the
current segment on exit if non-NULL

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2676>

2 years agocoding style: allow declarations after statement
Tim-Philipp Müller [Wed, 29 Jun 2022 09:55:13 +0000 (10:55 +0100)]
coding style: allow declarations after statement

See https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1243/
and https://gitlab.freedesktop.org/gstreamer/gstreamer-project/-/issues/78

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2683>

2 years agod3d11convert: Add support for GstVideoCropMeta
Seungha Yang [Tue, 28 Jun 2022 15:31:01 +0000 (00:31 +0900)]
d3d11convert: Add support for GstVideoCropMeta

Performs crop, scale, and color space conversion all in
a single render pipeline. Note that cropping related property is not
added in this element (which will make negotiation very complicated),
but user can configure videocrop element for crop meta to be attached
on each buffer.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2678>

2 years agod3d11videosink: Fix for force-aspect-ratio setting when rendering on shared texture
Seungha Yang [Tue, 28 Jun 2022 08:40:56 +0000 (17:40 +0900)]
d3d11videosink: Fix for force-aspect-ratio setting when rendering on shared texture

Set specified force-aspect-ratio value on window object
in case of shared texture rendering as well

Fixes: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/1304
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2671>

2 years agomfvideoenc: Fix broken encoding when resolution is not an even number
Seungha Yang [Sat, 25 Jun 2022 21:39:54 +0000 (06:39 +0900)]
mfvideoenc: Fix broken encoding when resolution is not an even number

Width and height values of 4:2:0 subsampled YUV format should be even number,
and if it's not the case, there should be padding which is not a contiguous memory layout.
Do copy input frames to MediaFoundation's memory in that case for now.

Fixes: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/1165
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2661>

2 years agovideorate: remove property-value quotes
James Hilliard [Thu, 16 Jun 2022 10:19:17 +0000 (10:19 +0000)]
videorate: remove property-value quotes

Fixes warnings like:
Received a structure string that contains '="0.5"'. Reading as a gdouble value, rather than a string value. This is undesired behaviour, and with GStreamer 1.22  onward, this will be interpreted as a string value instead because it is wrapped in '"' quotes. If you want to guarantee this value is read as a string, before this change, use '=(string)"0.5"' instead. If you want to read in a gdouble value, leave its value unquoted.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2621>

2 years agoadaptivedemux2: track: Fix buffering time calc before output
Jan Schmidt [Tue, 21 Jun 2022 17:35:03 +0000 (03:35 +1000)]
adaptivedemux2: track: Fix buffering time calc before output

Use the lowest track input time as the output
time when calculating track buffering levels
before anything has been dequeued.

Fixes multi-period DASH not advancing to the
next period in some cases.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2650>

2 years agoadaptivedemux2: track: Add period number to most debug statements
Jan Schmidt [Tue, 21 Jun 2022 17:34:19 +0000 (03:34 +1000)]
adaptivedemux2: track: Add period number to most debug statements

Store the period number the track belongs to, and
add it in various debug statements

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2650>

2 years agoadaptivedemux2: stream: Don't take TRACKS_LOCK when sending EOS event
Jan Schmidt [Tue, 21 Jun 2022 17:30:16 +0000 (03:30 +1000)]
adaptivedemux2: stream: Don't take TRACKS_LOCK when sending EOS event

The stream tracks list can't change while we're
iterating it from the scheduling thread,
and the event handler immediately takes the
tracks lock, causing a deadlock.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2650>

2 years agohlsdemux2: Improve media playlist updates
Edward Hervey [Wed, 8 Jun 2022 09:17:09 +0000 (11:17 +0200)]
hlsdemux2: Improve media playlist updates

* When dealing with rendition streams, we attempt to synchronize the media
  playlist against the variant stream. This helps with speeding up the correct
  initial fragment search and avoids issues when streams at activated at a much
  later time.
* Also add checks for variant stream existence before attempting to use them

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2679>

2 years agohlsdemux2: Only seek on selected streams
Edward Hervey [Wed, 8 Jun 2022 09:16:15 +0000 (11:16 +0200)]
hlsdemux2: Only seek on selected streams

When handling seeks, there is no need to seek on unselected streams. If they
later get activated they will be properly seek onto

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2679>

2 years agotests: check: Update hlsdemux2 tests for playlist changes
Edward Hervey [Wed, 8 Jun 2022 07:33:22 +0000 (09:33 +0200)]
tests: check: Update hlsdemux2 tests for playlist changes

We no longer do auto-magic fallbacks when synchronizing a disconnected
playlist. It is handled at a higher level.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2679>

2 years agohlsdemux2: Fix debug return statement
Edward Hervey [Fri, 3 Jun 2022 08:25:34 +0000 (10:25 +0200)]
hlsdemux2: Fix debug return statement

Due to latest commits res could have been NULL.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2679>

2 years agohlsdemux2: No longer re-add segments from before the playlist
Edward Hervey [Thu, 2 Jun 2022 07:46:22 +0000 (09:46 +0200)]
hlsdemux2: No longer re-add segments from before the playlist

When updating playlists, there is a possibility that the playlists don't
perfectly align, but the last entry of the previous playlist is *just* before
the first entry of the new playlist.

In those cases, we still can transfer the timing information from one playlist
to another, but we do not want to return that segment as being the matching one.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2679>