Commit graph

6806 commits

Author SHA1 Message Date
Sebastian Dröge
963e15f920 avviddec: Only use 2 ticks per frame if decoding interlaced video
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7148>
2024-07-08 16:25:32 +00:00
Sebastian Dröge
20485320e5 avvidenc: Set the DTS to 0 if it is negative, not the PTS
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7148>
2024-07-08 16:25:32 +00:00
Sebastian Dröge
fa49369c46 avvidenc: Only use 2 ticks per frame if encoding interlaced video
Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/3518

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7148>
2024-07-08 16:25:32 +00:00
Sebastian Dröge
fcbb1fa5f1 avmux: Reset input context to NULL after closing in the muxer
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7148>
2024-07-08 16:25:32 +00:00
Sebastian Dröge
d3935f0974 avdemux: Fix leak of demuxer input context in error cases
Also simplify context lifetime management a bit.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7148>
2024-07-08 16:25:32 +00:00
Sebastian Dröge
d871f34b39 libav: Update AVCodecContext lifetime to work properly with ffmpeg 7
avcodec_close() is deprecated and it's not supported anymore to re-open
a codec, so we only ever allocate the codec in set_format() now and
always free it after usage.

As part of this, also fix various memory leaks in related code paths.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7148>
2024-07-08 16:25:32 +00:00
Edward Hervey
bbf21060c2 avviddec: Rename variables and fuse function
* gst_ffmpegviddec_frame() is the only caller of gst_ffmpegviddec_video_frame()
  and has the same signature. Just move the checks into a single function and
  use that.
* Make it clear which frames are the input and output ones in
  gst_ffmpegviddec_video_frame() to make issues like the one fixed in the previous
  commit more obvious.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7148>
2024-07-08 16:25:32 +00:00
Sebastian Dröge
2cdaa79da6 libav: Fix signature of avprotocol write function for ffmpeg 7
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7148>
2024-07-08 16:25:31 +00:00
Sebastian Dröge
bd7b5b166d avdemux: Remove typefinder implementation
Direct access to AVInputFormat::read_probe() is not possible anymore
with ffmpeg 7.0, and the usefulness of this typefinder seems limited
anyway. An alternative implementation around av_probe_input_format3() or
similar would be possible but it would be going over all possible ffmpeg
probes at once.

Having a typefinder here means that basically every application will
load the gst-libav plugin when typefinding is necessary, which has
unnecessary performance impacts. If a typefinder from here was indeed
missing from typefindfunctions in gst-plugins-base then it would be
better to add it there directly.

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

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7148>
2024-07-08 16:25:31 +00:00
Ruben Gonzalez
c5b4ad429d vkh265dec: Fix H.264 ref in logs
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7147>
2024-07-08 17:34:07 +02:00
Nirbheek Chauhan
a9fec8f638 meson: Fix invalid include flag in uninstalled gl pc file
${libdir}/gstreamer-1.0/include is only valid after installation, but
extra_cflags are added unconditionally, so we can't use that for
include flags.

Instead, let's add the include flag via variables, which are different
for installed and uninstalled pc files.

This is particularly bad for consuming GStreamer via CMake which barfs
on non-existent include paths.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7143>
2024-07-05 18:43:27 +01:00
Taruntej Kanakamalla
0ae0efb623 lc3: remove bitstream comparison in the tests
since the encoded output is changing based on version
it does not make sense to check the output bitstream with a fixed
bytearray since the version in the target might vary. So sticking
to checking the number of output buffers and encoded frame size
similar to the other tests

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7142>
2024-07-05 17:14:46 +01:00
Tim-Philipp Müller
0dfdbf49da subprojects: update liblc3 wrap to 1.1.1
See https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6407#note_2472538

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7135>
2024-07-04 11:22:59 +01:00
Tim-Philipp Müller
764543d3a5 info: remove unused valgrind header include
Follow-up to commit a2cbf75523.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7129>
2024-07-03 12:22:18 +01:00
Tim-Philipp Müller
24de7cf1fe subparse: remove regex optimized flag explicitly
That way the other flags in jit_flags are not touched and
flags changes in future only need to be done in one place.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7129>
2024-07-03 12:22:18 +01:00
Tim-Philipp Müller
051b8b6dbb gst-plugins-base: put valgrind header availability define into config.h for subparse
Make the valgrind header avaibility accessible to any code in
gst-plugins-base, currently it was only signalled to unit tests.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7129>
2024-07-03 12:22:18 +01:00
Chris Spoelstra
63196c2ae7 srtsrc: fix case fallthrough of authentication param
Add missing breaks to two case statements.
Also adds a missing lock of srtobject->element when getting the value
of PROP_AUTHENTICATION.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7127>
2024-07-02 17:07:24 +01:00
Edward Hervey
bad0daeb8f subparse: Don't use jitted regex when used with valgrind
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7124>
2024-07-02 11:04:01 +00:00
Edward Hervey
869b122e6b gstreamer/gst-tester: Don't leak thread
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7123>
2024-07-02 10:10:45 +01:00
Edward Hervey
a8cf222cd0 gst-inspect: Fix leak of plugin/feature
Reordering changes the initial list head

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7123>
2024-07-02 10:10:45 +01:00
Edward Hervey
00903e36cb encoding-target: Chain up to parent class
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7123>
2024-07-02 10:10:45 +01:00
Edward Hervey
02607432e3 encoding-profile: Chain up to parent class finalize
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7123>
2024-07-02 10:10:45 +01:00
Shengqi Yu
c4fe9786ea v4l2object: use v4l2 reported width for padded_width when complex video formats
Stride means bytes per line, and padded_width means pixels. Here,
padded_width shoule be pix width reported by v4l2 instead of stride.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7122>
2024-07-01 20:44:02 +01:00
Edward Hervey
8435fb4805 nlecomposition: Don't leak atomic rc box
* gst_structure_get => increases ref
* query_ancestors_position: There are two refs.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7120>
2024-07-01 14:31:23 +01:00
Edward Hervey
ef53d8c7b7 nlecomposition: Don't leak message
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7120>
2024-07-01 14:31:23 +01:00
Edward Hervey
2d38c289f6 ges-layer: Don't use invalid layers
There's a possibility that there are no layers at that priority

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7120>
2024-07-01 14:31:23 +01:00
Edward Hervey
1af999696e ges-discoverer-manager: Properly initialize/free GRecMutex
Fixes small leak of mutex internals

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7120>
2024-07-01 14:31:23 +01:00
Jordan Petridis
7057d7ce22 validate: Remove G_REGEX_OPTIMIZE usage
It's not needed and causes issues with valgrind (which doesn't support jit)

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7113>
2024-06-28 17:31:14 +01:00
Guillaume Desmottes
83d736d6d9 rtmp2: guard against calling gst_amf_node_get_type() with NULL
gst_amf_node_get_type() raises a CRITICAL if called with a NULL node.
All callers were checking for this except those.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7110>
2024-06-28 10:25:37 +01:00
Jan Schmidt
5a25a00324 adaptivedemux: Fix handling closed caption streams
Fix a typo "CLOSED_CAPTION" -> "CLOSED-CAPTION" and
a broken if statement that always bailed out for
closed captions

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7105>
2024-06-26 15:58:20 +00:00
Jan Schmidt
48e2fb95e6 webrtcdsp: Enable multi_channel processing
Enable multi_channel processing in webrtc-audio-processing when the
input or output has multiple channels.

