Commit graph

118302 commits

Author SHA1 Message Date
Michael Tretter
0563a25494 v4l2videoenc: unconditionally activate the OUTPUT pool
If the v4l2videoenc receives an QUERY_ALLOCATION, it must not propose a
currently used pool, because it cannot be sure that the allocation query came
from exactly the same upstream element. The QUERY_ALLOCATION will not contain
the internal OUTPUT pool.

The upstream element (the basesrc) detects that the newly proposed pool differs
from the old pool. It deactivates the old pool and switches to the new pool.

If there was a format change, a new OUTPUT buffer pool will be allocated in
gst_v4l2_object_set_format_full() and the CAPTURE task will be stopped to switch
the format. If there hasn't been a format change,
gst_v4l2_object_set_format_full() will not be called. The old pool will be kept
and reused.

Without a format change, the processing task continues running.

This leads to the situation that the processing task is running, but the OUTPUT
buffer pool (the old pool) is deactivated. Therefore, the encoder is not able to
get buffers from the OUTPUT pool and encoding cannot continue.

This situation can be triggered by sending a RECONFIGURE event without a format
change.

Resolve this situation by ensuring that the OUTPUT buffer pool is always
activated when frames arrive at the encoder.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4235>
2023-10-11 19:35:54 +00:00
Michael Tretter
41ce99ebab v4l2videoenc: fix activation of internal pool
Fix the buffer pool activation if the driver does not support VIDIOC_CREATE_BUFS
the same way as it was fixed for the v4l2videodec.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4235>
2023-10-11 19:35:54 +00:00
Michael Tretter
5e72e1985a v4l2videoenc: rename OUTPUT pool to opool
There is a CAPTURE pool in the same function. While the CAPTURE pool is called
cpool, using pool for the OUTPUT pool is confusing.

Using opool for the OUTPUT pool makes it more obvious, which pool is used.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4235>
2023-10-11 19:35:54 +00:00
Seungha Yang
f52ecb9607 d3d11converter: Add support for HLSL precompile and bytecode caching
Precompile pixel shaders for simple conversion path
(without gamma/primaries conversion) in case of MSVC build.
Even if runtime compile is required (cross-compiled or complex conversion
path), do it only once and reuse the compiled bytecode.

This precompile/caching can save about 95% of time taken by
gst_d3d11_converter_new() call.

Fixes: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/3004
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5457>
2023-10-11 18:40:46 +00:00
Seungha Yang
83a576e854 d3d11: Reuse sampler object
The linear sampler object can be reused

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5457>
2023-10-11 18:40:46 +00:00
Seungha Yang
92cc5722c8 d3d11: Pass HLSL source size to compile function
The string size is known at build time

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5457>
2023-10-11 18:40:46 +00:00
Seungha Yang
bfdea297d2 d3d11converter: Set alpha-mode using config
... and disallow runtime alpha-mode update for now

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5457>
2023-10-11 18:40:46 +00:00
Seungha Yang
8fe26c8a10 d3d11: Simplify HLSL build
Unify source/header/entrypoint names

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5457>
2023-10-11 18:40:46 +00:00
Guillaume Desmottes
a56aabc773 flvmux: set the src segment position as running time
We were already converting the pad last timestamp to running time but
not the segment position.
This segment position is used by gst_aggregator_simple_get_next_time()
to compute the waiting time when aggregating.

Those waiting times were wrong in my live pipeline using the system
clock, resulting in the aggregator to never wait at all.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5460>
2023-10-11 15:20:18 +00:00
Nicolas Dufresne
bcfbdfbbca v4l2: Fix tiled formats stride conversion
While adding arbitrary tile support, a round up operation was badly
converter. This caused the Y component of the stride to be 0. This
eventually lead to a crash in glupoad preceded by the following
assertion.

  gst_gl_buffer_allocation_params_new: assertion 'alloc_size > 0' failed

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5458>
2023-10-11 14:13:53 +00:00
Nicolas Dufresne
88fd9908fe v4l2codecs: Fix tiled formats stride conversion
While adding arbitrary tile support, a round up operation was badly
converter. This caused the Y component of the stride to be 0. This
eventually lead to a crash in glupoad preceded by the following
assertion.

  gst_gl_buffer_allocation_params_new: assertion 'alloc_size > 0' failed

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5458>
2023-10-11 14:13:53 +00:00
Seungha Yang
5cb63edbd3 tests: multiqueue: Add overrun test case
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5430>
2023-10-11 13:17:46 +00:00
Seungha Yang
aa5f6b2376 multiqueue: Do not update time level on segment
Update time level decision logic to be identical to the queue/queue2

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5430>
2023-10-11 13:17:46 +00:00
Seungha Yang
650e7cc4b2 tests: queue, queue2: Add more timelevel test
... and update existing testcases for new timelevel measuring logic

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5430>
2023-10-11 13:17:46 +00:00
Seungha Yang
96a758abdb queue, queue2: Fix current-level-time report
Do not update timelevel on segment. Segment itself does not tell
anything about the amount of buffered time duration in the element
but buffer timestamp/duration is required to measure actual bufferred time.
Moreover, at the time when new segment is applied to sink/srcpad,
segment.position would point to random value.
Therefore calculating running time using the random value does not
make sense and it will result in wrong timelevel report.

