Commit graph

153 commits

Author SHA1 Message Date
Seungha Yang
0deb73d9ba d3d11memory: Clear YUV texture with black color
We prefer black color as an initial texture color and
Direct3D11 runtime will initialize texture with zeros (except for alpha)
which is fine for RGB formats. But UV components of YUV texture
requires manual clear for black color.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2502>
2022-05-27 14:03:49 +00:00
Seungha Yang
e5ba099fd8 d3d11device: Enhance format enumeration and debugging
* Enhance debug log to print human readable D3D11_FORMAT_SUPPORT flags
  value, instead of packed numeric flagset value.
* Only device supported format will be added to format table.
  Depending on device feature level (i.e., D3D9 feature devices),
  16bits formats will not be supported. Although there might be formats
  we deinfed but not supported, it will not be a major issue in practice
  since our D3D11 implementation does not support legacy devices already
  (known limitation) and also old d3dvideosink will be promoted in that case.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2441>
2022-05-21 02:37:45 +09:00
Seungha Yang
ca7081c482 d3d11device: Don't print ERROR log on open failure
Device open can be failed in various reasons, but it's unlikely
our problem

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2433>
2022-05-17 14:11:00 +00:00
Seungha Yang
8d40531f23 h265decoder: Improve robustness against malformed NAL packets
Use newly added gst_h265_parser_identify_and_split_nalu_hevc()
method to handle broken streams where packetized NAL unit
contain start code prefix in it.

It's obviously wrong stream but we know how to work around it
and even need to support such broken streams since
stateless decoder implementations are being a primary
decoder element.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2394>
2022-05-10 03:59:47 +09:00
Seungha Yang
be84fc23ca h265parser: Add a new NAL parsing API to handle malformed packets
Add gst_h265_parser_identify_and_split_nalu_hevc() method to
handle a case where packetized stream contains start-code prefix.
This new method behaves similar to exisiting gst_h265_parser_identify_nalu_hevc()
but it will scan start-code prefix to split given data into
NAL units.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2394>
2022-05-10 03:58:51 +09:00
Víctor Manuel Jáquez Leal
13fbcde1e7 libs: va: Add O_CLOEXEC flag at opening drm device.
So any other potential subprocess won't have access to it.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2386>
2022-05-07 09:55:36 +00:00
Seungha Yang
47ff41bcd2 d3d11memory: Protect against concurrent access from GPU and CPU to staging texture
Staging texture does not allow GPU access while it's CPU mapped.
But because we cannot block concurrent READ access by GstMemory design,
additional staging texture is still required.

Fixes: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/1182
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2375>
2022-05-05 18:59:05 +00:00
Seungha Yang
8ec4452d67 h264decoder: Fix for unhandled low-delay decoding case
Baseclass calls get_preferred_output_delay() in a chain of
sequence header parsing and then new_sequence() is called
with required DPB size (includes render-delay) information.
Thus latency query should happen before the sequence header
parsing for subclass to report required render-delay accordingly
via get_preferred_output_delay() method.
(e.g., zero delay in case of live pipeline)

This commit is to fix wrong liveness signalling in case of
upstream packetized format.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2363>
2022-05-05 14:54:54 +00:00
Seungha Yang
ad136cb2c5 h265decoder: Fix for unhandled low-delay decoding case
Baseclass calls get_preferred_output_delay() in a chain of
sequence header parsing and then new_sequence() is called
with required DPB size (includes render-delay) information.
Thus latency query should happen before the sequence header
parsing for subclass to report required render-delay accordingly
via get_preferred_output_delay() method.
(e.g., zero delay in case of live pipeline)

This commit is to fix wrong liveness signalling in case of
upstream packetized format.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2364>
2022-05-05 14:10:39 +00:00
Seungha Yang
07cd1dcc6b av1decoder: Add support for render delay
Sync up with other decoder baseclass implementations

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1453>
2022-05-04 01:23:25 +09:00
Seungha Yang
1b4121fded av1decoder: Hold OBU temporal and spatial id in picture struct
NVDEC API requires the information

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1453>
2022-05-04 01:23:11 +09:00
Seungha Yang
6a4c42c03f codecs: Signal required DPB size for AV1,MPEG2,VP8, and VP9 via new_sequence()
Make all codecs consistent so that subclass can know additional DPB
size requirement depending on render-delay configuration regardless
of codec. Note that render-delay feature is not implemented for AV1
yet but it's planned.