Fixes: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/3220
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7104>
2024-06-26 16:13:04 +01:00
Piotr Brzeziński
67eae3cf31 vtenc: Fix redistribute latency spam
Just a quick fix to only report the maximum noticed delay (measured by frames inside the encoder) instead of changing
the reported latency every time the number there changes, which is way too often.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7098>
2024-06-25 09:49:56 +01:00
Seungha Yang
a593f2f71f d3d12converter: Make gamma remap work as intended
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7080>
2024-06-21 10:53:25 +01:00
Sebastian Dröge
95fdb4030f queue, queue2, multiqueue: Timestamps of gap events must be valid
This is checked in gst_event_new_gap() so doesn't have to be checked again here,
but simply can be asserted with a g_return_if_fail().

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7075>
2024-06-20 19:32:14 +01:00
Sebastian Dröge
8e9b364d9b queue: queue2: multiqueue: Don't work with segment.position if buffers have no timestamps
If the first buffers have no timestamp then the sink position would be
initialized to 0. The source pad might output this buffer, which would then
initialize the source position to 0 too.

Afterwards two buffers with a valid but huge timestamp might arrive before any
of them are output on the source pad. The first one would set the sink position
to a huge value, the second one would notice that the difference between the
huge value and 0 is certainly larger than max-size-time and consider the queue
as full.

Instead, simply don't update the times from buffers without timestamps and
assume whatever was set before is still valid, i.e. the buffer has the same
timestamp as the previous one.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7075>
2024-06-20 19:32:14 +01:00
Edward Hervey
6615af3f5f decodebin3: Fix keyframe drop probe handling
We were storing the probe id in a different structure (DecodebinOutputStream)
than the pad it is targetting (which is in MultiQueueSlot).

The problem is that when re-targetting outputs (to a different slot)... we would
end up having an invalid probe id, or not have a reference to an existing one.

Instead, store the probe id in the same structure as the pad it's targetting

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7074>
2024-06-20 15:15:54 +01:00
Edward Hervey
455ca1326b decodebin3: Fix detection of selection done
We should not assert if there are still some old streams that are waiting to be
deactivated.

Instead wait for them to be gone before posting the selection done message

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7074>
2024-06-20 15:15:54 +01:00
Tim-Philipp Müller
a58953cbf6 Back to development after 1.24.5 2024-06-20 13:02:19 +01:00
Tim-Philipp Müller
3c66f10e21 Release 1.24.5 2024-06-20 12:54:15 +01:00
Tim-Philipp Müller
f6af34d3be rtpdtmfsrc: minor logging clean-up
Only serialise event structure for debug logging purposes
if logging is actually enabled.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7062>
2024-06-19 10:11:28 +01:00
Tim-Philipp Müller
02447fa0b2 rtpdtmfsrc: fix leak when shutting down mid-event
.. and update rtpdtmfdepay unit test to trigger
the potential leak more reliably (without the fix).

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

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7062>
2024-06-19 10:11:28 +01:00
Sebastian Dröge
460b883003 video-info: Don't crash in gst_video_info_is_equal() if one videoinfo is zero-initialized
Instead handle it like gst_audio_info_is_equal() and consider both different.
And also add a shortcut for the pointers to both infos being equal.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7059>
2024-06-18 20:11:13 +01:00
Edward Hervey
ef5fe0b33b tsdemux: Fix maximum PCR/DTS values
* PTS/DTS are stored as 33 bit
* PCR is 33bit multiplied by 300

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7058>
2024-06-18 19:03:31 +01:00
He Junyan
aa5092dabf av1parse: Do not return error when expectedFrameId mismatch
According to the SPEC:
  The frame id numbers (represented in display_frame_id, current_frame_id,
  and RefFrameId[ i ]) are not needed by the decoding process, but allow
  decoders to spot when frames have been missed and take an appropriate action.

So we should just print out warning and should not return error in parser when
mismatching. The decoder itself is already robust to handle the reference missing.

Fixes #3622

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7052>
2024-06-18 11:04:43 +01:00
Tim-Philipp Müller
fe2525f9d3 rtpdtmfdepay: add unit test for caps fixation issue with downstream audioconvert
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7048>
2024-06-18 01:22:26 +01:00
Tim-Philipp Müller
e47895dbd2 rtpdtmfdepay: fix caps negotiation with audioconvert
Specify "layout" field in src template to make sure it's
set and gets fixated properly if the downstream element
supports both interleaved and non-interleaved caps.

