platform/upstream/gstreamer.git
3 years agova: Refactor _format_changed() to _config_is_equal().
Víctor Manuel Jáquez Leal [Sat, 17 Jul 2021 18:45:48 +0000 (20:45 +0200)]
va: Refactor _format_changed() to _config_is_equal().

Change gst_va_decoder_format_changed() to
gst_va_decoder_config_is_equal(), which is more similar with other
GStreamer API.

The function call is replaced but it has to be negated because the
return value is the opposite.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2417>

3 years agova: Refactor _change_resolution() to _update_frame_size().
Víctor Manuel Jáquez Leal [Sat, 17 Jul 2021 18:37:52 +0000 (20:37 +0200)]
va: Refactor _change_resolution() to _update_frame_size().

Rename gst_va_decoder_change_resolution() to
gst_va_decoder_update_frame_size() which resembles
gst_va_decoder_set_frame_size().

Also added a comment to clarify the function use and makes more
specific the error message.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2417>

3 years agova: Refactor _set_format() to _set_frame_size().
Víctor Manuel Jáquez Leal [Sat, 17 Jul 2021 18:29:45 +0000 (20:29 +0200)]
va: Refactor _set_format() to _set_frame_size().

Renamed gst_va_decoder_set_format() to
gst_va_decoder_set_frame_size_with_surfaces() which resembles better
the passed parameters. Internally it creates the vaContext.

Added gst_va_decoder_set_frame_size() which is an alias of
gst_va_decoder_set_frame_size_with_surfaces() without surfaces. This
is the function which replaces gst_va_decoder_set_format() where
used.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2417>

3 years agocodecs: h265decoder: Fix a typo of NumPocTotalCurr when process ref pic list.
He Junyan [Fri, 16 Jul 2021 07:24:11 +0000 (15:24 +0800)]
codecs: h265decoder: Fix a typo of NumPocTotalCurr when process ref pic list.

We should use the NumPocTotalCurr value stored in decoder, which is a calculated
valid value, rather than use the invalid value in the slice header. Most of the
time, the NumPocTotalCurr is 0 and make the tmp_refs a very short length, and
causes the decoder's wrong result.
By the way, the NumPocTotalCurr is not the correct name specified in H265 spec,
its name should be NumPicTotalCurr. We change it to the correct name.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2414>

3 years agova: h265dec: Do not add non reference frames into ref list.
He Junyan [Fri, 16 Jul 2021 05:21:11 +0000 (13:21 +0800)]
va: h265dec: Do not add non reference frames into ref list.

The VA's ReferenceFrames should only contain the reference frame, we
should not add the non reference frames into this list.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2414>

3 years agotests: Enable closedcaption test on Windows
Seungha Yang [Thu, 15 Jul 2021 10:44:21 +0000 (19:44 +0900)]
tests: Enable closedcaption test on Windows

... if closedcaption plugin is available

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2411>

3 years agomfvideoenc: Disable RGB format support
Seungha Yang [Thu, 15 Jul 2021 07:44:18 +0000 (16:44 +0900)]
mfvideoenc: Disable RGB format support

Some GPUs support BGRA format and it will be converted to subsampled
YUV format by GPU internally. Disable this implicit conversion
since the conversion parameters such as input/output colorimetry
are not exposed nor it's written in bitstream (e.g., VUI).
We prefer explicit conversion via our conversion elements.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2410>

3 years agova: h265dec: Fix a temp var overflow bug when write pred weight table.
He Junyan [Thu, 15 Jul 2021 13:32:54 +0000 (21:32 +0800)]
va: h265dec: Fix a temp var overflow bug when write pred weight table.

The temp guint8 var of delta_chroma_offset_l0 and delta_chroma_offset_l1
can not cover the full range of delta_chroma_weight_l0/1 in the slice
header. When overflow happens, the decoder result is wrong.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2412>

3 years agodash: Store entire ContentProtection node in protection event data
Philippe Normand [Mon, 12 Jul 2021 11:08:20 +0000 (12:08 +0100)]
dash: Store entire ContentProtection node in protection event data

Some manifests use the ContentProtection node to store additional information
such as the license server url. Our MPD parser used to process the
ContentProtection node, extracting Playready PSSH boxes. However for other DRM
systems, only the `value` attribute was passed down to the protection event, so
for example, Widevine data was not parsed at all and "Widevine" was passed to
the event, which is not very useful for decryptors that require a PSSH init
data.

Parsing should now be done by decryptors which will receive the entire
ContentProtection XML node as a string. This gives more "freedom" to the
decryptor which can then detect and parse custom nodes as well.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2400>

3 years agova: vp9dec: We need to check the resolution changes for every frame.
He Junyan [Wed, 14 Jul 2021 14:36:52 +0000 (22:36 +0800)]
va: vp9dec: We need to check the resolution changes for every frame.

The VP9 streams have the ability to change the resolution dynamically
at any time point. It does not send ad KEY frame before change the
resolution, even the INTER frame can change the resolution immediately.
So we need to check the resolution change for each frame and do the
re-negiotiation if needed.

Some insaned stream may play in resolution A first and then dynamically
changes to B, and after 1 or 2 frames, it use a show_existing_frame to
repeat the old frame of resolution A before. So, not only new_picture(),
but also duplicate_picture() need to check this.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2407>

