Commit graph

116592 commits

Author SHA1 Message Date
Itamar Marom b8730bc98e splitmuxsink: Fix docs support version
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4138>
2023-03-09 15:08:19 +02:00
Matthew Waters 22229d9546 cea708overlay: fix HCR interpretation
An unsigned counter with a for (i = end; i >= 0; i--), can be optimized to
infinite loop as an unsigned value will always be >= 0.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4133>
2023-03-09 14:38:13 +11:00
Seungha Yang ad30fb87c2 h264parse: Validate VUI framerate
A few streams contain invalid/wrong framerate in VUI. Do validate
it based on the spec and ignore invalid VUI framerate values.

Fixes: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/1753
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4127>
2023-03-08 11:59:52 +00:00
Matthew Waters be72fbc334 cccombiner: fix output-padding=false for a cea608 field 1 only stream
If we have data that needs outputting but we have to output padding to
meet the alternating field requirements of cea608, then output that
padding anyway.

Also includes a test

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4124>
2023-03-08 11:11:05 +00:00
Mathieu Duponchelle 2eab37f231 ccconverter: implement field conversion of CEA 608 control codes
As specified in EIA/CEA-608-B section 8.4:

When closed captioning is used on line 21, field 2, it shall conform
to all of the applicable specifications and recommended practices as
defined for field 1 services with the following differences:

a) The non-printing character of the miscellaneous control-character pairs
  that fall in the range of 14h, 20h to 14h, 2Fh in field 1, shall be replaced
  with 15h, 20h to 15h, 2Fh when used in field 2.
b) The non-printing character of the miscellaneous control-character pairs
  that fall in the range of 1Ch, 20h to 1Ch, 2Fh in field 1, shall be replaced
  with 1Dh, 20h to 1Dh, 2Fh when used in field 2.

This means simply switching the "field" field in the caps isn't enough for
converting raw 608 from one field to another, some control codes also
need to be amended.

+ Adds simple test

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4126>
2023-03-08 10:13:59 +00:00
Edward Hervey b4cadf35bd uridecodebin3: Ensure atomic urisourcebin state change
When dynamically adding and synchronizing the state of urisourcebin, we need to
ensure that no-one else attempts to change the state in case of failures

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

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4125>
2023-03-08 09:29:57 +00:00
Matt Feury 224030ff0c rtspsrc: Consider "451: Parameter Not Understood" when handling broken control urls
similar to https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3854

it seems that some implementations return this when
the server does not implement URL handling correctly

this fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/2334

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4123>
2023-03-07 10:32:32 -05:00
Seungha Yang b6e45d0de8 vavp8dec: Fix return type of decode_picture()
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4113>
2023-03-06 13:39:20 +00:00
Seungha Yang c5ae00f58c vajpegdec: Hide gst_jpeg_decoder_get_type() symbol
It's not a public symbol yet

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4113>
2023-03-06 13:39:20 +00:00
Seungha Yang fbf143b0fd vabaseenc: Fix return type of encode_frame vfunc
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4113>
2023-03-06 13:39:19 +00:00
Seungha Yang 2f98234287 va: Fix struct empty initialization syntax
"struct Foo bar; bar = {};" is not a valid syntax. Also remove use
of __typeof__ which is GCC specific

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4113>
2023-03-06 13:39:19 +00:00
Seungha Yang 837d8d1b20 h265timestamper: Use gst_h265_parser_parse_decoder_config_record()
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2759>
2023-03-06 12:50:41 +00:00
Seungha Yang b5fb709be7 qsvh265dec: Use gst_h265_parser_parse_decoder_config_record()
Stop duplicating code and use newly added parsing method instead

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2759>
2023-03-06 12:50:41 +00:00
Seungha Yang bc8a862e20 h265decoder: Use gst_h265_parser_parse_decoder_config_record()
Stop duplicating code and use newly added parsing method instead

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2759>
2023-03-06 12:50:41 +00:00
Seungha Yang 8c596aeb5b h265parse: Use gst_h265_parser_parse_decoder_config_record()
Stop duplicating code and use newly added parsing method instead

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2759>
2023-03-06 12:50:41 +00:00
Seungha Yang 5227b3c9a6 h265parser: Add an API for HEVCDecoderConfigurationRecord parsing
Add a method for HEVC configuration data parsing

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2759>
2023-03-06 12:50:41 +00:00
Yinhang Liu 89a6ce105b msdkenc: Fix scale ratio for frame duration
For the calculation of frame duration, the numerator
should be FrameRateExtD, and the denominator should be
FrameRateExtN.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4119>
2023-03-06 13:57:01 +08:00
Seungha Yang 76d1257cd3 d3d11memory: Remove GstPoll from GstD3D11PoolAllocator
GstBufferPool implementation was referenced for this GstD3D11PoolAllocator,
for example GstAtomicQueue, various atomic operations, and GstPoll ones.
However, such combination seems to be almost pointless
since gst_poll_{read,write}_control() takes mutex and also
GstPoll uses Win32 event handle internally.
Use simple SRWLOCK and CONDITION_VARIABLE instead, and don't make things
complicated/inefficient.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2887>
2023-03-05 22:51:24 +09:00
Piotr Brzeziński 3c739b9b76 vtdec: Correctly retrieve reorder queue length from SPS
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4057>
2023-03-03 19:26:11 +00:00
Seungha Yang 40300172ad adaptivedemux2: Fix MSVC build error
downloadrequest.c(497): error C4013: 'atoi' undefined; assuming extern returning int

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4107>
2023-03-03 23:15:42 +09:00
Mathieu Duponchelle af714091aa cea608mux: don't consume input buffers too early
CCBuffer has no notion of time, we need to push caption pairs in
it when it is ready for consumption and no earlier.