Fixes

  gst_pad_set_caps: assertion 'caps != NULL && gst_caps_is_fixed (caps)' failed

critical with e.g.

  gst-launch-1.0 rtpdtmfsrc ! rtpdtmfdepay ! audioconvert ! fakesink

Not that the layout really matters in our case since we always
output mono anyway, but non-interleaved requires adding AudioMeta,
so this is the easiest fix.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7048>
2024-06-18 01:22:26 +01:00
Piotr Brzeziński
691ee34729 vtdec: Use GST_VIDEO_DECODER_ERROR instead of aborting when frame has an ERROR flag
This was already being used in handle_frame() for errors that happen when queueing a frame for decoding,
let's do the same when a frame is flagged with an error in the output callback.
From quick testing, this makes seeking more reliable (previously, it would sometimes cause a decoding error
and shut the whole decoder down due to GST_FLOW_ERROR).

Also manually sets the max error count to actually stop processing if too many errors occur.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7044>
2024-06-17 14:53:08 +01:00
Piotr Brzeziński
a0b35d86f9 vtdec: Handle some errors without stopping the decoder
ReferenceMissingErr is not critical and the simplest solution is to just ignore it. The frame has
the FrameDropped flag set when it occurs, so we can just drop it as usual.
BadDataErr is also not immediately critical, but in its case let's set the ERROR flag,
so the output loop can use GST_VIDEO_DECODER_ERROR to count and error out if it happens too many times.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7044>
2024-06-17 14:53:08 +01:00
Sebastian Dröge
a9beac80da av1dec: Don't treat decoding errors as fatal and print more error details
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7041>
2024-06-17 11:03:51 +01:00
Zach van Rijn
af8a090201 pcapparse: Avoid unaligned memory access
Fixes: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/3602
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7037>
2024-06-14 18:55:20 +01:00
Mathieu Duponchelle
2015d56a41 rtspsrc: fix invalid seqnum assertions
Upon fatal errors the loop function will first post an error message
then push out an EOS event.

An application may react immediately to the error message by setting the
state of the pipeline to NULL, meaning by the time we push out the EOS
event PAUSED_TO_READY may have reset the seek seqnum to -1.

While this is harmless, the assertion when setting an invalid seqnum
isn't tidy, fix this by simply not resetting to INVALID as it serves no
practical purpose and the next READY_TO_PAUSED will select a new seqnum
anyway.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7034>
2024-06-14 11:02:12 +00:00
Mathieu Duponchelle
bb726c7eef codectimestamper: never set DTS to NONE
If we want to avoid the DTS going backward, then we can set DTS to
last_dts as a last resort.

Log a warning in this case

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7033>
2024-06-14 10:45:02 +01:00
Jakub Vaněk
f4852a2d8b v4l2src: Interpret V4L2 report of sync loss as video signal loss
Certain V4L2 drivers can report that a video receiver is seeing
some signal, but that it is unable to synchronize to it. IOW: the driver
can sometimes report V4L2_IN_ST_NO_SYNC and not report V4L2_IN_ST_NO_SIGNAL.

In particular, I've seen the tc358743 (HDMI-to-CSI2 converter) driver
sometimes report this when deployed to a fleet of embedded Raspberry Pis.
The relevant kernel code is in [1]. The video output is not practically
usable when V4L2_IN_ST_NO_SYNC is reported (only visually corrupted frames,
sometimes with random "snow", are received). I assume that this happens when
either the HDMI cable is poorly plugged in or damaged or when a CSI2 FFC
cable is used and is damaged.

The change in this commit is useful for detecting this working-but-not-really
condition in application code. Applications already listening for the "Signal lost"
message will gain the ability to handle this condition.

There seem to be more V4L2 error flags like this, see [2]. However, I do not
have practical experience with them and adding only V4L2_IN_ST_NO_SYNC seems
like a safer option.

[1]: https://github.com/raspberrypi/linux/blob/be8498ee21aa/drivers/media/i2c/tc358743.c#L1534
[2]: https://www.kernel.org/doc/html/v6.6/userspace-api/media/v4l/vidioc-enuminput.html

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7027>
2024-06-13 09:30:51 +00:00
Khem Raj
3e319081f5 uvcgadget: Use g_path_get_basename instead of libc basename
Musl does not implement GNU basename and have fixed a bug where the
prototype was leaked into string.h [1], which resullts in compile errors
with GCC-14 and Clang-17+

| sys/uvcgadget/configfs.c:262:21: error: call to undeclared function 'basename'
ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
|   262 |     const char *v = basename (globbuf.gl_pathv[i]);
|       |                     ^

Use glib function instead makes it portable across musl and glibc on
linux

[1] https://git.musl-libc.org/cgit/musl/commit/?id=725e17ed6dff4d0cd22487bb64470881e86a92e7a

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7028>
2024-06-13 01:18:29 +01:00
Sebastian Dröge
9a26c25211 av1enc: Handle force-keyunit events properly by requesting keyframes
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7022>
2024-06-12 12:56:49 +01:00
Edward Hervey
2b79de8fc1 uridecodebin3: Don't hold PLAY_ITEMS lock when activating them
Once the item is configured it can be activated without holding that lock

Fixes #3610

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7020>
2024-06-11 19:19:38 +01:00
Edward Hervey
c1ec23a75e decodebin3: Always ensure we end up with parsebin or identity
This fixes a regression introduced by 6c4f52ea20

There are cases where the input stream will be push-based, time-segment and not
have a collection nor caps. This means the event-based checks are not sufficient
to decide when/where to plug in a identity or parsebin to process the input.

For those corner cases we setup a buffer probe to ensure we always end up with
at least a parsebin

