Commit graph

820 commits

Author SHA1 Message Date
Matthew Waters cc59841a45 gl/format: add support for RGBA64_LE/BE
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5209>
2023-08-22 12:18:42 +00:00
Jan Schmidt 6053650b85 audio: Make sure to stop ringbuffer on error
Add gst_audio_ring_buffer_set_errored() that will mark the
ringbuffer as errored only if it is currently started or paused,
so gst_audio_ringbuffer_stop() can be sure that the error
state means that the ringbuffer was started and needs stop called.

Fixes a crash with osxaudiosrc if the source element posts
an error, because the ringbuffer would not get stopped and CoreAudio
would continue trying to do callbacks.

Also, anywhere that modifies the ringbuffer state, make sure to
use atomic operations, to guarantee their visibility

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5205>
2023-08-21 08:50:45 +00:00
Matthew Waters 1f9a13da55 gl: support uploading/downloading 10-bit A420/A422/A444
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5193>
2023-08-17 01:55:12 +00:00
Jan Schmidt ccfbdcad90 videoconvertscale: Don't passthrough with dither or alpha settings
If the configured properties request dithering/quantization be applied
or alpha be set/multiplied then don't do passthrough, even if the
caps are the same.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5183>
2023-08-16 07:38:21 +00:00
Jochen Henneberg d086491909 rtpbasedepayload: Fixed HdrExt handling for aggregated output buffer
If a depayloader aggregates multiple RTP buffers into one buffer only
the last RTP buffer was checked for header extensions. Now the
depayloader remembers all RTP packets pushed before a output buffer is
pushed and checks all RTP buffers for header extensions.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4979>
2023-08-15 07:12:03 +02:00
Jan Schmidt 62f09513e5 audiobasesink: Don't wait on gap events
Don't call wait_event() at all for gap events, as basesink will
end up waiting for the time that the gap event would be rendered
out at the audio device. There's no need to render it at all,
just treat it as a handy point to resync the audio if needed,
let the ringbuffer render silence, and place the next buffer
into the ringbuffer where it belongs.

The only thing we really need to do is make sure the ringbuffer
and clock are running, and wait for preroll.

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

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5178>
2023-08-14 14:57:16 +00:00
Olivier Crête f3cd913b3c sdpmessage: Parse zero clock-rate as default
It seems there is at least one broken RTSP server out there that returns a clock-rate of 0.
Let's just ignore it and use the default in that case.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5171>
2023-08-14 08:26:59 +00:00
Nicolas Dufresne d604b3655e video: Add Mediatek 10bit formats
These 10bit formats are identical to NV12_16L32S, but 64bytes of data is being
prefixed with 16bytes data with four pixels of lower 2bits per byte. For
MT2110T, the lower two bits set so each bytes contains a column of 4 pixels,
also describe as tiled lower 2 bits. MT2110T has been chosen as a name to match
the vendor chosen name. This format is unlikely to exist for other vendors.

For MT2110R, the 2 low bits are in raster order.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3444>
2023-08-08 16:08:16 +00:00
He Junyan a9e9001778 video DMA: Add several video formats support
Add Y410, Y412, Y210, Y212, BGR10A2, P010 and P012 format support.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5159>
2023-08-08 12:29:20 +00:00
Roman Lebedev 8b1500d7ff volume: support arbitrarily-large positive gains
The current limit is `x10`, which allows just `+20 dB` of gain.