3 years agova: vp9dec: Do not re-create context for dynamical resolution change.
He Junyan [Wed, 14 Jul 2021 06:43:51 +0000 (14:43 +0800)]
va: vp9dec: Do not re-create context for dynamical resolution change.

The driver for VP9 should have the ability to handle the dynamical resolution
changes. So if only the resolution changes, we should not re-create the config
and context in negotiation.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2407>

3 years agova: decoder: Add helper functions to get and change the resolution.
He Junyan [Wed, 14 Jul 2021 06:27:34 +0000 (14:27 +0800)]
va: decoder: Add helper functions to get and change the resolution.

Some codecs such as VP9, its config and context have the ability to
dynamically. When we only change the width and height, no need to
re-create the config and context. The helper function can just change
the resolution without re-creating config and context.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2407>

3 years agompegtsmux: Quieten "missed PCR" warnings in VBR mode.
Jan Schmidt [Fri, 28 May 2021 20:03:26 +0000 (06:03 +1000)]
mpegtsmux: Quieten "missed PCR" warnings in VBR mode.

When the muxer is operating in VBR mode, it's kind of expected
for now that we might not put the PCR in exactly the right place,
because the muxer doesn't schedule packets that way. In that case
don't warn constantly about the PCR ending up a few ms off target.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2295>

3 years agortmp2src: workaround a GLib race when destroying a GMainContext/GSource
Matthew Waters [Tue, 13 Jul 2021 11:38:10 +0000 (21:38 +1000)]
rtmp2src: workaround a GLib race when destroying a GMainContext/GSource

https://gitlab.gnome.org/GNOME/glib/-/issues/803

Basically, if destruction of a GSource and its associated GMainContext are
not synchronised, Then the GSource destruction can access freed
GMainContext resources and cause a crash.  This is not super common but
can happen.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2405>

3 years agocodecs: h265decoder: Always free messages while parsing SEI
Mads Buvik Sandvei [Thu, 8 Jul 2021 12:25:23 +0000 (14:25 +0200)]
codecs: h265decoder: Always free messages while parsing SEI

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2390>

3 years agovp9parse: Skip parsing decode-only frame
Seungha Yang [Wed, 14 Jul 2021 10:39:11 +0000 (19:39 +0900)]
vp9parse: Skip parsing decode-only frame

Decode-only frame (i.e., show_existing_frame == 1) doesn't hold
any valid information apart from the index of frame to be duplicated.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2408>

3 years agowpesrcbin: Use gst_buffer_new_memdup()
Philippe Normand [Tue, 13 Jul 2021 15:55:30 +0000 (16:55 +0100)]
wpesrcbin: Use gst_buffer_new_memdup()

g_memdup() is deprecated.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2406>

3 years agocodecs: vp9statefulparser: not init segmentation_abs_or_delta_update.
He Junyan [Mon, 12 Jul 2021 15:25:02 +0000 (23:25 +0800)]
codecs: vp9statefulparser: not init segmentation_abs_or_delta_update.

The segmentation_abs_or_delta_update is a stateful var, it should not
be inited every time when parsing the segmentation.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2403>

3 years agotests: wasapi2: Add more device reuse cases
Seungha Yang [Mon, 12 Jul 2021 14:21:29 +0000 (23:21 +0900)]
tests: wasapi2: Add more device reuse cases

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2402>

3 years agowasapi2ringbuffer: Close IAudioClient on GstAudioRingBuffer::release
Seungha Yang [Mon, 12 Jul 2021 13:17:22 +0000 (22:17 +0900)]
wasapi2ringbuffer: Close IAudioClient on GstAudioRingBuffer::release

IAudioClient interface is not reusable once it's initialized.
So we should close the handle and reopen it.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2402>

3 years agowasapi2ringbuffer: Run gst-indent
Seungha Yang [Mon, 12 Jul 2021 18:35:22 +0000 (03:35 +0900)]
wasapi2ringbuffer: Run gst-indent

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2402>

3 years agocodecparsers: av1: fix underflow in last_frame_idx
Daniel Almeida [Mon, 12 Jul 2021 12:01:06 +0000 (09:01 -0300)]
codecparsers: av1: fix underflow in last_frame_idx

The spec mandates this field be parsed using unsigned arithmetic. Nevertheless,
av1parser will use -1 apparently as an uninitialized value in
gst_av1_parse_frame_header. This immediately underflows last_frame_idx
though, since its type was defined as guint8. Fix this by converting to gint8.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2401>

3 years agowasapi: fix reinit of audioclient in prepare()
Jakub Janků [Thu, 18 Mar 2021 09:55:58 +0000 (10:55 +0100)]
wasapi: fix reinit of audioclient in prepare()

When the sink goes from PLAYING to READY and then back to PLAYING,
the initialization of the audioclient in prepare() fails with the
error AUDCLNT_E_ALREADY_INITIALIZED. As a result, the playback
stops.

To fix this, we need to drop the AudioClient in unprepare() and
grab a new one in prepare() to be able to initialize it again
with the new buffer spec.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2096>

3 years agowasapi: split gst_wasapi_util_get_device_client()
Jakub Janků [Wed, 17 Mar 2021 21:45:57 +0000 (22:45 +0100)]
wasapi: split gst_wasapi_util_get_device_client()