Fixes #3609

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7018>
2024-06-11 17:20:57 +01:00
Seungha Yang
9380f313c3 d3d12videosink: Disconnect window signal handler on dispose as intended
Fixing typo

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7014>
2024-06-11 10:14:33 +01:00
Edward Hervey
d2fc7232e6 decodebin3: Avoid usage of parsebin even more
When dealing with push-based inputs, we are now delaying the creation of
parsebin/identity until we get all pre-buffer events.

We therefore can simplify the handling of new pads being linked and only have to
check if upstream can handle pull-based or not.

Avoids creating parsebin for parsed upstream data altogether

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6995>
2024-06-06 13:07:14 +00:00
Edward Hervey
175a3d17ba decodebin3: Ensure we get a collection for parsed inputs
When we are dealing with parsed inputs (i.e. using identity), we need to ensure
that we have a valid stream collection (and therefore DBCollection) before
anything flows dowsntream.

In those cases, we hold onto those events until we get such a collection.

Fixes #3356

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7002>
2024-06-06 12:59:25 +01:00
Edward Hervey
230d0bf978 decodebin3: New mechanism for handling collection and selections
This commit separates collection and selections into a new separate structure:
DecodebinCollection.

This provides a much cleaner/saner way of dealing with collections being
updated, gapless playback, etc...

There is now a list of DecodebinCollection in flight, of which two are special:
* input_collection, the currently inputted/merged collection
* output_collection, the currently active collection on the output of multiqueue

Handling GST_EVENT_SELECT_STREAMS is split, by looking for the collection to
which it applies. And the requested streams are stored in it. IIF that
collection is output_collection we can do the switch, else it will be updated
when it becomes active.

Detecting which collection/selection is active is done by looking at the
GST_EVENT_STREAM_START on the output of the multiqueue.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7002>
2024-06-06 12:59:25 +01:00
Edward Hervey
abb2a46787 decodebin3: minor refactoring to identify selected stream
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7002>
2024-06-06 12:59:25 +01:00
Edward Hervey
3dbb9fbb39 decodebin3: Debug line cleanups
Use identifiable items in log lines instead of random pointers

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7002>
2024-06-06 12:59:25 +01:00
Edward Hervey
3014faaa2e decodebin: Remove unused includes
* config.h is not used, plugin/element is registered in another file
* play-enum.h is not used

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7002>
2024-06-06 12:59:25 +01:00
Edward Hervey
ccef8e18fd decodebin3: Remove un-needed variable
We don't do anything with the unknown streams. Detecting that a list of
requested streams don't apply to a given collection should be handled
before-hand

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7002>
2024-06-06 12:59:25 +01:00
Edward Hervey
b6e94cb779 decodebin3: Remove un-needed variable
pending_select_streams was only set just before releasing/taking the selection
lock in a single place. That temporary lock release is not needed and therefore
the variable isn't needed either

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7002>
2024-06-06 12:59:25 +01:00
Edward Hervey
33ee6c7d03 decodebin3: Remove active_selection list
It's a duplicate of the list of slots which have an output. Use that instead.

Also when we fail to (re)configure an output, remove it.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7002>
2024-06-06 12:59:25 +01:00
Edward Hervey
6d5d41b677 decodebin3: Cache slot stream_id and rename more variables
* Move the handling of GST_EVENT_STREAM_START on a slot to a separate function

* There was a lot of usage of `gst_stream_get_stream_id()` for the slot
active_stream. Cache that instead of constantly querying it.

* Rename the variables in `handle_stream_switch()` to be clearer

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7002>
2024-06-06 12:59:25 +01:00
Edward Hervey
1fe3898904 decodebin3: Refactor slot/output (re)configuration
* Re-use existing function where possible
* Only set/reset keyframe probe at unique places

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7002>
2024-06-06 12:59:25 +01:00
Edward Hervey
bf24f813d5 decodebin3: Refactor linking input to slot
The same sequence of calls was done when doing that

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7002>
2024-06-06 12:59:25 +01:00
Edward Hervey
400b93e957 decodebin3: input_unblock_streams: Clarify variable
It's a list of pads, not slots

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7002>
2024-06-06 12:59:25 +01:00
Edward Hervey
e18006f6da decodebin3: Rename multiqueue related functions
To make clear on what they apply

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7002>
2024-06-06 12:59:25 +01:00
Edward Hervey
d6e2de985a decodebin3: Refactor/rename slot/output
* Centralize associating an output to a slot in one function, including properly
  resetting those fields
* Rename functions to be more explicit
* Move code to "reset" an output stream into a dedicated function (will be used
later)

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7002>
2024-06-06 12:59:25 +01:00
Edward Hervey
13407a11d6 decodebin3: Refactor removal of slot/output from streaming thread
The code was identical in several places

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7002>
2024-06-06 12:59:25 +01:00
Edward Hervey
b6263febe0 decodebin3: rename/clarify eos and draining usage around multiqueue
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7002>
2024-06-06 12:59:25 +01:00
Edward Hervey
8794918607 decodebin3: Document/refactor DecodebinInput handling
* Rename the function names to be clearer, with prefixes
* Pass the input (or stream) directly where appropriate
* Document usage, inputs, ownership
* Rename variables for clarity where applicable
* Avoid double lock/unlock if callee can handle it directly

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7002>
2024-06-06 12:59:25 +01:00
Edward Hervey
a166cc6aea decodebin3: Move gstdecodebin3-parse.c into gstdecodebin3.c
Makes it easier to work with LSP

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7002>
2024-06-06 12:59:25 +01:00
Edward Hervey
f168005e28 decodebin3: Refactor incoming collection handling
Simplify its usage by having it directly create the message if the collection
changed. This is what caller were always doing and avoids releasing selection
locks yet-another-time