While it may seem sufficient, this came up as a problem
in a real-world, non-specially-engineered situation,
in strawberry's EBU R 128 loudness normalization.
(https://github.com/strawberrymusicplayer/strawberry/pull/1216)

There is an audio track (that was not intentionally engineered that way),
that has integrated loudness of `-38 LUFS`,
and if we want to normalize it's loudness to e.g. `-16 LUFS`,
which is a very reasonable thing to do,
we need to apply gain of `+22 dB`,
which is larger than `+20 dB`, and we fail...

I think it should allow at least `+96 dB` of gain,
and therefore should be at `10^(96/20) ~= 63096`.

But, i don't see why we need to put any specific restriction
on that parameter in the first place, other than the fact
that the fixed-point multiplication scheme does not support volume
larger than 15x-ish.

So let's just implement a floating-point fall-back path
that does not involve fixed-point multiplication
and lift the restriction altogether?

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5063>
2023-08-07 13:17:45 +00:00
He Junyan 67ec72b7cd doc: Update the caps for glupload related plugins
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3524>
2023-08-03 20:58:23 +00:00
He Junyan 3cebfc7e84 glupload: Delete the flag of METHOD_FLAG_CAN_ACCEPT_RAW for DMABuf
When this flag is enabled, the transform_caps() simply set passthrough
to generate the raw caps. This is not correct, because the sink and
src have different format/drm-format fields.
We already add system memory conversion for DMABuf manner, so no more
need for this flag.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3524>
2023-08-03 20:58:23 +00:00
He Junyan 094270322b glupload: make nvmm upload manner only consider system memory
The current _nvmm_upload_transform_caps() only simply apply
"memory:NVMM" to all input caps to transform the output caps.
This is not precise and may cause problem. For example, if the
input caps include:

  video/x-raw(memory:DMABuf), width=(int)1920, height=(int)1080, \
  interlace-mode=(string)progressive, multiview-mode=(string)mono, \
  framerate=(fraction)30/1, drm-format=(string)NV12:0x0100000000000002

it will be changed as

  video/x-raw(memory:GLMemory), width=(int)1920, height=(int)1080, \
  interlace-mode=(string)progressive, multiview-mode=(string)mono, \
  framerate=(fraction)30/1, drm-format=(string)NV12:0x0100000000000002

For GLMemory kind caps, no drm-format should appear.

So we should let it only transforms which it can recognize.

And in _nvmm_upload_accept(), we should only accept the "memory:NVMM"
feature in input caps.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3524>
2023-08-03 20:58:23 +00:00
He Junyan 122ffa56ed glupload: make directviv upload manner only consider system memory
The current _directviv_upload_transform_caps() only simply apply
"memory:GLMemory" to all input caps to transform the output caps.
This is not precise and may cause problem. For example, if the
input caps include:

  video/x-raw(memory:DMABuf), width=(int)1920, height=(int)1080, \
  interlace-mode=(string)progressive, multiview-mode=(string)mono, \
  framerate=(fraction)30/1, drm-format=(string)NV12:0x0100000000000002

it will be changed as

  video/x-raw(memory:GLMemory), width=(int)1920, height=(int)1080, \
  interlace-mode=(string)progressive, multiview-mode=(string)mono, \
  framerate=(fraction)30/1, drm-format=(string)NV12:0x0100000000000002

For GLMemory kind caps, no drm-format should appear.

So we should let it only transforms which it can recognize.

And in _directviv_upload_accept(), we should only accept the system
memory as input caps.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3524>
2023-08-03 20:58:23 +00:00
He Junyan b9c97ba76d glupload: make gl memory upload manner only consider memory:GLMemory feature
The current _gl_memory_upload_transform_caps() only simply apply
"memory:GLMemory" to all input caps to transform the output caps.
This is not precise and may cause problem. For example, if the
input caps include:

  video/x-raw(memory:DMABuf), width=(int)1920, height=(int)1080, \
  interlace-mode=(string)progressive, multiview-mode=(string)mono, \
  framerate=(fraction)30/1, drm-format=(string)NV12:0x0100000000000002

it will be changed as

  video/x-raw(memory:GLMemory), width=(int)1920, height=(int)1080, \
  interlace-mode=(string)progressive, multiview-mode=(string)mono, \
  framerate=(fraction)30/1, drm-format=(string)NV12:0x0100000000000002

For GLMemory kind caps, no drm-format should appear.

So we should let it only transforms which it can recognize.

And in _gl_memory_upload_propose_allocation(), we should only allocate
the allocator and buffer pool for the caps with "memory:GLMemory"
feature.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3524>
2023-08-03 20:58:23 +00:00
He Junyan 414f91d0fa glupload: make meta upload manner only consider TextureUploadMeta feature
The current _upload_meta_upload_transform_caps() only simply apply
"memory:GLMemory" to all input caps to transform the output caps.
This is not precise and may cause problem. For example, if the
input caps include:

  video/x-raw(memory:DMABuf), width=(int)1920, height=(int)1080, \
  interlace-mode=(string)progressive, multiview-mode=(string)mono, \
  framerate=(fraction)30/1, drm-format=(string)NV12:0x0100000000000002

it will be changed as

  video/x-raw(memory:GLMemory), width=(int)1920, height=(int)1080, \
  interlace-mode=(string)progressive, multiview-mode=(string)mono, \
  framerate=(fraction)30/1, drm-format=(string)NV12:0x0100000000000002

For GLMemory kind caps, no drm-format should appear.

So we should let it only transforms which it can recognize.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3524>
2023-08-03 20:58:23 +00:00
He Junyan fe07763fd8 glupload: make raw manner only consider system memory
The current _raw_data_upload_transform_caps() only simply apply
"memory:GLMemory" to all input caps to transform the output caps.
This is not precise and may cause problem. For example, if the
input caps include:

  video/x-raw(memory:DMABuf), width=(int)1920, height=(int)1080, \
  interlace-mode=(string)progressive, multiview-mode=(string)mono, \
  framerate=(fraction)30/1, drm-format=(string)NV12:0x0100000000000002

it will be changed as

  video/x-raw(memory:GLMemory), width=(int)1920, height=(int)1080, \
  interlace-mode=(string)progressive, multiview-mode=(string)mono, \
  framerate=(fraction)30/1, drm-format=(string)NV12:0x0100000000000002

For GLMemory kind caps, no drm-format should appear.

So we should let it only transforms which it can recognize.
We also should recognize the system memory caps in _accept() early, if
the input is not system memory, we just return early.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3524>
2023-08-03 20:58:23 +00:00
He Junyan cae46d36b5 glupload: change the accept function to import dmabuf with modifier
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3524>
2023-08-03 20:58:23 +00:00
He Junyan 21faad5eca glupload: enable drm kind caps in glupload plugin for DMA buf
Most of the time, the RGB kind formats are OpenGL native supported
format which has only one plane. They can be imported at one shot
using no matter DIRECT or INDIRECT mode.
While YUV kind formats which have multi planes have two ways to import.
They can be DIRECT imported, which requires GL_OES_EGL_image_external
extension. The output format should be RGBA and TARGET should be set
as OES after imported. The other way, they can be INDIRECT imported,
which makes each plane as a texture. In this mode, the imported textures
have different fourcc from the original format. For example, the NV12
format can be imported as a R8 texture for the first plane and RG88
texture for the second plane. The output TARGET should be sets as 2D
in this mode.

When converting sink caps to src caps, we first filter the feature of
"video/x-raw(memory:DMABuf)" and system memory. Then Based on the
external_only flag (INDIRECT mode does not care while DIRECT mode cares),
we transform the drm-format into the gst video format.

When converting src caps into sink caps, we first filter the correct
TARGET(INDIRECT mode contains 2D only while DIRECT mode contains 2D,
OES or both of them) gstructure. Then Based on the include_external flag
(INDIRECT mode always true while DIRECT mode depends on TARGET), we
transform the gst video format into drm-format.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3524>
2023-08-03 20:58:23 +00:00
He Junyan 96ea1b8da9 glupload: Add a helper function of _filter_caps_with_features()
We sometimes need to filter some special feature for the next step.
This helper function can help us to filter out un-needed features
in a caps.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3524>
2023-08-03 20:58:23 +00:00
He Junyan 95707bb80d glupload: add a helper function to convert drm formats into gst formats
Co-authored-by: Víctor Manuel Jáquez Leal <vjaquez@igalia.com>
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3524>
2023-08-03 20:58:23 +00:00
He Junyan 6dd3d6f1c1 glupload: add a helper function to convert gst formats into drm formats
Co-authored-by: Víctor Manuel Jáquez Leal <vjaquez@igalia.com>
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3524>
2023-08-03 20:58:23 +00:00
He Junyan 22bb3107d7 gl: add a method to check whether DMA modifier is supported in EGL
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3524>
2023-08-03 20:58:23 +00:00
Philippe Normand 1afeef0e8b decodebin3: Ensure the slot is unlinked before linking to decoder
When switching from a raw stream to an encoded stream we need to make sure the
slot is unlinked, there is code in place for this but it wasn't triggered
because the slot being reconfigured wasn't advertised as linked beforehand.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5126>
2023-08-01 20:16:59 +00:00
Nirbheek Chauhan eb9be6de78 glcolorconvert: Fix syntax for GLSL shaders
Shader compilation was failing on macOS:

gstglslstage.c:519:_compile_shader:<glslstage1> fragment shader compilation failed:
ERROR: 0:10: 'input_swizzle' : syntax error: Array size must appear after variable name

Co-authored-by: Matthew Waters <matthew@centricular.com>
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5123>
2023-07-31 17:33:20 +05:30
Matthew Waters 7fcef3818e glcolorconvert: expose the swizzle glsl functions
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5109>
2023-07-28 03:29:09 +00:00
Matthew Waters bff5d6d725 glcolorconvert: expose the YUV->RGB glsl function
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5109>
2023-07-28 03:29:09 +00:00
Matthew Waters b32e2cd9dd gl: expose calculating swizzle indices to/from RGBA/YUVA
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5109>
2023-07-28 03:29:09 +00:00
Matthew Waters a90f6d5d67 gl/format: add helper for returning the number of components in a GL format
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5109>
2023-07-28 03:29:09 +00:00
Matthew Waters 5bf85e7588 gl/colorconvert: use swizzle indices instead of chars
Allows using a uniform to control which value goes where and not rewrite
the shader for every format combination.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5109>
2023-07-28 03:29:08 +00:00
Matthew Waters 00316db5e5 gl/eagl: ignore OpenGLES deprecation on ios
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5111>
2023-07-27 13:05:37 +00:00
He Junyan 3593d5eea8 test: video: Fix the caps comparing typo for video drm test case
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5107>
2023-07-26 20:49:02 +00:00
He Junyan 9e863976c9 video: dma: let gst_video_info_dma_drm_to_caps() return caps with DMABuf feature
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5107>
2023-07-26 20:49:02 +00:00
He Junyan 5299c34452 video: Add GST_VIDEO_FORMATS_STR to declare all video formats as a string
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5094>
2023-07-25 19:34:58 +00:00
Seungha Yang 792eb0cf48 tests: compositor: Fix race in buffer unref
Don't assume that compositor will output only single buffer
for single input buffer. If buffer's running time is not completly
aligned to output buffer running time or duration, compositor
can generate multiple buffers. If that happens, two threads,
one is aggregator output thread and main thread were trying
to modify buffer in this test. Clear the buffer after
shutting down pipeline to avoid the race.

Fixes: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/2836
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5081>
2023-07-21 00:59:59 +09:00
Seungha Yang 3a5978def1 tests: compositor: Remove whitespace
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5081>
2023-07-21 00:46:55 +09:00
Roman Lebedev dfe67ba7c6 volume: print actual produced values, not bytes
`map.data` is a pointer to a byte array,
we need to first cast it to the pointer to the expected element type,
otherwise we will get not what we are expecting.

I have stumbled into this in https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5063#note_2007447

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5075>
2023-07-19 19:54:38 +00:00
Philippe Normand 0d5f6f3d47 decodebin3: Prevent a critical warning when reassigning output slots
Do not attempt to send a streams-selected message when reassigning
an output slot in case upstream signalled that it is handling stream selection.
In this case decodebin3 doesn't keep track of stream
collections (`dbin->collection` is NULL).

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5059>
2023-07-19 15:17:46 +00:00
He Junyan e14d4e08c1 test: Update all video related tests because of adding DMA_DRM format
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4981>
2023-07-19 09:57:50 +00:00
Víctor Manuel Jáquez Leal 8b38614173 video: add GST_VIDEO_DMA_DRM_CAPS_MAKE
It is requried this macro because it doesn't define format field, neither
drm-format which is suppossed to be generated in run-time.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4981>
2023-07-19 09:57:50 +00:00
He Junyan bc48588818 video: dma: Set DMA caps' format field to DMA_DRM
The current way of dma caps uses the drm-format to replace the orginal
format field. The absence of format field means it can accept all formats.
It causes problems when clipping with other old DMA or video/x-raw(ANY)
caps, the result will contain both format field and drm-format field,
which is not valid DMA caps.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4981>
2023-07-19 09:57:50 +00:00
He Junyan 94c94d34dc video: Add new GST_VIDEO_FORMAT_DMA_DRM video format
This GST_VIDEO_FORMAT_DMA_DRM is introduced for DMABuf kind feature
usage. It represent the DMA DRM kind memory. And like the ENCODED
format, it should not be interpreted and mapped as normal video format.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4981>
2023-07-19 09:57:50 +00:00
Philippe Normand 4404e7203c decodebin3: Fix slot input linking when the associated stream has changed
Setting the input field on the empty slot prevents future linking of it and will
result in flow errors later on.

This was observed in WebKit's MediaStream source element, when it changes the
caps on one of its associated streams, from an encoded format to a raw video
format. The associated stream-id on the sticky stream-start event doesn´t
change, but the element creates a new GstStream with a different ID and sets it
on the stream-start event. Stream parsing is disabled in urisourcebin, so
decodebin3 handles the parsing. Without this patch we would end-up with unlinked
pads in decodebin3 after switching to the raw video format.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5048>
2023-07-19 01:24:30 +00:00
Ruslan Khamidullin 9ec5ee2984 video: add extensive tests for gst_video_time_code_is_valid()
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5028>
2023-07-18 13:46:57 +00:00
Ruslan Khamidullin 53582b7430 video: accept timecode of 119.88 (120/1.001) FPS
The drop-frame rules are specified in “SMPTE ST 12-3:2016” and are
consistent with the traditional ones:

“

To minimize fractional time deviation from real time, the first two
super-frame numbers (00 and 01) shall be omitted from the count at the
start of each minute except minutes 00, 10, 20, 30, 40, and 50. Thus the
first eight frame numbers (0 through 7) are omitted from the count at
the start of each minute except minutes 00, 10, 20, 30, 40, and 50.
”

Where “super-frame” is a group of 4 frames for 120 FPS.

Fixes #2797

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5028>
2023-07-18 13:46:57 +00:00
Edward Hervey 7e7f02f4f4 decodebin3: Rename and refactor function
It was doing a bit more than it did initially, update the name accordingly.

Refactor slightly for visibility

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5052>
2023-07-18 11:42:13 +02:00
Edward Hervey 1fd7c2c17a decodebin3: Remove dead code
Was never used since initial commit

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5052>
2023-07-18 11:42:13 +02:00
Andoni Morales Alastruey fcf2d8c350 videodecoder: fix segfault copying buffer metas
The current implementation copies metas without checking if the buffer
is writable.

The operation that needs to be done, replacing the input buffer and
copying the metas, is only part of that process. We create a new function
that does both.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4912>
2023-07-18 07:39:02 +00:00
Hou Qi 4f5e881e2a riff: add more h265 fourcc formats
Regards hevc/HEVC/hev1/HEV1 fourcc as video/x-h265 format.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5031>
2023-07-17 13:17:20 +00:00
Mathieu Duponchelle 6305db1279 base/video-converter: downgrade log level
We don't need to know about routine operation of video conversion
at GST_DEBUG=5 level.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4993>
2023-07-17 07:39:46 +00:00