The functionality now resides in
gst_wasapi_util_get_device() and
gst_wasapi_util_get_audio_client().

This is a preparatory patch. It will be used in the following
patch to init/deinit the AudioClient separately from the device.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2096>

3 years agotests: wasapi: check PLAYING -> READY -> PLAYING
Jakub Janků [Sun, 11 Jul 2021 16:14:46 +0000 (18:14 +0200)]
tests: wasapi: check PLAYING -> READY -> PLAYING

Such sequence of state changes is valid and no error should happen.
At the moment, the test fails. Following patches aim to fix it.

Partially based on the code in tests/check/elements/wasapi2.c

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2096>

3 years agoplay: Emit correct signal
Guido Günther [Fri, 9 Jul 2021 12:55:43 +0000 (14:55 +0200)]
play: Emit correct signal

SIGNAL_MEDIA_INFO_UPDATED should be emitted on media info changes,
not SIGNAL_VIDEO_DIMENSIONS_CHANGED.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2398>

3 years agovulkan: Declare missing auto-pointer cleanup functions.
Víctor Manuel Jáquez Leal [Fri, 5 Mar 2021 08:18:15 +0000 (09:18 +0100)]
vulkan: Declare missing auto-pointer cleanup functions.

Also removed a couple guards since, given the glib dependency, they
are set.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2396>

3 years agovulkan: filter: Use filter variable name for choosing queue.
Víctor Manuel Jáquez Leal [Wed, 3 Mar 2021 11:54:20 +0000 (12:54 +0100)]
vulkan: filter: Use filter variable name for choosing queue.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2396>

3 years agovulkansink: Fix element metadata.
Víctor Manuel Jáquez Leal [Wed, 3 Mar 2021 07:50:13 +0000 (08:50 +0100)]
vulkansink: Fix element metadata.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2396>

3 years agomsdkvpp: use NV12 as default format on srcpad
Yinhang Liu [Fri, 25 Jun 2021 01:19:25 +0000 (09:19 +0800)]
msdkvpp: use NV12 as default format on srcpad

By default, sinkpad is NV12 format and srcpad is BGRA format, the
different format will trigger an implicit format conversion in
msdkvpp, which will cause performance drop.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2394>

3 years agogst-libs/gst/wayland: handle display passing better
Dominique Martinet [Mon, 31 May 2021 23:40:17 +0000 (08:40 +0900)]
gst-libs/gst/wayland: handle display passing better

failure to pass a display in 'handle' would result in uninitialized value
being returned, which would often segfault later down the road when trying
to initialize gstreamer context with it.
Check the return value of gst_structure_get() to make sure we return valid
data.

Furthermore, the gstglimagesink in gst-plugins-base also has a similar
mechanism but uses 'display' as field name to pass the value; instead of
requiring the application to behave differently depending on what sink
was automatically detected just try to read both values here, with display
being the new default.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2292>

3 years agodashdemux: Log protection events on corresponding pad
Philippe Normand [Thu, 8 Jul 2021 13:46:11 +0000 (14:46 +0100)]
dashdemux: Log protection events on corresponding pad

GstDashDemuxStream is not a GstObject, so use its pad as associated object when
emitting log messages.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2389>

3 years agova: vpp: Improve the color properties setting.
He Junyan [Thu, 8 Jul 2021 08:49:27 +0000 (16:49 +0800)]
va: vpp: Improve the color properties setting.

The current setting of color properties are not very correct and
we will get some kind of "unknown Color Standard for YUV format"
warnings printed out by drivers. The video-color already provides
some standard APIs for us, and we can use them directly.
We also change the logic to: Finding the exactly match or explicit
standard first. If not found, we continue to find the most similar
one.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2385>

3 years agomfvideosrc: Fix negotiation when interlace-mode is specified
Seungha Yang [Thu, 8 Jul 2021 10:03:06 +0000 (19:03 +0900)]
mfvideosrc: Fix negotiation when interlace-mode is specified

Given caps does not need to be strictly subset of device caps.
Allow accept it if device caps and requested caps can intersect

Fixes: https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/issues/1619
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2384>

3 years agocccombiner: mark field 0 as valid when generating padding CDP
Mathieu Duponchelle [Thu, 8 Jul 2021 00:24:18 +0000 (02:24 +0200)]
cccombiner: mark field 0 as valid when generating padding CDP

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2383>

3 years agomfvideobuffer: Don't error for unexpected Unlock/Unlock2D call
Seungha Yang [Tue, 6 Jul 2021 08:14:21 +0000 (17:14 +0900)]
mfvideobuffer: Don't error for unexpected Unlock/Unlock2D call

Some GPU vendor's MFT implementation calls IMFMediaBuffer::Unlock()
without previous IMFMediaBuffer::Lock() call. Which is obviously
driver bug but we can ignore the Unlock call.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2381>

3 years agodashsink: fix crash with no pad name for representation
Stéphane Cerveau [Wed, 30 Jun 2021 08:30:43 +0000 (10:30 +0200)]
dashsink: fix crash with no pad name for representation

if there is no pad name, the representation id
was NULL, causing a crash when writing the mpd file.