Also, consider new_sequence() is mandatory requirement, not optional

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2343>
2022-05-03 14:17:49 +00:00
Thibault Saunier
dd585ecfcc cuda: Fix introspection warnings
Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/1183

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2344>
2022-05-02 18:30:22 +00:00
Seungha Yang
1fb3804408 Revert "cuda: Fix GstCudaContext refcount bug"
This reverts commit df7ee0e215.

We should not unref it since gst_message_new_have_context()
takes ownership of the GstContext.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2342>
2022-05-02 17:19:13 +00:00
Myles Inglis
df7ee0e215 cuda: Fix GstCudaContext refcount bug
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2334>
2022-04-29 22:22:25 +00:00
Seungha Yang
9cd6f9d51e cuda: Correct CUDA device id field in GstContext structure
device id is unsigned int, not signed.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2311>
2022-04-29 21:21:04 +00:00
Víctor Manuel Jáquez Leal
245e5e3dfd codecs: h265decoder: Fix documentation.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2328>
2022-04-28 11:58:20 +00:00
He Junyan
9ec4041a51 codecparsers: bitwriter: Calculate PicSizeInCtbsY when writing slice header.
The slice->pps->PicWidthInCtbsY/PicHeightInCtbsY values are calculated when
 we parse the slice header. But they are not calculated in bitwriter and so
 may not have valid value when writing slice header.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2287>
2022-04-26 16:04:15 +00:00
He Junyan
abf19020a4 codecparsers: bitwriter: Fix some coverity issues of H265 bitwriter.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2287>
2022-04-26 16:04:15 +00:00
He Junyan
163cbd5892 va: pool: Replace all tabs with spaces in header file.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2282>
2022-04-26 20:26:06 +08:00
He Junyan
fac57fcb8d va: pool: Delete the GST_BUFFER_POOL_OPTION_VIDEO_ALIGNMENT.
The va pool is used for GPU side surface/image, its alignment should
not be changed arbitrarily by others. So we decide not to expose the
GST_BUFFER_POOL_OPTION_VIDEO_ALIGNMENT flag anymore.
Instead, user can call gst_buffer_pool_config_set_va_alignment() to
set its surface/image alignment.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2282>
2022-04-26 20:26:02 +08:00
He Junyan
fd81cb2ad4 va: pool: Add set_va_alignment() API.
We want to use gst_buffer_pool_config_set_va_alignment() to replace
gst_buffer_pool_config_get_video_alignment(). The later one is specific
for GST_BUFFER_POOL_OPTION_VIDEO_ALIGNMENT option.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2282>
2022-04-26 20:25:57 +08:00
Seungha Yang
205a23f456 nvcodec: Stop building for non-{Windows,Linux} target
The other platforms, specifically macOS have not been supported already
because this plugin loads so or dll. Moreover, NVIDIA dropped
support for macOS as of CUDA 11.0. See also
https://developer.nvidia.com/nvidia-cuda-toolkit-11_0_0-developer-tools-mac-hosts

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2283>
2022-04-25 15:50:52 +00:00
Xavier Claessens
1a0eea3299 Meson: Fix deprecation warnings
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1876>
2022-04-23 00:33:00 +00:00
He Junyan
d9d03e1dba codecparsers: bitwriter: Add the common bit writer functions for H265.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1831>
2022-04-22 07:35:17 +00:00
Víctor Manuel Jáquez Leal
e207ff905b va: Expose a couple va surface/buffer methods.
And use them in va plugin.

Also, set as default logging category the vadisplay one.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2077>
2022-04-20 15:15:56 +00:00
Xavier Claessens
82ca0e291b Delete unused i18n headers
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2028>
2022-04-19 18:01:06 +00:00
Xavier Claessens
b99ecc78ca Replace gst-i18n-*.h with gi18n-lib.h
GLib guarantees libintl is always present, using proxy-libintl as
last resort. There is no need to mock gettex API any more.