Also perform comparisons with our output running time, not the raw
output PTS.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4103>
2023-03-03 13:16:24 +00:00
Chao Guo dfa8661334 bin: Fix bin won't post async done message to parent while nothing pending in state changing
When we run Cheese 41.1 on our imx platform, Cheese preview freeze
at first frame.

During pipeline state changing from NULL to PLAYING, if there are
both elements that state change asynchronously and state change
with no preroll in the bin, the element inside may send ASYNC_DONE
message to it, while the bin's pending state is VOID_PENDING.

In this case, the bin will not post ASYNC_DONE message to parent
bin, which makes parent bin thinks that there are still elements
in it that haven't completed state changing, causing the pipeline
freeze in an intermediate state.

This commit modifies the bin_handle_async_done() function. When the
bin, whose pending state is VOIDING_PENDING, receives the ASYNC_DONE
message, it will also post this message to its parent bin.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3490>
2023-03-03 12:22:08 +00:00
Alicia Boya García 0f8785cbc6 basesink: Support position queries after non-resetting flushes
A flush is resetting or not depending on the reset_time argument in the
FLUSH_STOP event is set.

Resetting flushes reset the running time to zero and clear any existing
segment. These are the kind of flushes used by flushing seeks, and by far the
most common. Non-resetting flushes are much more niche, used for instance for
quality changes in adaptivedemux2 and MediaSource Extensions in WebKit.

A key difference between the seek use case and the quality change use case is
that the latter is much more removed from the player. Seeks generally occur
because an user request it, whereas quality changes can be automatic.

Currently, there are three notable cases where position queries fail:

(a) before pre-roll, as there is no segment yet. This is one is understandable,
as for at least some time before pre-roll, we cannot know if a media stream
would start at 0 or any other position, or the duration of the stream for that
matter.

(b) after a resetting flush caused by a seek. This kind of flush resets the
segment, so it's not surprising position queries fail. This is inconvenient for
applications, as it means they always need to handle position reporting (e.g.
in UI) separately every time they request a seek, e.g. by caching the seek
target and using it when the position query fail. I'm not fond of this
behavior, as it's unintuitive and makes GStreamer harder to use, but at this
point could be difficult to change and it's not within the scope of this
proposal.

(c) after a non-resetting flush, e.g. caused by a quality change. The segment
is not reset in this case. Position queries work until a FLUSH_STOP is sent.
Querying position after a FLUSH_START but before a FLUSH_STOP works, and
returns the position the sink was at the moment the FLUSH_START was received.
**This in fact the only reliable way (short of adding probes to the sink
element) to get this position**, as FLUSH_START receival is asynchronous with
playback.

In the case (c), as of currently, position queries fail once the FLUSH_STOP is
received. But unlike in (b), the application has no position to fall back to,
as the FLUSH_START was initiated by elements inside the pipeline that are in a
lower layer of abstraction. Specific applications that have control of both the
player and the internal element doing the flushing -- such as WebKit -- can
still work around this problem through layer violations (lucky!), but this
still puts in question this behavior in GStreamer.

This patch fixes this case by amending the position query handler of basesink,
which was previously erroneously returning early with "wrong state", even
though the flush occurs in PAUSED or PLAYING.