gst-launch-1.0 videotestsrc num-buffers=900 ! video/x-raw, width=800,
height=600, framerate=30/1 ! x264enc ! video/x-h264, profile=high !
dashsink

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2064>

3 years agodashsink: Add signals for allowing custom playlist/fragment
Stéphane Cerveau [Tue, 9 Mar 2021 10:40:43 +0000 (11:40 +0100)]
dashsink: Add signals for allowing custom playlist/fragment

Instead of always going through the file system API we allow the
application to modify the behaviour. For the playlist itself and
fragments, the application can provide a GOutputStream. In addition the
sink notifies the application whenever a fragment can be deleted.

Following the HLS change:
https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/918

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2064>

3 years agocodecs: h265dec: Disable the POC order warning for negative POC.
He Junyan [Tue, 6 Jul 2021 06:06:24 +0000 (14:06 +0800)]
codecs: h265dec: Disable the POC order warning for negative POC.

There may be leading frames after the IRAP frames, which has negative
POC. This kind of frames are allowed and they will be displayed before
the IRAP frame. So the warning should not be triggered for them. Init
the last_output_poc to G_MININT32 can avoid this.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2380>

3 years agocodecs: h264dec: Disable the POC order warning for negative POC.
He Junyan [Tue, 6 Jul 2021 05:38:16 +0000 (13:38 +0800)]
codecs: h264dec: Disable the POC order warning for negative POC.

There may be leading frames after the IDR frame, which has negative
POC. This kind of frames are allowed and they will be displayed before
the IDR frame. So the warning should not be triggered for them. Init
the last_output_poc to G_MININT32 can avoid this.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2380>

3 years agointerlace: Push the reconfigure event in the right direction
Jan Alexander Steffens (heftig) [Fri, 25 Jun 2021 13:57:03 +0000 (15:57 +0200)]
interlace: Push the reconfigure event in the right direction

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2361>

3 years agova: basedec: Fix some artifact when do the crop copy.
He Junyan [Mon, 5 Jul 2021 07:44:34 +0000 (15:44 +0800)]
va: basedec: Fix some artifact when do the crop copy.

The default video converter setting will add some artifact into
the picture for 10/12 bits conversion. This make the MD5 checksum
change from the original picture.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2379>

3 years agod3d11decoder: Enable zero-copy for Qualcomm
Seungha Yang [Sun, 4 Jul 2021 17:05:03 +0000 (02:05 +0900)]
d3d11decoder: Enable zero-copy for Qualcomm

Qualcomm GPU works fine with current implementation now.
Noticeable difference between when it was disabled and current
d3d11 implementation is that we now support GstD3D11Memory
pool, so there will be no more frequent re-binding decoder surface anymore.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2377>

3 years agomxfdemux: Check validity of interleaved File Package
Edward Hervey [Mon, 5 Jul 2021 05:42:39 +0000 (07:42 +0200)]
mxfdemux: Check validity of interleaved File Package

As specified by the S377 MXF core specification, if a file package has
interleaved content, then all tracks must be using the same Edit Rate

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2378>

3 years agod3d11vp9dec: Fix for incorrect use_prev_in_find_mv_refs setting
Seungha Yang [Sun, 4 Jul 2021 16:54:02 +0000 (01:54 +0900)]
d3d11vp9dec: Fix for incorrect use_prev_in_find_mv_refs setting

Set use_prev_in_find_mv_refs depending on context. The value seems
to be used by AMD and Qualcomm (Intel and NVIDIA doesn't make difference
as per test)

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2376>

3 years agogstmsdkvpp: add RGBP and BGRP in src pad
Haihao Xiang [Tue, 11 May 2021 06:07:14 +0000 (14:07 +0800)]
gstmsdkvpp: add RGBP and BGRP in src pad

It requires MFX version 2.4+

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2234>

3 years agomediafoundation: Port to IID_PPV_ARGS
Seungha Yang [Sat, 3 Jul 2021 15:36:27 +0000 (00:36 +0900)]
mediafoundation: Port to IID_PPV_ARGS

Make code short where possible

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2375>

3 years agomfaudioenc: Remove pointless enumerating for hardware audio encoder
Seungha Yang [Sat, 3 Jul 2021 15:24:09 +0000 (00:24 +0900)]
mfaudioenc: Remove pointless enumerating for hardware audio encoder

Hardware audio encoder can exist in theory, but it's untested
and we are not sure whether it can be preferred over software
implementation which is implemented by MS

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2375>

3 years agomediafoundation: Fix typos
Seungha Yang [Sat, 3 Jul 2021 14:12:08 +0000 (23:12 +0900)]
mediafoundation: Fix typos

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2375>

3 years agomediafoundation: Run gst-indent
Seungha Yang [Sat, 3 Jul 2021 13:56:48 +0000 (22:56 +0900)]
mediafoundation: Run gst-indent

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2375>

3 years agova: Consider the compatibility when we get_profile() for H265 decoder.
He Junyan [Sat, 26 Jun 2021 13:42:37 +0000 (21:42 +0800)]
va: Consider the compatibility when we get_profile() for H265 decoder.

Adding the compatile profiles when we decide the final profile used for decoding.
The final profile candidates include:
1. The profile directly specified by SPS, which is the exact one.
2. The compatile profiles decided by the upstream element such as the h265parse.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2322>