This patch updates queue/queue2's timelevel measuring logic so that
it can be updated only on buffer/buffer-list/gap-event flow.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5430>
2023-10-11 13:17:46 +00:00
Matthew Waters
714c78ac51 glcolorconvert: add A422/A444 to output switch statement
Fixes glcolorconvert writing to A422 or A444 formats.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5455>
2023-10-10 22:47:59 +11:00
Piotr Brzeziński
64a58c37ac glfilter: Only add parent meta if inbuf != outbuf
This was causing a memory leak in cases like `gltestsrc ! gltransformation scale-x=0.5 ! glimagesink`.
Parent meta was being added in assumption that those buffers are different, which was not the case here,
creating a reference loop and never freeing the buffer.

Co-authored-by: Matthew Waters <matthew@centricular.com>
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5445>
2023-10-10 03:17:07 +00:00
Seungha Yang
3536b7f3a6 decklink: Fix broken COM string conversion
WideCharToMultiByte return is the string length without null terminate
character if passed "cchWideChar" does not include the null terminate
character size. Instead of passing the exact string length, pass -1 so that
the API can understand the input string is null terminated already and
returned value from the API includes the character.

Fixes: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/3023
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5444>
2023-10-09 20:10:25 +09:00
Michael Tretter
c020dab393 uvcsink: use the pad's current caps to update caps_changed
The caps that were sent by the caps event can be retrieved from the sinkpad
using gst_pad_get_current_caps(). This is more reliable than using cur_caps as
we know exactly which caps upstream selected when the UVC host didn't select a
format, yet.

This further allows to simplify the check, if the uvcsink has to wait for the
caps event before switching to the internal v4l2sink.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4994>
2023-10-06 15:55:23 +00:00
Michael Tretter
733b4d9597 uvcsink: use event function instead of probe
The probe passes all events except the EVENT_CAPS. Installing and removing the
probe doesn't provide any additional value.

Install an event function and always handle EVENT_CAPS. Use the caps_changed
field, to decide, if the element has to do anything special on a EVENT_CAPS.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4994>
2023-10-06 15:55:23 +00:00
Michael Tretter
1732f8c728 uvcsink: refactor gst_uvc_sink_update_streaming
Move the sanity checks to the beginning of the function. Make the actual effect
of the function more obvious and reset the flags in the end.

This should make it easier to understand what this function is doing.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4994>
2023-10-06 15:55:23 +00:00
Michael Tretter
6637343980 uvcsink: extract helper function for updating the stream state
The uvcsink may switch to the v4l2sink after a STREAMON either on a caps event
or on a caps query.

Extract the code that handles the STREAMON into a helper function, as this is
the same code.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4994>
2023-10-06 15:55:23 +00:00
Michael Tretter
24daf9ea3d uvcsink: extract common code to reset caps_changed
The caps_changed flag must be reset for streamon and streamoff. Extract it to a
common path.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4994>
2023-10-06 15:55:23 +00:00
Michael Tretter
a9eef25717 uvcsink: remove separate function for buffer probe installation
The probe that installs the buffer probe is already on the correct pad. There is
no need for a separate function to install the probe.

While at it, change the signature of the probe functions to GstPadProbeCallback
to avoid the cast when installing the probes.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4994>
2023-10-06 15:55:23 +00:00
Michael Tretter
eac9f60608 uvcsink: extract common code in idle_probe
The RECONFIGURE event has to be sent in streamon and streamoff. Extract the
common code to a separate branch to make it easier to understand.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4994>
2023-10-06 15:55:23 +00:00
Michael Tretter
69c5529011 uvcsink: return caps when reading the host configured caps
The uvcsink calculates the caps for the format that the UVC host selected. The
gst_uvc_sink_parse_cur_caps() sets these caps as cur_caps as a side effect. This
behavior is surprising as cur_caps is later updated to reflect the actually used
caps.

Just return the configured caps to avoid side effects. This makes the function
easier to understand. Update the function name to reflect the new behavior.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4994>
2023-10-06 15:55:23 +00:00
Michael Grzeschik
17797d1d28 uvcsink: fix event peer probe
The only job of the event peer probe is to catch the upcoming caps event
and be able to react with the sink change. All other events that are
passing the pad shall be passed and ignored.