This fix static build on Windows because G_INTL_STATIC_COMPILATION must
be defined before including libintl.h, and glib does it for us as part
as including glib.h.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2028>
2022-04-19 18:01:06 +00:00
Thibault Saunier
dcd2ccad59 cuda: Fix typo in gst_cuda_buffery_copy_type_to_string
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1472>
2022-04-19 16:39:43 +00:00
Thibault Saunier
86dcfc29dc cuda: Add a gst_cuda_context_new_wrapped constructor
So that application or people implementing cuda element from
outside GStreamer itself can ensure that their contexts are used
by GStreamer.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1472>
2022-04-19 16:39:43 +00:00
Thibault Saunier
c033f8fad2 cuda: Factor out a public GstCUDA library
So applications and elements implemented outside GStreamer can reuse
our infrastructure

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1472>
2022-04-19 16:39:43 +00:00
Seungha Yang
9d51cae7ee h264decoder,h265decoder: Do not hold codec_data buffer
... also do not need to extract it from caps.

Decoder uses codec_data only once per set_format() and
baseclass will extract codec_data buffer already.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2212>
2022-04-18 19:55:15 +00:00
He Junyan
7f6cd7ac3c codecs: av1parser: Fix a typo in seq_level_idx check.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2157>
2022-04-13 02:36:09 +00:00
Seungha Yang
d4f9676c9c h265parser: Fix short_term_ref_pic_set() size calculation
This field is used by DXVA/NVDEC/VA, and each specification
describes (NVDEC is not well documented) that it's the number of
bits used in short_term_ref_pic_set().