Also use it in more places to avoid code repetition

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7002>
2024-06-06 12:59:24 +01:00
Edward Hervey
12427d4119 decodebin3: Rename variable for clarity
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7002>
2024-06-06 12:59:24 +01:00
Edward Hervey
18fbe14ac8 decodebin3: Refactor GST_EVENT_SELECT_STREAMS handling
* The same code is used for the event, regardless of whether it's coming from
via a pad or directly on the element
* The pending_select_streams list content was never used, switch it to a boolean

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7002>
2024-06-06 12:59:24 +01:00
Edward Hervey
dd01275e00 decodebin3: Don't forward select streams if we are handling it
Since the introduction of the "SELECTABLE" query, the usage of selection was
clarified. We don't need to forward the GST_EVENT_SELECT_STREAMS at this point.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7002>
2024-06-06 12:59:24 +01:00
Edward Hervey
38bae910ad gstpromise: Don't use g_return_* for internal checks
If assertion/checks are disabled bad things will happen and the function won't
return as expected

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6998>
2024-06-06 09:07:54 +00:00
Corentin Damman
d81f7579fa gstqsg6material: fix RGB format support
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6997>
2024-06-05 23:53:01 +01:00
Sebastian Dröge
300a8141e8 dtlssrtpenc: Don't crash if no pad name is provided when requesting a new pad
It is mandatory to provide a valid pad name for dtlssrtpenc.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6994>
2024-06-05 10:10:03 +01:00
Sebastian Dröge
cd4d040672 rtspsrc: Only update from the Content-Base header in the initial OPTION / DESCRIBE response
Some servers send a new content base in the SETUP response, which is
just the non-aggregate control URL of the individual streams.

See https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/3563

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6982>
2024-06-01 16:15:53 +03:00
Sebastian Dröge
d263a8d2fe rtspsrc: Handle the case of * as session-wide control URL from the SDP
Just like the comment above says this is supposed to indicate that the
same URL should be used as for the connection so far. If encountering
this case simply do nothing.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6982>
2024-06-01 16:15:53 +03:00
Sebastian Dröge
6f984939c4 rtspsrc: Also handle rtsps:// and similar URLs as absolute in other places
Previously a direct comparison with `rtsp://` was performed, which
didn't catch cases like `rtsps://`.

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

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6982>
2024-06-01 16:15:53 +03:00
Sebastian Dröge
dfc03b9a2e rtspsrc: Don't try the SETUP workaround for broken servers with absolute control URIs
Previously only control URIs that started with "rtsp://" were ignored
but it makes more sense to ignore all absolute URIs.

gst_uri_is_valid() conveniently checks for exactly that.

See https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/3563

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6982>
2024-06-01 16:15:53 +03:00
Martin Nordholts
03b6efcaf5 gst_debug: Add missing gst_debug_log_id_literal() dummy with gst_debug=false
E.g. gst_debug_log_literal() already has a dummy variant.
gst_debug_log_id_literal() is simply missing, which can
cause link errors for project using gstreamer with
gst_debug=false.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6979>
2024-06-01 11:52:32 +03:00
Samuel Thibault
8447c1d386 ptp-helper: Add GNU/Hurd support
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6974>
2024-05-31 11:16:12 +03:00
Seungha Yang
5118e657b6 d3d12memory: Fix staging buffer alignment
Not all GPUs can support arbitrary offset of
D3D12_PLACED_SUBRESOURCE_FOOTPRINT when copying GPU memory between
texture and buffer. Instead of calculating size/offset per plane,
calculate the entire size and offsets at once.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6973>
2024-05-30 16:47:35 +03:00
Jakub Adam
c305fe7a35 glcolorconvert: update existing sync meta if outbuf has one
Instead of always adding a new one, which means the buffer could end up
with multiple sync meta instances.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6962>
2024-05-30 08:35:17 +00:00
Edward Hervey
48f63a9c64 hlsdemux2: Minor refactoring of starting segment check
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6961>
2024-05-30 07:59:25 +00:00
Edward Hervey
421832e506 hlsdemux2: Be more tolerant when matching segments with PDT
Some servers might not provide 100% matching PDT when doing updates, or accross
variants. This would cause the code matching segments using PDT to fail if the
segment PDT was 1 microsecond (or whatever small value) before the candidate
segment. And would pick the (wrong) following segment as the matching one.

In order to be more tolerant when matching, we instead check whether the
candidate segment is within the first segment of the segment we are trying to
match.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6961>
2024-05-30 07:59:25 +00:00
Edward Hervey
e7ab454cf5 hlsdemux2: Fix failure to find a replacement segment on resync
If we end up with a segment with an internal time that varies from the supposed
one, this could be for two reasons:
* We guess-timated the wrong segment to go to when advancing or switching
  variants. In that case we try to find the actual segment to go to (just before
  this change).
* There was a complete playlist change (for whatever reason) and we can't find a
  replacement. In that case we want to carry on playback from this position but
  need to remember that we moved (by setting the stream to DISCONT, and
  resetting the new mapping).

Fixes playback on several broken stream

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6961>
2024-05-30 07:59:25 +00:00
Edward Hervey
12e8874f88 hlsdemux2: Refactor update of GstHLSTimeMap values
This was also missing transferring the PDT if present

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6961>
2024-05-30 07:59:25 +00:00
Edward Hervey
e9214e9afc hlsdemux2: Fix parsing of EXT-X-DISCONTINUITY-SEQUENCE:0
Since the default value of `m3u8->discont_sequence` (before parsing of the
playlist data) was 0 .. we would never properly detect the presence of that
field if it was present with a value of 0.

This would later on cause havoc in playlist synchronization where we would
assume it didn't have a discontinuity sequence specified (whereas it did, and it
was 0).

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6961>
2024-05-30 07:59:25 +00:00
Edward Hervey
2560ac6998 hlsdemux2: Increase tolerance for discontinuity detection
A lot of streams will do a poor job of estimating proper duration of fragments
in the playlist, but over several fragments have it correct.

