Commit graph

114636 commits

Author SHA1 Message Date
Seungha Yang 30c8dbe032 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>
2022-06-30 12:38:08 +00:00
Seungha Yang bcacfc7ced 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>
2022-06-30 12:38:08 +00:00
Seungha Yang ce82c0570e 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>
2022-06-30 11:17:15 +00:00
Seungha Yang d9f08e17f1 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>
2022-06-30 10:45:45 +00:00
Sebastian Dröge a54eddad3a webrtcbin: Reject caps that are not valid for creating an SDP media.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2689>
2022-06-30 09:28:27 +00:00
Sebastian Dröge 3f71a467fc 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>
2022-06-30 09:28:27 +00:00
Jan Schmidt 6f9ae5d758 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>
2022-06-30 08:52:04 +00:00
Jan Schmidt de0e4b8fd6 Revert "glupload: allow system memory for dmabuf in transform_caps"
This reverts commit f3292dc156.

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>
2022-06-30 08:52:04 +00:00
Jan Schmidt 342f02015b 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>
2022-06-30 08:52:04 +00:00
Corentin Damman ae781610c8 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>
2022-06-30 07:30:09 +00:00
Corentin Damman 8678fc999a cudamemory: add support for planar 4:2:2 YUV formats
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2269>
2022-06-30 07:30:09 +00:00
Sebastian Dröge 7064404b1e video: Include new video-sei.h in video.h
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2688>
2022-06-30 08:42:43 +03:00
Sebastian Dröge de30de865c 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>
2022-06-29 21:05:14 +00:00
fduncanh dfeb8198e4 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>
2022-06-29 19:50:15 +00:00
Benjamin Gaignard d3a01eccae 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>
2022-06-29 19:18:16 +00:00
Seungha Yang 85fe9fb61d 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>
2022-06-30 01:54:17 +09:00
Seungha Yang 1e11c05591 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>
2022-06-30 01:45:20 +09:00
Jan Schmidt 0af4a53bc2 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>
2022-06-29 16:35:26 +01:00
Jan Schmidt a369448b0c 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>
2022-06-29 14:33:30 +00:00
Jan Schmidt 63d3ba4dfb 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>
2022-06-29 14:33:30 +00:00
Jan Schmidt 4b7622b377 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>
2022-06-29 14:33:30 +00:00
Jan Schmidt b2944c36ca hlsdemux2: Fix memory leaks
Clean up various memory leaks

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2676>
2022-06-29 14:33:30 +00:00
Jan Schmidt 76e0333213 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>
2022-06-29 14:33:30 +00:00
Tim-Philipp Müller 9272943bc7 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>
2022-06-29 13:40:25 +00:00
Seungha Yang 38e142db9a 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>
2022-06-29 09:43:10 +00:00
Seungha Yang 1043481247 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>
2022-06-29 09:04:33 +00:00
Seungha Yang 236378c9d5 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>
2022-06-29 08:26:45 +00:00
James Hilliard 4902076968 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>
2022-06-29 00:36:17 +00:00
Jan Schmidt 61e4f058ef 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>
2022-06-28 18:34:31 +00:00
Jan Schmidt 16a04f7697 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>
2022-06-28 18:34:31 +00:00
Jan Schmidt e1559d26d0 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>
2022-06-28 18:34:31 +00:00
Edward Hervey e9f8c7d33a 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>
2022-06-28 17:59:24 +00:00
Edward Hervey 0a658840da 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>
2022-06-28 17:59:24 +00:00
Edward Hervey 787dbfd4e4 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>
2022-06-28 17:59:24 +00:00
Edward Hervey 34a7710762 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>
2022-06-28 17:59:24 +00:00
Edward Hervey 82bd65e711 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>
2022-06-28 17:59:23 +00:00
Edward Hervey b9effe04e3 hlsdemux2: Use variant stream as support for synchronizing playlists
When matching playlists, there is a possibility that rendition streams will not
have been updated in time (for example because that stream started later, or
playback was paused). This would cause several playback failures and seeking
failures.