DXVA doesn't explicitly mention that whether the size of
emulation preventation bytes (EPB) is inclusive or not, but
VA is clearly specifying that it's the size after removing
EPB. Excluding EPB size here makes more sense therefore.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1930>
2022-04-07 18:46:12 +00:00
Sangchul Lee
8537433f24 webrtc/datachannel: Change initial data channel state to CONNECTING
It complies with http://w3c.github.io/webrtc-pc/#dom-rtcdatachannelstate.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2099>
2022-04-04 23:46:25 +00:00
Tim-Philipp Müller
296094508e libs: va: make sure va-enumtypes.h is generated before it's used
Need to add a dep for the generated header file to the dependency()
so that it gets generated before anyone tries to #include files
from it (which may happen before the actual lib is built because
that's only needed when stuff is linked together later).

See https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2057#note_1323236
and CI build failures in https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2096

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2103>
2022-04-02 18:58:52 +00:00
Nicolas Dufresne
8d9e649570 va: Fix printf format modifier for drm modifiers
DRM modifiers are 64bit, the printf modifier is platform dependant. Use
the G_GINT64_MODIFIER macro to make this printf portable.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2102>
2022-04-01 20:09:36 +00:00
Xavier Claessens
b004464ac6 Remove glib and gobject dependencies everywhere
They are part of gst_dep already and we have to make sure to always have
gst_dep. The order in dependencies matters, because it is also the order
in which Meson will set -I args. We want gstreamer's config.h to take
precedence over glib's private config.h when it's a subproject.

While at it, remove useless fallback args for gmodule/gio dependencies,
only gstreamer core needs it.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2031>
2022-04-01 16:32:17 +00:00
Víctor Manuel Jáquez Leal
6d2f57b6c7 libs: va: add VA allocator parameter for derived images usage.
Added GstVaFeature enum type, and new parameter for VA allocator's
set_format() and get_format(). Also added a new parameter in VA pool
gst_va_pool_new_with_config() and
gst_buffer_pool_config_set_va_allocation_params().

This new parameter will define if derived images will by used for
buffer mapping.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2057>
2022-03-31 14:14:45 +00:00
Seungha Yang
6451a13b0b vadisplay: Add description readonly property
Expose description of vendor for user information, similar to
the description property of d3d11device.
Also, set description and DRM device path on GstContext structure
so that user can read them and it will be printed on terminal
when gst-launch-1.0 is used

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2064>
2022-03-30 21:41:27 +00:00
Víctor Manuel Jáquez Leal
602d249847 va: Don't expose internal classes.
VA allocators and pools classes don't need to be exposed as external
symbols.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2070>
2022-03-30 11:36:03 +02:00
Haihua Hu
630acb40f0 gstplay: don't print error log in warning_cb
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2069>
2022-03-30 08:12:05 +00:00
Matthew Waters
5741ee38e0 webrtc/datachannel: fix use-after-free in sctp state notification
g_signal_disconnect*() doesn't stop any existing callbacks from running
which means that if the notify::state callback is in progress in one
thread and the data channel object is finalize()ed in another thread,
then there could be a use-after-free trying lock the data channel
object.

We can't reasonably use a GWeakRef as we don't have a 'parent' object to
free the GWeakRef after the data channel is finalized.  This is also
complicated by the fact that the application can hold a reference to the
data channel object that would live beyond the lifetime of webrtcbin
itself.

We solve this by implementing a ghetto weak-ref solution internally with
a list of outstanding data channels.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1664>
2022-03-29 23:55:40 +00:00
Matthew Waters
e28c45fd05 webrtc: explicitly error out in a couple of renegotiation cases
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1664>
2022-03-29 23:55:40 +00:00
Víctor Manuel Jáquez Leal
400faf7361 va: Set <gst/va/gstva.h> as library single point entry header.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2048>
2022-03-29 19:48:30 +00:00
He Junyan
990fbb3b52 va: Move allocators and pool objects into gstva library.
In order to other plugins use gstva objects, such as allocators and buffer
pools, this merge request move them from the va plugin to the gstva library.

This objects are not exposed in <gst/va/gstva.h> since they are not expected
to be used by users, only by plugin implementators.

Because of the surface copy design, which is used to implement allocator's
mem_copy() virtual function, depends on the vafilter, which is kept inside
the plugin, memory copy through VAPosproc is disabled and removed temporarly.

Also added some missing parameter validation.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2048>
2022-03-29 19:48:30 +00:00
He Junyan
53783eab6c va: Move the video format functions into gstlibva.
Untabifying header file.

The logging category was moved from the plugin generic category to
the display category. It can argue that video formats hacks are
display dependant.

Added validations for input parameters.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2048>
2022-03-29 19:48:30 +00:00
Matthew Waters
6c49f8d308 mpeg: fix unused-but-set warning
../gst-libs/gst/mpegts/gst-dvb-section.c:206:9: error: variable 'i' set but not used [-Werror,-Wunused-but-set-variable]
  guint i = 0, allocated_events = 12;
        ^
../gst-libs/gst/mpegts/gst-dvb-section.c:365:9: error: variable 'i' set but not used [-Werror,-Wunused-but-set-variable]
  guint i = 0, allocated_streams = 12;
        ^
../gst-libs/gst/mpegts/gst-dvb-section.c:543:9: error: variable 'i' set but not used [-Werror,-Wunused-but-set-variable]
  guint i = 0, allocated_streams = 12;
        ^
../gst-libs/gst/mpegts/gst-dvb-section.c:885:9: error: variable 'i' set but not used [-Werror,-Wunused-but-set-variable]
  guint i = 0, allocated_services = 8;
        ^
../gst-libs/gst/mpegts/gst-dvb-section.c:1316:9: error: variable 'i' set but not used [-Werror,-Wunused-but-set-variable]
  guint i = 0, allocated_services = 8;
        ^

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2046>
2022-03-28 10:30:23 +00:00
Nicolas Dufresne
104ae1b2e6 codecs: h264: Save the field_pic_flag
This flag is set when the stream is interlaced and the specific
slice is made of single parity fields rather the paired at the
macroblock layer. This is rarely needed in late decoding process
but the Rockchip RKVDEC HW interface requires it, hence needs to
be passed through V4L2 Stateless interface.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2009>
2022-03-25 21:40:28 +00:00
Daniel Almeida
9a364464f0 av1decoder: Sync duplicate_picture with VP9 one
Pass the current frame to the duplicate_picture callback. This makes it easier
to set the frame's output_buffer if we already have one available. Also
documented that unlike VP9, it is not optional to implement this as the
picture will populate the DPB if it is a key-frame. To ensure this, remove the
default implementation.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1992>
2022-03-21 15:10:01 +00:00