Instead of constantly trying to realign the estimated stream time, allow for a
more realistic tolerance of 3-4 video frames

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6961>
2024-05-30 07:59:25 +00:00
Edward Hervey
5ec5323c1f hlsdemux2: Ensure a discont will be set when resetting for lost sync
This is to ensures we inform the demuxer/parsers that what follows is not contiguous

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6961>
2024-05-30 07:59:25 +00:00
Edward Hervey
dadf2ec56c hlsdemux2: Fix handling of variant switching and playlist updates
When updating playlists, we want to know whether the updated playlist is
continuous with the previous one. That is : if we advance, will the next
fragment need to have the DISCONT buffer set on it or not.

If that happens (because we switched variants, or the playlist all of a sudden
changed) we remember that there is a pending discont for the next fragment. That
will be used and resetted the next time we get the fragment information.

Previously this was only partially done. And it was racy because it was set
directly on `GstAdaptiveDemux2Stream->discont` when a playlist was updated,
instead of when the next fragment was prepared.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6961>
2024-05-30 07:59:25 +00:00
Edward Hervey
726f2d8dc0 adaptivedemux2: Only set DISCONT on beginning of fragments
This avoids accidentally setting it in the middle of a fragment, which could
cause havoc in demuxer/parsers

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6961>
2024-05-30 07:59:25 +00:00
Edward Hervey
59582e2ffe hlsdemux2: Fix getting starting segment on live playlists
When dealing with live streams, the function was assuming that all segments of
the playlist had valid stream_time. But that isn't TRUE, for example in the case
of failing to synchronize playlists.

Fixes losing sync due to not being able to match playlist on updates

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6961>
2024-05-30 07:59:25 +00:00
Seungha Yang
0ca5517d80 d3d12encoder: Do not print error log for not-supported feature
gst_d3d12_result() will print message with ERROR level if failed.
Use FAILED/SUCCEEDED macros instead, since not-supported feature
is not a critical error

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6963>
2024-05-30 00:03:28 +00:00
Sergey Krivohatskiy
63367659f2 flacparse: fix buffer overflow in gst_flac_parse_frame_is_valid
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6960>
2024-05-29 20:24:45 +00:00
Tim-Philipp Müller
03cfca1033 Back to development after 1.24.4 2024-05-29 13:51:27 +03:00
Tim-Philipp Müller
9137f539a0 Release 1.24.4 2024-05-29 13:44:50 +03:00
Sebastian Dröge
def150ed2c gstreamer: parse: Don't assume that child proxy child objects are GstObjects
The name is already passed via the signal parameters so it doesn't have
to be retrieved again via GstObject API, which would crash on other
GObjects. Child proxy child objects can be any kind of GObject and the
code here otherwise handles this correctly already.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6951>
2024-05-29 11:14:11 +03:00
Sebastian Dröge
93a2026584 gstreamer: ptp-helper: Use u64 instead of c_ulong for ifa_flags on Solaris/Illumos
See https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/3553#note_2429400

Patch by Marcel Telka <marcel@telka.sk>.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6950>
2024-05-29 11:02:26 +03:00
Sebastian Dröge
367d693f22 gstreamer: ptp-helper: Use if_nametoindex and setsockopt on Solaris / Illumos too
Patch by Marcel Telka <marcel@telka.sk>.

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

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6947>
2024-05-29 01:54:29 +03:00
Sebastian Dröge
c36296895f gstreamer: ptp-helper: Don't import Context trait multiple times unnecessarily
This only affected the Solaris / Illumos code path.

Patch by Marcel Telka <marcel@telka.sk>.

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

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6947>
2024-05-29 01:54:29 +03:00
Sebastian Dröge
c97ec122d9 gstreamer: ptp-helper: Use c_ulong for ifa_flags on Solaris/Illumos
Based on a patch by Marcel Telka <marcel@telka.sk>.

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

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6947>
2024-05-29 01:54:29 +03:00
Sebastian Dröge
895ee6f72e gstreamer: Solaris/Illumos require linking to libnsl / libsocket for various socket APIs
Patch by Tim Mooney <Tim.Mooney@ndsu.edu> from OpenIndiana/oi-userland

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6947>
2024-05-29 01:54:29 +03:00
Philippe Normand
1caa041c91 webrtcbin: Allow session level setup attribute in SDP
An SDP answer can declare its setup attribute at the session level or at the
media level. Until this patch we were validating only the latter case and an
assert was raised in the former case.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6945>
2024-05-28 15:44:21 +00:00
Sebastian Dröge
3d9fd9926c typefind: Fix handling of ID_ODD_SIZE in WavPack typefinder
Chunks are always starting on an even position and this flag only
specifies that the last byte of the chunk is not valid.

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

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6944>
2024-05-28 17:47:22 +03:00
Sebastian Dröge
b77de8f6f2 dtlsconnection: Fix overflow in timeout calculation on systems with 32 bit time_t
If a timeout of more than 4295s was scheduled, the calculation would
overflow and a too short timeout would be used instead.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6920>
2024-05-25 08:03:22 +00:00
Sebastian Dröge
4116127217 clock: Fix 32 bit assertions in GST_TIME_TO_TIMEVAL and GST_TIME_TO_TIMESPEC
On various 32 bit systems, time_t is actually 64 bits while long is
still only 32 bits. The macro would wrongly trigger its assertion in
this case if a value with more than 68 years worth of seconds is
converted.

Examples are various newer 32 bit platforms and old ones that are
compiled with -D_TIME_BITS=64.