In order to still fall back on our feet, attempt to synchronize that rendition
playlist against the current variant playlist. This will attempt to match the
stream time using SN/DNS/PDT/...

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2679>
2022-06-28 17:59:23 +00:00
Edward Hervey 87ab729551 hlsdemux2: Detect synchronization loss
If we have been updating too slowly and have gone out of the current live
window, inform the baseclass accordingly.

This is different from the case where we have been updating quicker than what
the server provides.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2679>
2022-06-28 17:59:23 +00:00
Edward Hervey 9cdadf6d08 hlsdemux2: More improvement/fixes to position tracking
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2679>
2022-06-28 17:59:23 +00:00
Edward Hervey d88d7d5b55 adaptivedemux2: Handle loss of synchronization
Add a new custom GstFlowReturn so that subclasses can notify that they have lost
live synchronization.

When that happens, do a flushing seek back to the live position

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2679>
2022-06-28 17:59:23 +00:00
Edward Hervey 37b17ba0eb adaptivedemux2: Fix SNAP seek handling
* Since only flushing seeks are allowed, the "current" position is always the
  global output position (and not "some" stream current position).

* In terms of figuring out to which stream to "snap" to, we can send it to any
  selected stream. Removes the requirement of this function to a specific output
  pad.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2679>
2022-06-28 17:59:23 +00:00
Edward Hervey 5271603852 hlsdemux2: Fix position tracking
Remove the "pending advance" hack and instead rely on the base stream current
position to track our position (instead of a potentially NULL "current
segment").

Also ensure the media playlists are always refreshed with valid stream time,
even if there is no current segment.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2679>
2022-06-28 17:59:23 +00:00
Edward Hervey 8fd2dcd266 hlsdemux2: Add a new method to synchronize two media playlist
This allows transfering the stream time of the playlist to an updated
variant/rendition.

This allows updating that information without having a "current segment"

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2679>
2022-06-28 17:59:23 +00:00
Edward Hervey 4eac7f0e06 adaptivedemux2: Initialize and use stream start/current position
The stream start and current position would be properly set when seeking or
activating a stream after playback started. But it would never be properly
initialized.

Set it to NONE initially to indicate to subclasses that no position has been
tracked yet. This will allow them to detect initial stream usage.

Futhermore, once the initial streams setup is done, make sure that it is set to
a valid initial value:
* The minimum stream time in live
* Or else the period start

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2679>
2022-06-28 17:59:23 +00:00
Nicolas Dufresne 7c40fcb66e v4l2videodec: Fix activation of internal pool
If the driver does not support VIDIOC_CREATE_BUFS ioctl, the pool
configuration may get changed, which requires a validation. This would
fail to activate a pool in a case it shouldn't normally fail unless we
are out of memory.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2456>
2022-06-28 16:19:53 +00:00
Tim-Philipp Müller afc94046ba dv, opusparse: fix duplicate symbols in static build
Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/issues/1262

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2670>
2022-06-28 01:29:06 +01:00
Seungha Yang b09ae1d635 d3d11: Enumerate devices via native DXGI API
D3D11CreateDevice() can fail for some reason (e.g., buggy GPU driver)
and then gst_d3d11_device_new() will return nullptr.
Use DXGI API directly instead of relying on the gst_d3d11_device_new()

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2663>
2022-06-27 20:30:13 +00:00
Seungha Yang 260114fa1b examples: Add an example for application texture sharing
This example shows GstD3D11BufferPool usage and a way of
D3D11 texture sharing between application and GStreamer via appsrc.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2646>
2022-06-27 19:33:57 +00:00
Seungha Yang dbed379f09 examples: Add d3d11decoder zero-copy rendering example
This example code demonstrates D3D11 device sharing between
application and GStreamer. Application can access texture
using appsink and it can be rendered on application's window without
any copy operation.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2646>
2022-06-27 19:33:57 +00:00
Seungha Yang eee0f97c18 d3d11: Add a helper method for GstContext creation
Add gst_d3d11_context_new() method for application to create
GstContext using GstD3D11Device.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2646>
2022-06-27 19:33:57 +00:00