3 years agoh265parse: Add special profile case for profile_idc 0.
He Junyan [Sun, 27 Jun 2021 07:34:28 +0000 (15:34 +0800)]
h265parse: Add special profile case for profile_idc 0.

This is a work-around to identify some main profile streams having
wrong profile_idc. There are some wrongly encoded main profile streams
which doesn't have any of the profile_idc values mentioned in Annex-A,
instead, general_profile_idc has been set as zero and the
general_profile_compatibility_flag[general_profile_idc] is TRUE.
Assuming them as MAIN profile for now.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2322>

3 years agoh265parse: Map -intra profiles to non-intra compatible profiles.
He Junyan [Sat, 26 Jun 2021 07:11:47 +0000 (15:11 +0800)]
h265parse: Map -intra profiles to non-intra compatible profiles.

All the -intra profiles can map to non-intra profiles as compatible
profiles, except the monochrome case for main and main-10.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2322>

3 years agova: vp9dec: update segmentation and store the result.
He Junyan [Thu, 1 Jul 2021 11:27:28 +0000 (19:27 +0800)]
va: vp9dec: update segmentation and store the result.

The segmentation is stateful, its information may depend on the previous
segmentation setting. For example, if loop_filter_delta_enabled is TRUE,
the filter_level[GST_VP9_REF_FRAME_INTRA][1] should inherit the previous
frame's value and can not be calculated by the current frame's segmentation
data only. So we need to maintain the segmentation state inside the vp9
decoder and update it when the new frame header comes.

We also fix the CLAMP issue of lvl_seg and intra_lvl because of their wrong
uint type here.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2369>

3 years agocodecparsers: vp9statefulparser: Fix the gst_vp9_get_qindex clamp issue.
He Junyan [Wed, 30 Jun 2021 07:23:15 +0000 (15:23 +0800)]
codecparsers: vp9statefulparser: Fix the gst_vp9_get_qindex clamp issue.

The alternate quantizer is a delta value and should be int type.
We mark it wrongly as uint, that will make CLAMP (data, 0, 255)
always choose 255 rather than 0 if the data < 0.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2369>

3 years agocodecparsers: vp9parser: Use macro to define the size of filter_level in Segmentation.
He Junyan [Wed, 30 Jun 2021 07:32:42 +0000 (15:32 +0800)]
codecparsers: vp9parser: Use macro to define the size of filter_level in Segmentation.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2369>

3 years agocodecparsers: vp9parser: Delete the verbose redefine of MAX_LOOP_FILTER.
He Junyan [Wed, 30 Jun 2021 04:15:42 +0000 (12:15 +0800)]
codecparsers: vp9parser: Delete the verbose redefine of MAX_LOOP_FILTER.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2369>

3 years agova: allocator: dma: Fail when mapping the non-linear buffer.
He Junyan [Tue, 29 Jun 2021 15:21:24 +0000 (23:21 +0800)]
va: allocator: dma: Fail when mapping the non-linear buffer.

The current way of DMA buffer mapping is simply forwarding the job
to parent's map function, which is a mmap(). That can not handle the
non-linear buffers, such as tiling, compressed, etc. The incorrect
mapping of such buffers causes broken images, which are recognized
as bugs. We should directly block this kind of mapping to avoid the
misunderstanding.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2353>

3 years agoccconverter: fix framerate caps negotiation from non-cdp to cdp
Matthew Waters [Fri, 2 Jul 2021 03:10:25 +0000 (13:10 +1000)]
ccconverter: fix framerate caps negotiation from non-cdp to cdp

We can only convert from non-cdp to cdp within the confines of valid cdp
framerates.  The existing caps negotiation code was allowing any
framerate to convert to a cdp output which is incorrect and would hit an
assertion later.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2372>

3 years agocodecs: h265decoder: Consider the conformance window changes when new_sequence().
He Junyan [Wed, 9 Jun 2021 07:16:39 +0000 (15:16 +0800)]
codecs: h265decoder: Consider the conformance window changes when new_sequence().

The change of conformance_window_flag and crop windows size also has impact on the
output resolution and caps. So it deserves a trigger of new_sequence() to notify
the sub class to update caps and pool.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2312>

3 years agoh265decoder: Don't hold reference to GstVideoCodecFrame for dropped picture
Seungha Yang [Tue, 15 Jun 2021 16:07:09 +0000 (01:07 +0900)]
h265decoder: Don't hold reference to GstVideoCodecFrame for dropped picture

We are dropping RASL (Random Access Skipped Leading picture) which
is associated with an IRAP (Intra Random Access Picture) that has
NoRaslOutputFlag equal to 1, since the RASL picture will not be
outputted and also it should not be used for reference picture.
So, corresponding GstVideoCodecFrame should be released immediately.
Otherwise GstVideoDecoder baseclass will hold the unused frame.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2330>

3 years agomxfvanc: Handle empty ANC essence
Edward Hervey [Mon, 21 Jun 2021 11:23:13 +0000 (13:23 +0200)]
mxfvanc: Handle empty ANC essence

Not having any *actual* ANC is totally fine and common usage with several MXF
variants.

In order to properly advance the streams, the essence handler returns an empty
GAP buffer which gets converted to a GST_EVENT_GAP.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2345>