Also statically assert that time_t is either 32 or 64 bits. Other values
might need adjustments in the macro.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6919>
2024-05-25 10:07:32 +03:00
He Junyan
e7e6472a31 kmssink: Do not close the DRM prime handle twice
The prime_fds for multi planes may be the same. For example, on Intel's
platform, the NV12 surface may have the same FD for the plane0 and the
plane1. Then, the DRM_IOCTL_GEM_CLOSE will close the same handle twice
and get an "Invalid argument 22" error the second time.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6916>
2024-05-23 23:08:36 +00:00
Daniel Stone
75ad05b518 wayland: Use wl_display_create_queue_with_name
Wayland 1.23 and above allow us to attach names to an event queue, which
are printed out when debugging. Do this to make the logs easier to read.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6915>
2024-05-23 23:28:52 +01:00
Yacine Bandou
1b191d1d8d streamsynchronizer: Fix deadlock when streams have been flushed before others start
To simplify the description, I'm assuming we only have two streams: video and audio.

For the video stream, we have the following events :
- STREAM_START => stream->wait set to true
- NEW_SEGMENT(1) => blocked waiting in gst_stream_synchronizer_wait
- FLUSH_START => unblocked
- FLUSH_STOP => stream->wait reset to false
- NEW_SEGMENT(2) => not waiting, since stream->wait is false

Then for the audio stream, we have the following events :
- STREAM_START => stream->wait set to true
- NEW_SEGMENT(2) => blocked waiting in gst_stream_synchronizer_wait for ever.

Note: The first NEW_SEGMENT event and the FLUSH_START, FLUSH_STOP events of the audio stream
are dropped before being received by the streamsynchronizer element, because the decodebin audio pad src
is not yet linked to the playsink audio pad sink.

To fix this deadlock, we don't reset stream->wait to false in the FLUSH_STOP event when it is not
waiting for the EOS of the other streams.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6887>
2024-05-23 17:51:02 +01:00
He Junyan
a084bedd58 vabaseenc: delete the useless frame counter fields
They are used to calculate the PTS and DTS before, no usage now.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6786>
2024-05-23 16:47:55 +01:00
He Junyan
3c26c0bc33 vabaseenc: Do not set the min_pts
Because all the va encoders improved their PTS/DTS algorithm, now
it is impossible to generate minus DTS. So no underflow will happen
and we do not need to set a 1000 hour offset now.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6786>
2024-05-23 16:47:48 +01:00
Backport Bot
607dadbc53 Revert "tests/d3d11: add concurrency test for gstd3d11device"
This reverts commit 203f6b00d4.

Revert test that was added with reverted commit as well.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6907>
2024-05-23 16:37:01 +01:00
Seungha Yang
a648f0da81 Revert "d3d11device: protect device_lock vs device_new"
This reverts commit 0cb12db96c
(i.e. commit 926d5366b9 on main).

AcquireSRWLockExclusive seems to be acquiring lock in exclusive mode
when the same lock is combined with write lock access.
Reverting the commit because of this is unexpected behavior
and unavoidable OS bug.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6907>
2024-05-23 16:36:45 +01:00
He Junyan
7526919fb3 vah265enc: Let FORCE_KEYFRAME be IDR frame rather than just I frame
The FORCE_KEYFRAME frame which has GST_VIDEO_CODEC_FRAME_FLAG_FORCE_KEYFRAME
bit set should be the sync point. So we should let it be an IDR frame to begin
a new GOP, rather than just promote it to an I frame.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6857>
2024-05-23 16:29:47 +01:00
He Junyan
5e24324f4f vah264enc: Let FORCE_KEYFRAME be IDR frame rather than just I frame
The FORCE_KEYFRAME frame which has GST_VIDEO_CODEC_FRAME_FLAG_FORCE_KEYFRAME
bit set should be the sync point. So we should let it be an IDR frame to begin
a new GOP, rather than just promote it to an I frame.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6857>
2024-05-23 16:29:47 +01:00
He Junyan
af88e87eec examples: vaenc-dynamic: support force key frame setting
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6857>
2024-05-23 16:29:40 +01:00
He Junyan
77455b50d3 vah265enc: Fix a memory leak when destroying the object
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6913>
2024-05-23 16:24:13 +01:00
He Junyan
2dd3ce721a vah265enc: Use a FIFO queue to generate DTS
The base parse will infer the DTS by itself, so we need to make DTS
offset before PTS in order to avoid DTS bigger than PTS. We now use
a FIFO queue to store all PTS and assign it to DTS by an offset.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6913>
2024-05-23 16:24:13 +01:00
He Junyan
09d07f13f9 vah264enc: Use a FIFO queue to generate DTS
The base parse will infer the DTS by itself, so we need to make DTS
offset before PTS in order to avoid DTS bigger than PTS. We now use
a FIFO queue to store all PTS and assign it to DTS by an offset.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6913>
2024-05-23 16:24:13 +01:00
Seungha Yang
9a9650aeb2 cudamemory: Fix offset of subsampled planar formats
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6910>
2024-05-23 13:52:28 +01:00
Sebastian Dröge
620d5cb5d6 av1enc: Use 1/90000 as timebase and don't use the framerate at all
This mirrors the behaviour in vp8enc / vp9enc and is generally more
useful than using any framerate from the caps as it provides some degree
of accuracy if the stream doesn't have timestamps perfectly according to
the framerate.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6909>
2024-05-23 11:10:14 +00:00
Sebastian Dröge
afe74a0181 av1enc: Fix last timestamp tracking so it actually works
This behaves exactly the same as in vp8enc / vp9enc now.

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

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6909>
2024-05-23 11:10:14 +00:00
Sebastian Dröge
36a2eb0f03 gtk: Fail initialization of the sink if GTK4 is already initialized in the same process
Initializing GTK3 and GTK4 in the same process does not work and is not
supported.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6905>
2024-05-23 10:30:47 +01:00
Piotr Brzeziński
cdaf50de8f osxaudio: Avoid using private APIs on iOS
Turns out AudioConvertHostTimeToNanos and AudioGetCurrentHostTime are macOS-only APIs, which prevents apps using
GStreamer on iOS from being accepted into App Store.