Since the probe is a blocking probe, there is no use in returning
with GST_PAD_PROBE_OK on other events. Otherwise the event would just
be blocked.

Since we are handling the probe removal of the probe already in the
event switch, we can remove the second explicit probe removal.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4994>
2023-10-06 15:55:23 +00:00
Michael Grzeschik
e3a121950b uvcsink: drop useless debug messages in peer event probe
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4994>
2023-10-06 15:55:22 +00:00
Guillaume Desmottes
dd0896f05a audiobuffersplit: disable max-silence-time if set to 0
According to the property documentation max-silence-time is supposed to be
disabled when set to 0 but it was not.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5442>
2023-10-06 14:48:46 +02:00
Sebastian Dröge
134a66277e ptp: Fix a couple of stylistic clippy warnings
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5441>
2023-10-06 13:39:34 +03:00
Leif Andersen
d1aaf8ba0d docs: Fix line numbers in tutorials 1 and 2
It seems that the lines for the C code for tutorials 1 and 2 are all
off.

The remaining tutorials seem uneffected.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5387>
2023-10-05 21:54:17 +00:00
Thibault Saunier
049859c2cb adaptivedemux2: Do not submit_transfer when cancelled
There is a race condition where transfer has not been submitted yet while the
request is cancelled which leads to the transfer state going back to
`DOWNLOAD_REQUEST_STATE_OPEN` and the user of the request to get signalled about
its completion (and the task actually happening after it was cancelled) leading
to assertions and misbehaviours.

To ensure that this race can't happen, we start differentiating between the
UNSENT and CANCELLED states as in the normal case, when entering `submit_request`
the state is UNSENT and at that point we need to know that it is not because
the request has been cancelled.

In practice this case lead to an assertion in
`gst_adaptive_demux2_stream_begin_download_uri` because in a previous call to
`gst_adaptive_demux2_stream_stop_default` we cancelled the previous request and
setup a new one while it had not been submitted yet and then got a `on_download_complete`
callback called from that previous cancelled request and then we tried to do
`download_request_set_uri` on a request that was still `in_use`, leading to
something like:

```
 #0: 0x0000000186655ec8 g_assert (request->in_use == FALSE)assert.c:0
 #1: 0x00000001127236b8 libgstadaptivedemux2.dylib`download_request_set_uri(request=0x000060000017cc00, uri="https://XXX/chunk-stream1-00002.webm", range_start=0, range_end=-1) at downloadrequest.c:361
 #2: 0x000000011271cee8 libgstadaptivedemux2.dylib`gst_adaptive_demux2_stream_begin_download_uri(stream=0x00000001330f1800, uri="https://XXX/chunk-stream1-00002.webm", start=0, end=-1) at gstadaptivedemux-stream.c:1447
 #3: 0x0000000112719898 libgstadaptivedemux2.dylib`gst_adaptive_demux2_stream_load_a_fragment [inlined] gst_adaptive_demux2_stream_download_fragment(stream=0x00000001330f1800) at gstadaptivedemux-stream.c:0
 #4: 0x00000001127197f8 libgstadaptivedemux2.dylib`gst_adaptive_demux2_stream_load_a_fragment(stream=0x00000001330f1800) at gstadaptivedemux-stream.c:1969
 #5: 0x000000011271c2a4 libgstadaptivedemux2.dylib`gst_adaptive_demux2_stream_next_download(stream=0x00000001330f1800) at gstadaptivedemux-stream.c:2112