A unit test checking this behavior has also been added.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3471>
2023-03-03 10:16:25 +00:00
Mathieu Duponchelle d55c5a3eec cccombiner: fix s334-1a in place conversion
The code wants to prepend one byte to every byte pair. It correctly did
so by working backwards pair-wise, but then didn't work backwards
instead of each individual pair / future triplet, overwriting
information before attempting to read it.

The code also failed to update the len pointer after prepending.

This fixes both issues.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4100>
2023-03-02 22:52:39 +00:00
Thibault Saunier 44ddd17884 qroverlay: Fix documentation
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4102>
2023-03-02 18:39:40 +00:00
Alicia Boya García c1f4bd5a3f qtdemux: Add MSE-style flush
The abort() method of SourceBuffer in Media Source Extensions is
expected to flush the demuxer and discard the current fragment,
if any. The configuration of tracks, if any, should be preserved.

qtdemux has different behavior for flush events depending on the
context.

This patch activates the intended behaviour only for streams of the
VARIANT_MSE_BYTESTREAM type, conformant to the ISO BMFF Bytestream
specification[1]. This flush behaviour is the same as the one
already in use for adaptivedemux sources.

[1] https://www.w3.org/TR/mse-byte-stream-format-isobmff/

https://bugzilla.gnome.org/show_bug.cgi?id=795424

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4101>
2023-03-02 17:54:41 +00:00
Jan Alexander Steffens (heftig) c533010e20 srt: Use g_cancellable_get_fd for poll cancellation
Removing sockets from the epoll for cancellation is unreliable and might
not be thread-safe. Rather, have SRT watch a FD from the cancellable if
available. Keep the cancellable cancelled while we're not open.

Use the regular single-socket `sock` and `poll_id` fields for the
listening thread instead of duplicating them.

Before polling we need to check the socket state. SRT closes broken
sockets by itself and when the epoll contains our cancellation FD it can
no longer be empty, which was an error before.

Treat more failures in the read and write operations as an opportunity
to try a reconnect.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4087>
2023-03-02 15:39:25 +00:00
Jan Alexander Steffens (heftig) 3f75836822 srt: Move cancellable into srtobject
Should produce no difference in behavior.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4087>
2023-03-02 15:39:25 +00:00
Jan Alexander Steffens (heftig) 4cede7c472 srt: Set default poll-timeout to one second
Removing a socket from the poll is not a guaranteed unlock. If we let
the poll continue indefinitely, then e.g. an unfed srtsrc can deadlock
when we try to shut it down.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4087>
2023-03-02 15:39:25 +00:00
Jan Alexander Steffens (heftig) d2202f516a srt: Consider EPOLLEMPTY an error when not unlocking
Seems that SRT can remove the socket from the poll by itself when the
connection gets closed. Consider this an error condition and ensure we
only "abort successfully" when we're actually trying to unlock.

Needs more investigation but this is enough to prevent the element from
getting stuck not reporting an error.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4087>
2023-03-02 15:39:25 +00:00
Vivia Nikolaidou cf5b659bc6 inputselector: Avoid deadlock when shutting down
Transition from PLAYING to PAUSED unschedules any pending clock wait,
but there was no guard that prevented another input buffer then waiting
again while in PAUSED before dataflow stops. Use a new `playing` flag to
avoid this, and exit the chain function if instead of playing we're now
flushing. Basically the same as the clocksync element.

Closes https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/1772

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4098>
2023-03-02 16:52:35 +02:00
Mengkejiergeli Ba eab15c8659 h265parse: Fix to check returned value
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3968>
2023-03-02 11:00:20 +00:00
Yinhang Liu 5c47002d99 msdkvpp: correct the fixated caps for src pad
In src pad, fixate othercaps instead of the NULL result caps

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3999>
2023-03-02 07:21:10 +00:00
Nicolas Beland 8e77f89e86 alsasink: Fix stall when going from PLAYING to NULL (stucked at PAUSED) with uac1 gadget
This happened with a uac1 gadget which for some reason does not behave nicely.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4095>
2023-03-02 03:41:25 +00:00
Thibault Saunier accbcabeea validate: Protect init function with a recursive mutex
In tests in the rust bindings we end up with 2 thread initializing
concurrently, and it should not be a problem, -validate should be MT
safe.