3 years agomfvideoenc: Don't ignore previous flow return value
Seungha Yang [Wed, 30 Jun 2021 09:11:46 +0000 (18:11 +0900)]
mfvideoenc: Don't ignore previous flow return value

In case of ASYNC MFT (hardware encoder), we were ignoring previous
finish_frame or pad_push return value. so, error wasn't propagated.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2370>

3 years agod3d11compositor: Add scaling policy to support PAR-aware scaling
Seungha Yang [Wed, 19 May 2021 15:49:15 +0000 (00:49 +0900)]
d3d11compositor: Add scaling policy to support PAR-aware scaling

Identical to https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1156
but for D3D11.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2263>

3 years agoopencv: Fix build error on macOS
youngsoo.lee [Wed, 30 Jun 2021 04:56:49 +0000 (13:56 +0900)]
opencv: Fix build error on macOS

The build fails on macos with the following error:
/usr/local/Cellar/opencv/4.5.0_5/include/opencv4/opencv2/core/mat.hpp:2226:15: error: no template named 'initializer_list' in namespace 'std'
      Mat_(std::initializer_list<_Tp> values);
fatal error: too many errors emitted, stopping now [-ferror-limit=]
 35 warnings and 20 errors generated.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2368>

3 years agov4l2codecs: vp8: Check kernel version
Ezequiel Garcia [Wed, 3 Mar 2021 18:38:45 +0000 (15:38 -0300)]
v4l2codecs: vp8: Check kernel version

Print a warning if the kernel version is too old.

Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2075>

3 years agov4l2codecs: vp8: Update to the new uAPI
Ezequiel Garcia [Tue, 2 Mar 2021 21:13:27 +0000 (18:13 -0300)]
v4l2codecs: vp8: Update to the new uAPI

Starting from Linux v5.13, the V4L2 stateless VP8 uAPI
is updated and stable.

Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2075>

3 years agonvcodec: Enhance CUDA runtime compiler library loading on Windows
Seungha Yang [Sat, 26 Jun 2021 16:15:49 +0000 (01:15 +0900)]
nvcodec: Enhance CUDA runtime compiler library loading on Windows