```

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5435>
2023-10-05 20:55:00 +00:00
Stéphane Cerveau
bdbf6e1c17 gst-full: register full features in a plugin
To offer the possibility to get information at plugin
level and get it from the registry, all the
full features are now registered in 'fullstaticfeatures'
meta plugin instead of NULL plugin.
In the case of gst-inspect, the features were not displayed
at plugin level because it was a NULL plugin.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5421>
2023-10-05 11:40:45 +00:00
James Oliver
aeef97d81b nvh265encoder: fix bounds for auto-select GPU enumeration
Fixes the bounds-check for encoder auto-select GPU enumeration to be
between 0-7 instead of 0-6. This should allow 8-GPU machines to work
with nvautogpuh265enc for the last enumerated GPU.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5438>
2023-10-05 13:37:36 +08:00
James Oliver
54074af8ec nvh264encoder: fix bounds for auto-select GPU enumeration
Fixes the bounds-check for encoder auto-select GPU enumeration to be
between 0-7 instead of 0-6. This should allow 8-GPU machines to work
with nvautogpuh264enc for the last enumerated GPU.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5438>
2023-10-05 13:37:32 +08:00
Stéphane Cerveau
898e153968 dashsink: add dashmp4mux support
As mp4mux is not correctly suppporting the fragment generation,
see
https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1722,
we deprecate and advertize the current status of usage.

Added the possibility to use the rust dashmp4mux element.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5403>
2023-10-04 23:49:02 +00:00
Stéphane Cerveau
2644b3608f dashsink: Do not reset muxer only for TS
The MP4 needs to be reset to continue to produce segments.

Closes #1015

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5403>
2023-10-04 23:49:02 +00:00
Guillaume Desmottes
8004b1650a videorate: log when rolling back previous caps
We were logging when restoring the current caps but not when it was
changed, making logs quite confusing.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5433>
2023-10-04 14:19:37 +00:00
Arun Raghavan
9e137ea6a4 gio: Drop some trailing whitespace in giobasesink
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5372>
2023-10-04 12:56:03 +00:00
Arun Raghavan
ca337002f1 giostreamsink: Add a property to close stream on stop()
Back in the mists of time[1], we switched `giostream*` elements to not close the
stream on stop() so that applications that needed a handle to the stream after
the element stopped had it.

Unfortunately, we also have cases[2] where waiting for the element to be
finalized is too late for the stream to be closed.

In order to not change the behaviour of the element, we add a property to allow
users to select the desired behaviour.

[1]: https://bugzilla.gnome.org/show_bug.cgi?id=587896
[2]: gst-plugins-rs#423

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5372>
2023-10-04 12:56:03 +00:00
Thibault Saunier
974e908c61 ges: project: Start making MT safe where needed
Formatters might call "loaded" from the `gessrc` streaming thread
meaning that the `->formatters` field need to be protected.

Several other APIs are called from gesbasedemux, in some radom
thread, so we should ensure that this is all MT. safe, and the API
makes it simple.

Co-authored-by: Philippe Normand <philn@igalia.com>
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5431>
2023-10-04 09:29:04 +01:00
Nicolas Dufresne
fc4bb5585f doc: Update plugin cache for added DMA_DRM format
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5386>
2023-10-03 21:13:00 +00:00
Nicolas Dufresne
0eee03d688 videoaggregator: Avoid creating caps that are not in the template
By using the gst_caps_set_simple() to set the format on all structures, the
compositor may create invalid combinations as the caps may contain passthrough
caps. Avoid this issue by intersecting the resul with its original.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5386>
2023-10-03 21:13:00 +00:00
Nicolas Dufresne
dcd911f5dc tests: videoscale: Skip passthrough caps
There scaler can only passthrough with the caps from the ANY caps filter. This
stops testing all the formats twice and avoid failing on DMA_DRM format.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5386>
2023-10-03 21:13:00 +00:00
Nicolas Dufresne
aaed9272c1 video-filters: Fix passthrough with ANY caps feature
With the support for DRM modifiers, passthrough caps must now include DMA_DRM
format, otherwise pipeline using thhese filters unconditionally may fail
to negotiate.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5386>
2023-10-03 21:13:00 +00:00
Nicolas Dufresne
0fc63b58d0 video: Add support for a list of any video formats
Adds list of formats that should be used by element in needs to passthrough
video. It contains the full list of video format plus DMA_DRM format
and will be extended in the future as needed. This patches includes 3 new
symbols:

  - GST_VIDEO_FORMATS_ANY_STR
  - GST_VIDEO_FORMATS_ANY
  - gst_video_formats_any()

The last one can be used by bindings or for code that prefers having
GstVideoFormat values instead of strings.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5386>
2023-10-03 21:13:00 +00:00
Jonas K Danielsson
6c84d7ef0d doc: rist: Update cache for new properties
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5422>
2023-10-03 20:17:08 +00:00
Jonas K Danielsson
f4fb4a5606 ristsrc: Add support for dynamic payload
This commit ports functionality from the `rtpsrc` to make the `ristsrc`
work with dynamic payload types.

It adds two properties:
  - `caps`
  - `encoding-name`

These can be used to make the `ristsrc` receive other payload types than
the MPEG TS one.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5422>
2023-10-03 20:17:07 +00:00
Jordan Petridis
8057597dd2 ci: Rework use of BUILD_GST_DEBUG and BUILD_TYPE variables
When using parallel:matrix variables, only the value of the
variable is shown in the Gitlab GUI and thus we end up with
a job name resembling "build fedora gcc: [both, true]".

Pass down the whole string/arguments as the matrix variable
values so that we will have a bit more context.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4698>
2023-10-03 19:59:05 +03:00
Seungha Yang
cf1286b0e9 d3d11: Add support for HLSL precompile and shader caching
Compile HLSL at build time in case of MSVC, and use it if device
supports shader model 5. Also cache/reuse pixel shader and vertex
shader objects.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5426>
2023-10-03 09:42:03 +00:00