Using a recursive mutex as we might recursively init for some reason
and we are not on the hot path here in any case.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4089>
2023-03-02 02:50:45 +00:00
Thibault Saunier 12c4893131 validate:scenario: sink refs when building
Scenarios are no owned by anyone, even if they are GstObjects

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4089>
2023-03-02 02:50:45 +00:00
Mathieu Duponchelle 84d6323610 closedcaption: implement cea608muxer element
Wrapper aggregator around the CCBuffer internal utility, this
version only supports aggregating CC1 and CC3 608 streams together into
the s334-1a format.

The element exposes CC1 and CC3 request pads.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4084>
2023-03-02 00:27:47 +00:00
Jan Schmidt 47e97251af avfvideosrc: Fix description and trailing whitespace
Minor fix to mention that the element is also useful on MacOS,
and remove some trailing whitespace

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4083>
2023-03-01 20:05:32 +00:00
Jan Schmidt 855e86f6a2 avfvideosrc: Don't wait on main thread for permissions request
Recursively invoking the NSMainLoop can cause crashes in
applications that don't expect it. Instead of waiting for
permission to be granted, move the wait later - until we
actually need device permissions when starting the capture
session. That moves the wait into the streaming thread
instead of the application thread that's setting the pipeline
state to READY.

Instead of a manual state change implementation to open
and close the device, use the basesrc start/stop methods that
are intended for the purpose.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4083>
2023-03-01 20:05:32 +00:00
Seungha Yang 95ca40c4ab d3d11screencapturesrc: Use keyed mutex instead of fence
D3D11 runtime might not support ID3D11Fence, and if so GstD3D11Fence
abstraction will use ID3D11Query instead. However, since the ID3D11Query
requires busy waiting, keyed mutex is better approach.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4094>
2023-03-02 03:03:58 +09:00
Seungha Yang ac869214ad d3d11testsrc: Use keyed mutex for rendering patterns
D2D operations would not flush D3D commands. Use keyed mutex
to synchronize between them. Note that previous code was wrong
(Flush should be called inside of BeginDraw/EndDraw calls)

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4081>
2023-03-01 14:13:14 +00:00
Seungha Yang 69b2e1565c d3d11memory: Add support for keyed mutex
Non-zero mutex key held by application is not considered for now.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4081>
2023-03-01 14:13:14 +00:00
Frank Dana 2c265df99e python: Use arch-specific install dir
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3004>
2023-03-01 12:40:07 +00:00
Víctor Manuel Jáquez Leal 235f29ec84 jpegparse: demote and promote log messages level
Before those levels where when implementing the plugin. Now these
levels are for reporting issues from users.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4039>
2023-03-01 11:42:44 +00:00
He Junyan d8feddcc0c jpegparse: reset parse state when the SOI is not the first marker
There may be garbage or some bits before a SOI comes in some problematic
mjpeg streams. For example, some network error may cause the EOI marker
of the previous frame lost, and when the new frame's SOI comes, we still
use the state of the last frame, which will generate errors.

For this kind of frames without EOI, if that frame already has some data
(the SOS segment is detected), we still push it as a frame with CORRUPTED
flag set. But if not, we just discard all the data before the new SOI.

Co-Authored-By: Víctor Jáquez <vjaquez@igalia.com>
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4039>
2023-03-01 11:42:44 +00:00
Carlos Falgueras García dafc024ed0 gldisplay: Remove unused code
The code related with environment variable `GST_GL_PLATFORM` is unused
since commit 33c60bdbf9.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4090>
2023-03-01 08:23:37 +00:00
Shengqi Yu 83576690b6 matroskademux: Consider TrackUID==0 a warning and not handle it as error
some special files whose trackUID is 0 can be played on the other
player. But it cannot be played in GStreamer, because trackUID 0 will be
treated as an error in matroskademux.

So, it makes sense to only consider trackUID==0 a warning and not handle
it as error

https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/1821

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4036>
2023-03-01 07:38:24 +00:00
Mengkejiergeli Ba 28e2eccf55 msdkenc: Set pts at handle_frame
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3998>
2023-03-01 01:42:50 +00:00
Seungha Yang 8d7cab1f0d nvcodec: Remove stateful decoders
Use H.264, H.265, VP8, and VP9 stateless decoders unconditionally
and don't register its stateful counterpart

Fixes: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/1768
Fixes: https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/issues/1621
Fixes: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/1432
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4015>
2023-02-28 18:42:17 +00:00
Mathieu Duponchelle f3e16deaad aggregator: improve parsing in create_new_pad
The previous implementation was a bit primitive, assuming the subclass
had registered a template name starting with sink_ . Instead make
the effort of parsing the actual template name, and use that to generate
the final pad name.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4032>
2023-02-28 17:43:57 +00:00