The name of installed CUDA runtime compiler library is formed like
nvrtc64_{major-version}{minor-version}_0.dll on Windows
(which is differnt from documented in https://docs.nvidia.com/cuda/nvrtc/index.html)

And minor version might not be exactly same as that of CUDA.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2362>

3 years agod3d11: Add AV1 decoder
Seungha Yang [Mon, 14 Jun 2021 09:49:20 +0000 (18:49 +0900)]
d3d11: Add AV1 decoder

Introduce Direct3D11/DXVA AV1 decoder element

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2365>

3 years agoav1decoder: Store display resolution for duplicated picture
Seungha Yang [Sun, 27 Jun 2021 14:09:30 +0000 (23:09 +0900)]
av1decoder: Store display resolution for duplicated picture

Target display resolution might be required by subclass implementation

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2365>

3 years agoav1decoder: Fix debug typo
Seungha Yang [Sun, 27 Jun 2021 11:35:49 +0000 (20:35 +0900)]
av1decoder: Fix debug typo

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2365>

3 years agoav1parser: Fix tile size calculation
Seungha Yang [Sun, 27 Jun 2021 11:19:39 +0000 (20:19 +0900)]
av1parser: Fix tile size calculation

Remaining size should exclude already read "tile size bits".
And see also "5.11.1. General tile group OBU syntax"

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2365>

3 years agowebrtc receivebin: Drop serialized queries before receive queue
Olivier Crête [Tue, 29 Jun 2021 01:13:56 +0000 (21:13 -0400)]
webrtc receivebin: Drop serialized queries before receive queue

If they're not dropped, they can be blocked in the queue even if it is
leaky in the case where there is a buffer being pushed downstream. Since
in webrtc, it's unlikely that there will be a special allocator to
receive RTP packets, there is almost no downside to just ignoring the
queries.

Also drop queries if they get caught in the pad probe after the queue.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2363>

3 years agowebrtc receivebin: Only set queue to leaky when the pad is blocked
Olivier Crête [Sat, 26 Jun 2021 18:31:01 +0000 (14:31 -0400)]
webrtc receivebin: Only set queue to leaky when the pad is blocked

When the pad is no longer blocked, remove the leakyness to make sure
everything gets into the jitterbuffer.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2363>

3 years agowebrtc receivebin: Don't unblock pad until sender is unblocked
Olivier Crête [Sat, 26 Jun 2021 18:25:39 +0000 (14:25 -0400)]
webrtc receivebin: Don't unblock pad until sender is unblocked

As ther OpenSSL session is created when the receiver goes into
playing, we have to wait for the ICE session to be connected before we
can start delivering packets to the DTLS element.

Fixes #1599

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2363>

3 years agowebrtcbin: Sync to the clock per stream and not per bundle
Sebastian Dröge [Thu, 24 Jun 2021 10:17:09 +0000 (13:17 +0300)]
webrtcbin: Sync to the clock per stream and not per bundle

By using the clocksync inside the dtlssrtpenc, all streams inside a
bundled are synchronized together. This will cause problems if their
buffers are not already arriving synchronized: clocksync would wait for
a buffer on one stream and then buffers from the other stream(s) with
lower timestamps would all be sent out too late.

Placing the clocksync before the rtpbin and rtpfunnel synchronizes each
stream individually and they will be send out more smoothly as a result.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2355>

3 years agowebrtc: Remove the webrtc-priv.h header from public headers
Olivier Crête [Thu, 24 Jun 2021 18:58:12 +0000 (14:58 -0400)]
webrtc: Remove the webrtc-priv.h header from public headers

And this time for real, also import it in a couple more places
inside the webrtc element to make it build.

Fixes #1607

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2359>

3 years agova: change AV1 GstVideoAlignment setting to left-top corner.
He Junyan [Wed, 9 Jun 2021 09:29:19 +0000 (17:29 +0800)]
va: change AV1 GstVideoAlignment setting to left-top corner.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2298>

3 years agova: h264dec: Set the GstVideoAlignment correctly.
He Junyan [Fri, 18 Jun 2021 02:37:06 +0000 (10:37 +0800)]
va: h264dec: Set the GstVideoAlignment correctly.

We should set GstVideoAlignment based on the sequence's crop information.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2298>

3 years agova: h265dec: Set the GstVideoAlignment correctly.
He Junyan [Wed, 9 Jun 2021 09:21:18 +0000 (17:21 +0800)]
va: h265dec: Set the GstVideoAlignment correctly.

We should set GstVideoAlignment based on the conformance window info.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2298>

3 years agova: pool: Add VideoCropMeta to the buffer if crop_top/left > 0.
He Junyan [Wed, 9 Jun 2021 09:19:04 +0000 (17:19 +0800)]
va: pool: Add VideoCropMeta to the buffer if crop_top/left > 0.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2298>

3 years agova: basedec: Copy the frames into other_pool if needed.
He Junyan [Wed, 9 Jun 2021 09:14:42 +0000 (17:14 +0800)]
va: basedec: Copy the frames into other_pool if needed.

If decoder's crop_top/left value > 0 and the downstream does not
support the VideoCropMeta, we need to manually copy the frames
into the other_pool and output it.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2298>

3 years agova: basedec: Setup the other_pool to copy output if crop_left/top.
He Junyan [Wed, 9 Jun 2021 07:44:33 +0000 (15:44 +0800)]
va: basedec: Setup the other_pool to copy output if crop_left/top.

If the decoder has crop_top/left value > 0(e.g. the conformance
window in the H265). Which means that the real output picture
locates in the middle of the decoded buffer. If the downstream can
support VideoCropMeta, a VideoCropMeta is added to notify the
real picture's coordinate and size. But if not, we need to copy
it manually and the other_pool is needed. We always assume that
decoded picture starts from top-left corner, and so there is no
need to do this if crop_bottom/right value > 0.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2298>

3 years agova: No need to set the alignment for VideoMeta
He Junyan [Sun, 6 Jun 2021 16:49:49 +0000 (00:49 +0800)]
va: No need to set the alignment for VideoMeta

The base va decoder's video_align is just used for calculation the
real decoded buffer's width and height. It does not have meaning
for the VideoMeta, because it does not align to the real picture
in the output buffer. We will use VideoCropMeta to replace it later.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2298>

3 years agova: Delete the useless align expand in va_pool_set_config().
He Junyan [Wed, 2 Jun 2021 16:07:05 +0000 (00:07 +0800)]
va: Delete the useless align expand in va_pool_set_config().

The base va decoder's video_align is just used for calculation the
real decoded buffer's width and height. While the gst_video_info_align
just calculate the offset and stride based on the video_align. But
all the offsets and strides are overwritten in gst_va_dmabuf_allocator_try
or gst_va_allocator_try, which make that calculation useless.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2298>

3 years agowebrtc: Re-add WebRTC object docs to the public headers
Sebastian Dröge [Mon, 28 Jun 2021 14:41:38 +0000 (17:41 +0300)]
webrtc: Re-add WebRTC object docs to the public headers

So they end up in the generated documentation and the Since markers
appear in the .gir files too.

Also remove wrong "Since: 1.16" markers for some objects that were
available since 1.14.0 already.

Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/issues/1609

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2366>

3 years agowebrtcbin: Set transceiver kind and codec preferences immediately when creating it
Sebastian Dröge [Fri, 25 Jun 2021 07:20:06 +0000 (10:20 +0300)]
webrtcbin: Set transceiver kind and codec preferences immediately when creating it

Otherwise the on-new-transceiver signal will always be emitted with kind
set to UNKNOWN and no codec preferences although both are often known at
this point already.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2360>

3 years agowebrtcbin: Add a test for setting codec preferences as part of "on-new-transceiver...
Sebastian Dröge [Fri, 25 Jun 2021 09:14:03 +0000 (12:14 +0300)]
webrtcbin: Add a test for setting codec preferences as part of "on-new-transceiver" when setting the remote offer

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2310>

3 years agowebrtc: Use fail_unless_equals_string() for string assertions
Sebastian Dröge [Fri, 25 Jun 2021 09:13:42 +0000 (12:13 +0300)]
webrtc: Use fail_unless_equals_string() for string assertions

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2310>

3 years agowebrtcbin: Store newly created transceivers when creating an answer also in the seen...
Sebastian Dröge [Tue, 8 Jun 2021 08:40:14 +0000 (11:40 +0300)]
webrtcbin: Store newly created transceivers when creating an answer also in the seen transceivers list

Otherwise it might be used a second time for another media afterwards.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2310>

3 years agowebrtcbin: When creating a new transceiver as part of creating the answer also take...
Sebastian Dröge [Tue, 8 Jun 2021 08:39:27 +0000 (11:39 +0300)]
webrtcbin: When creating a new transceiver as part of creating the answer also take its codec preferences into account

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2310>

3 years agowebrtcbin: Fix a couple of caps leaks of the offer caps
Sebastian Dröge [Tue, 8 Jun 2021 08:38:11 +0000 (11:38 +0300)]
webrtcbin: Fix a couple of caps leaks of the offer caps

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2310>

3 years agowebrtcbin: Stop transceivers update after first SDP error on data channel
Philippe Normand [Thu, 24 Jun 2021 11:28:11 +0000 (12:28 +0100)]
webrtcbin: Stop transceivers update after first SDP error on data channel

When invalid SDP is supplied, _update_data_channel_from_sdp_media() sets the
GError, so it is invalid to continue any further SDP processing, we have to exit
early when the first error is raised.

This change is similar to the one applied in
064428cb34572fa1a018ebbaba6925967ba99dc0.
See also #1595

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2356>

3 years agowebrtcbin test: Fix race in new test
Olivier Crête [Mon, 21 Jun 2021 20:50:46 +0000 (16:50 -0400)]
webrtcbin test: Fix race in new test

Pull a buffer from a sink to make sure that the caps are already
set before trying to update them.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2348>

3 years agomsdk: fix qp range for vp9enc
Mengkejiergeli Ba [Tue, 22 Jun 2021 08:12:57 +0000 (16:12 +0800)]
msdk: fix qp range for vp9enc

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2349>

3 years agoavwait: Don't consider it a segment change if the segment is the same except for...
Sebastian Dröge [Thu, 10 Jun 2021 08:46:35 +0000 (11:46 +0300)]
avwait: Don't consider it a segment change if the segment is the same except for the position

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2319>

3 years agod3d11: Add support for GRAY and more YUV formats
Seungha Yang [Mon, 21 Jun 2021 08:13:33 +0000 (17:13 +0900)]
d3d11: Add support for GRAY and more YUV formats

By this commit, following formats will be newly supported by d3d11 elements

* Y444_{8, 12, 16}LE formats:
  Similar to other planar formats. Such Y444 variants are not supported
  by Direct3D11 natively, but we can simply map each plane by
  using R8 and/or R16 texture.
* P012_LE:
  It is not different from P016_LE, but defining P012 and P016 separately
  for more explicit signalling. Note that DXVA uses P016 texture
  for 12bits encoded bitstreams.
* GRAY:
  This format is required for some codecs (e.g., AV1) if monochrome
  is supported
* 4:2:0 planar 12bits (I420_12LE) and 4:2:2 planar 8, 10, 12bits
  formats (Y42B, I422_10LE, and I422_12LE)

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2346>

3 years agotsmux: When selecting random PIDs, name the pads according to those PIDs
Sebastian Dröge [Thu, 10 Jun 2021 08:42:24 +0000 (11:42 +0300)]
tsmux: When selecting random PIDs, name the pads according to those PIDs

Some elements will make use of the automatically generated names to
create new pads in future muxer instances, for example splitmuxsink.

Previously we would've created a pad with a random pid that would become
"sink_0", and then on a new muxer instance a pad "sink_0" and tsmux
would've then failed because 0 is not a valid PID.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2318>

3 years agomfvideoenc: Enhance B-frame timestamp handling
Seungha Yang [Tue, 22 Jun 2021 16:43:08 +0000 (01:43 +0900)]
mfvideoenc: Enhance B-frame timestamp handling

When B-frame is enabled, encoder seems to adjust PTS of encoded sample
by using frame duration.

For instance, one observed timestamp pattern by using B-frame enabled
and 30fps stream is:
* Frame-1: MF pts 0:00.033333300 MF dts 0:00.000000000
* Frame-2: MF pts 0:00.133333300 MF dts 0:00.033333300
* Frame-3: MF pts 0:00.066666600 MF dts 0:00.066666600
* Frame-4: MF pts 0:00.099999900 MF dts 0:00.100000000

We can notice that the amount of PTS shift is frame duration and
Frame-4 exhibits PTS < DTS.

To compensate shifted timestamp, we should
calculate the timestamp offset and re-calculate DTS correspondingly.
Otherwise, total timeline of output stream will be shifted, and that
can cause time sync issue.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2354>

3 years agotsmux: Recheck existing pad PIDs when requesting a new pad with a random pid
Sebastian Dröge [Thu, 10 Jun 2021 08:36:43 +0000 (11:36 +0300)]
tsmux: Recheck existing pad PIDs when requesting a new pad with a random pid

Previously pads might have been requested already (e.g. in NULL state),
then reset was called (e.g. because changing state) and then a new pad
was requested. Resetting is re-creating the internal muxer object and as
such resetting the pid counter, so the next requested pad would get the
same pid as the first requested pad which then leads to collisions.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2317>