This commit replaces those functions with a manual version of what they do - mach_absolute_time() for the current time,
and data from mach_timebase_info() at the beginning to convert host timestamps to nanoseconds.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6899>
2024-05-22 11:31:32 +01:00
Jordan Petridis
47afb4564b tests/check: Avoid using "bool" for the variable name
Glib 2.82 will be aliasing [1] TRUE and FALSE to the C99
definitions, which means it will be including stdbool.h

As such, having variables named "bool" causes issues
since it conflicts with the symbol defined in stdbool.h

[1] https://gitlab.gnome.org/GNOME/glib/-/merge_requests/4001

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6896>
2024-05-22 00:18:51 +01:00
Joshua Breeden
d5f3b77e50 videotestsrc: add mutex around cache buffer to prevent race condition
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6889>
2024-05-21 14:48:14 +01:00
Seungha Yang
1d2a0d75a0 filesrc: Don't abort on _get_osfhandle()
_get_osfhandle() expects valid fd and CRT will abort program
if given paramerter is invalid. The fd can be invalidated
in various way, file was deleted by other process after
we open a file. To avoid it, our own exception
handler must be installed so that _get_osfhandle() can return
INVALID_HANDLE_VALUE if fd is invalid.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6879>
2024-05-20 11:02:44 +01:00
Brad Reitmeyer
7f94a1e3b2 nvcodec: Accept progressive-high profiles for h264
Videos using progressive-high used to work on 1.16 before the parser added progressive-high. It looks like partial
support was added to nvcodec in https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1634
but accidentally ommited gstnvh264dec

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6873>
2024-05-17 13:14:23 +01:00
Seungha Yang
329ba08665 decodebin3: Fix caps and stream leaks
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6866>
2024-05-16 12:49:16 +01:00
Sebastian Dröge
063efae0be mpegtsmux: Allow pads to have no caps until they receive their first buffer
If the muxer times out because of the latency deadline it can happen
that some pads have no caps yet. In that case skip creation of streams
for these pads and create updated section tables once the first buffer
arrives later.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6859>
2024-05-15 20:31:36 +01:00
Sebastian Dröge
24be7b5c58 mpegtsmux: Correctly time out and mux anyway in live pipelines
This makes sure that for sparse streams (KLV, DVB subtitles, ...) the
muxer does not wait until the next buffer is available for them but
times out on the latency deadline and outputs data.

For non-live pipelines it will still be necessary for upstream to
correctly produce gap events for sparse streams.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6859>
2024-05-15 20:31:36 +01:00
Alexander Slobodeniuk
3b595479f9 systemclock: fix usage of __STDC_NO_ATOMICS__
__STDC_NO_ATOMICS doesn't seem to exist. In fact the only compiler
I've found that sets any of those is msvc, but it sets
__STDC_NO_ATOMICS__, not __STDC_NO_ATOMICS.

__STDC_NO_ATOMICS__ is the one documented by C11 standard.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6856>
2024-05-15 15:09:34 +01:00
Edward Hervey
765f8767ef avvidec: Fix dropping wrong "ghost" frames
This fixes the code regarding dropping "ghost frames", that is to say input
frames which ended up not producing any decoded frame.

The iteration itself makes sense.. but it was stopping at the "input" frame and
not the decoded frame we just got back.

When dealing with I-frame codecs, ffmpeg will decode frames in separate frames,
so there is no guarantee that they are decoding in order.

Fixes playback issues with such codecs

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6845>
2024-05-14 13:59:35 +01:00
Seungha Yang
38cbc51822 nvencoder: Fix maximum QP value setting
Fixing typo

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6832>
2024-05-12 23:53:10 +01:00
Sebastian Dröge
8e3b2121bb audioconvert: Add test for 96 channel conversion
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6828>
2024-05-12 11:06:15 +01:00
Sebastian Dröge
d2e8b4db07 level: Don't post a message on EOS without a valid audio info
If EOS is received before caps, e.g. because of an error, then rate and
number of channels would be 0 and some divisions by zero would happen.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6828>
2024-05-12 11:06:15 +01:00
Sebastian Dröge
d05a8516a7 audioconvert: Support converting >64 channels
There's nothing requiring <= 64 channels except for getting the reorder
map and creating a channel mixing matrix, but those won't be possible to
call anyway as channel positions can only express up to 64 channels.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6828>
2024-05-12 11:06:15 +01:00
Robert Mader
e869185287 v4l2codecs: decoder: Reorder caps to prefer DMA_DRM ones
Certain V4L2 fourccs don't (yet) have DRM counter parts, in which case
we can't create DMA_DRM caps for them. This is usually the case for
specific tilings, which are represented as modifiers for DMA formats.

While using these tilings is generally preferable - because of e.g.
lower memory usage - it can result in additional conversion steps when
interacting with DMA based APIs such as GL, Vulkan or KMS. In such cases
using a DMA compatible format usually ends up being the better option.

Before the addition of DMA_DRM caps, this was what playbin3 ended up
requesting in various cases - e.g. prefering NV12 over NV12_4L4 - but
the addition of DMA_DRM caps seems to confuse the selection logic.

As a simple and quite robust solution, assume that peers supporting
DMA_DRM caps always prefer these and reorder the caps accordingly.

In the future we plan to have a translation layer for cases where
there is a matching fourcc+modifier pair for a V4L2 fourcc, ensuring
optimal results.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6824>
2024-05-09 23:46:16 +01:00
Sebastian Dröge
fb8e2c60a2 play: Mention that gst_play_new() also initialized GStreamer
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6821>
2024-05-09 12:02:06 +01:00
Sebastian Dröge
f67559716e play: Initialize debug category and error quark in class_init
Doing it in gst_play_new() means that bindings that directly call
g_object_new() with the GType wouldn't end up initializing both.
This affects at least the Python and GJS bindings.

gst_init() is nonetheless only called from gst_play_new() once because
calling it from class_init would likely lead to problems as that's
called from somewhere in the middle of GObject.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6821>
2024-05-09 12:02:06 +01:00