Nicolas Dufresne [Mon, 14 Dec 2020 22:07:01 +0000 (17:07 -0500)]
v4l2codecs: Rework handling of queues and pending requests
Starting from this patch, all queue and dequeue operation happening
on V4L2 is now abstracted with the request. Buffers are dequeued
automatically when pending requests are marked done and only 1 in-flight
request is now used.
Along with fixing issues with request not being reused with slice
decoders, this change reduces the memory footprint by allocating only
two bitstream buffers.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1881>
Staz M [Fri, 29 Jan 2021 07:09:05 +0000 (02:09 -0500)]
decklink: Fixed decklinkvideosink auto format detection
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1994>
Seungha Yang [Wed, 27 Jan 2021 19:03:37 +0000 (04:03 +0900)]
nvh264sldec: Add support for output-delay to improve throughput performance
NVDEC API support delaying getting decoded output, and recommended
delay by API document is 4 frames. In case that throughput is
more critical factor than latency, we can prefer delayed output
as recommended by NVIDIA.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1925>
Seungha Yang [Tue, 29 Dec 2020 10:54:35 +0000 (19:54 +0900)]
codecs: h264decoder: Add support for output delay
Some decoding APIs support delayed output or a command for decoding
a frame doesn't need to be sequential to corresponding command for
getting decoded frame. For instance, subclass might be able to
request decoding for multiple frames and then get for one (oldest)
decoded frame or so.
If aforementioned case is supported by specific decoding API,
delayed output might show better throughput performance.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1925>
Arun Raghavan [Wed, 27 Jan 2021 22:09:07 +0000 (17:09 -0500)]
ldac: Use pkg-config instead of raw lib/header search
The ldacBT library includes pkg-config files for the standard and ABR
libraries, so let's just use that instead of doing a header/library
search.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1990>
Seungha Yang [Wed, 27 Jan 2021 17:02:28 +0000 (02:02 +0900)]
d3d11videosink: Don't limit max buffers of buffer pool
In some case, especially reverse playback, we would need more than
two buffers.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1989>
Seungha Yang [Tue, 26 Jan 2021 19:34:13 +0000 (04:34 +0900)]
d3d11: Suppress some warning debug messages
* Don't warn for live object, since ID3D11Debug itself seems to be
holding refcount of ID3D11Device at the moment we called
ID3D11Debug::ReportLiveDeviceObjects(). It would report live object
always
* Device might not be able to support some formats (e.g., P010)
especially in case of WARP device. We don't need to warn about that.
* gst_d3d11_device_new() can be used for device enumeration. Don't warn
even if we cannot create D3D11 device with given adapter index therefore.
* Don't warn for HLSL compiler warning. It's just noise and
should not be critical thing at all
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1986>
Seungha Yang [Thu, 10 Dec 2020 20:23:20 +0000 (05:23 +0900)]
examples: Add d3d11videosink examples for shared-texture use cases
Add two examples to demonstrate "draw-on-shared-texture" use cases.
d3d11videosink will draw application's own texture without copy
by using:
- Enable "draw-on-shared-texture" property
- make use of "begin-draw" and "draw" signals
And then, application will render the shared application's texture
to swapchain's backbuffer by using
1) Direct3D11 APIs
2) Or, Direct3D9Ex + interop APIs
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1873>
Seungha Yang [Wed, 23 Dec 2020 14:49:12 +0000 (23:49 +0900)]
d3d11videosink: Add support for drawing on application's own texture
Add a way to support drawing on application's texture instead of
usual window handle.
To make use of this new feature, application should follow below step.
1) Enable this feature by using "draw-on-shared-texture" property
2) Watch "begin-draw" signal
3) On "begin-draw" signal handler, application can request drawing
by using "draw" signal action. Note that "draw" signal action
should be happen before "begin-draw" signal handler is returned
NOTE 1) For texture sharing, creating a texture with
D3D11_RESOURCE_MISC_SHARED_KEYEDMUTEX flag is strongly recommend
if possible because we cannot ensure sync a texture
which was created with D3D11_RESOURCE_MISC_SHARED
and it would cause glitch with ID3D11VideoProcessor use case.
NOTE 2) Direct9Ex doesn't support texture sharing which was
created with D3D11_RESOURCE_MISC_SHARED_KEYEDMUTEX. In other words,
D3D11_RESOURCE_MISC_SHARED is the only option for Direct3D11/Direct9Ex interop.
NOTE 3) Because of missing synchronization around ID3D11VideoProcessor,
If shared texture was created with D3D11_RESOURCE_MISC_SHARED,
d3d11videosink might use fallback texture to convert DXVA texture
to normal Direct3D texture. Then converted texture will be
copied to user-provided shared texture.
* Why not use generic appsink approach?
In order for application to be able to store video data
which was produced by GStreamer in application's own texture,
there would be two possible approaches,
one is copying our texture into application's own texture,
and the other is drawing on application's own texture directly.
The former (appsink way) cannot be a zero-copy by nature.
In order to support zero-copy processing, we need to draw on
application's own texture directly.
For example, assume that application wants RGBA texture.
Then we can imagine following case.
"d3d11h264dec ! d3d11convert ! video/x-raw(memory:D3D11Memory),format=RGBA ! appsink"
^
|_ allocate new Direct3D texture for RGBA format
In above case, d3d11convert will allocate new texture(s) for RGBA format
and then application will copy again the our RGBA texutre into
application's own texture. One texture allocation plus per frame GPU copy will hanppen
in that case therefore.
Moreover, in order for application to be able to access
our texture, we need to allocate texture with additional flags for
application's Direct3D11 device to be able to read texture data.
That would be another implementation burden on our side
But with this MR, we can configure pipeline in this way
"d3d11h264dec ! d3d11videosink".
In that way, we can save at least one texture allocation and
per frame texutre copy since d3d11videosink will convert incoming texture
into application's texture format directly without copy.
* What if we expose texture without conversion and application does
conversion by itself?
As mentioned above, for application to be able to access our texture
from application's Direct3D11 device, we need to allocate texture
in a special form. But in some case, that might not be possible.
Also, if a texture belongs to decoder DPB, exposing such texture
to application is unsafe and usual Direct3D11 shader cannot handle
such texture. To convert format, ID3D11VideoProcessor API needs to
be used but that would be a implementation burden for application.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1873>
Haihua Hu [Wed, 20 Jan 2021 12:04:20 +0000 (20:04 +0800)]
dashsink: add h265 codec support
Return hvc1 for video/x-h265 mime type in mpd helper function
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1966>
He Junyan [Sat, 23 Jan 2021 15:25:30 +0000 (23:25 +0800)]
av1parse: set the default alignment for input and output.
1. Set the default output alignment to frame, rather than current
alignment of obu. This make it the same behaviour as h264/h265
parse, which default align to AU.
2. Set the default input alignment to byte. It can handle the "not
enough data" error while the OBU alignment can not. Also make it
conform to the comments.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1979>
He Junyan [Sat, 23 Jan 2021 11:26:59 +0000 (19:26 +0800)]
test: Add more test cases for the av1parse obu aligned output.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1979>
He Junyan [Sat, 23 Jan 2021 11:21:21 +0000 (19:21 +0800)]
av1parse: Reset the annex_b when meet TU inside a buffer.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1979>
He Junyan [Sat, 23 Jan 2021 11:05:57 +0000 (19:05 +0800)]
av1parse: Output each OBU when output is aligned to obu.
The current behaviour for obu aligned output is not very precise.
Several OBUs will be output together within one gst buffer. We
should output each gst buffer just containing one OBU. This is
the same way as the h264/h265 parse do when NAL aligned.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1979>
He Junyan [Sat, 23 Jan 2021 09:38:12 +0000 (17:38 +0800)]
av1parse: Always copy the OBU to cache.
The current optimization when input align and out out align are
the same is not very correct. We simply copy the data from input
buffer to output buffer, but we failed to consider the dropping of
OBUs. When we need to drop some OBUs(such as filter out the OBUs
of some temporal ID), we can not do simple copy. So we need to
always copy the input OBUs into a cache.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1979>
He Junyan [Sat, 23 Jan 2021 09:26:25 +0000 (17:26 +0800)]
av1parse: Improve the logic when to drop the OBU.
When drop some OBU, we need to go on. The current manner will make
the data access out range of the buffer mapping.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1979>
Marijn Suijten [Tue, 26 Jan 2021 10:12:28 +0000 (11:12 +0100)]
ext/ldac: Move duplicate sampling rates into #define
Because there was a typo in one of the duplicates already (see previous
commit) it is much safer to specify these once and only once.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1985>
Marijn Suijten [Tue, 26 Jan 2021 10:02:21 +0000 (11:02 +0100)]
ext/ldac: Fix typo in 88200(0) stereo encoder sampling rate
Fixes:
a57681455 ("ext: Add LDAC encoder")
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1985>
Seungha Yang [Sun, 10 Jan 2021 16:06:24 +0000 (01:06 +0900)]
d3d11: Add support for MPEG-2 video decoding
Add DXVA/Direct3D11 API based MPEG-2 decoder element
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1969>
Matthew Waters [Fri, 27 Nov 2020 05:18:29 +0000 (16:18 +1100)]
wpesrc: fix possible small deadlock on shutdown
Problem is that unreffing the EGLImage/SHM Buffer while holding the
images_mutex lock may deadlock when a new buffer is advertised and
an attempt is made to lock the images_mutex there.
The advertisement of the new image/buffer is performed in the
WPEContextThread and the blocking dispatch when unreffing wants to run
something on the WPEContextThread however images_mutex has already been
locked by the destructor.
Delay unreffing images/buffers outside of images_mutex and instead just
clear the relevant fields within the lock.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1843>
Haihua Hu [Wed, 20 Jan 2021 10:16:17 +0000 (18:16 +0800)]
dashsink: fix double unref of sinkpad caps
no need to unref caps in gst_mpd_helper_get_XXX_codec_from_mime
it will be unref in caller gst_dash_sink_get_stream_metadata()
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1981>
He Junyan [Fri, 22 Jan 2021 08:56:24 +0000 (16:56 +0800)]
codecparsers: av1: Fix a typo in frame_restoration_type setting.
Fixes: #1500
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1974>
He Junyan [Fri, 22 Jan 2021 06:01:01 +0000 (14:01 +0800)]
av1parse: Fix some issues in the src caps.
1. Add the mono_chrome to identify 4:0:0 chroma-format.
2. Correct the mapping between subsampling_x/y and chroma-format.
There is no 4:4:0 format definition in AV1. And 4:4:4 should
let both subsampling_x/y be equal to 0.
3. Send the chroma-format when the color space is not RGB.
Fixes: #1502
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1974>
He Junyan [Fri, 22 Jan 2021 05:25:50 +0000 (13:25 +0800)]
vp9parse: Fix the subsampling_x/y to chroma format mapping.
The chroma format 4:4:4 needs both subsampling_x and subsampling_y
equal to 0.
Fixes: #1502
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1974>
Matthew Waters [Fri, 22 Jan 2021 10:10:59 +0000 (21:10 +1100)]
vulkan: remove duplicated check
Checking the same value twice is pointless
Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/issues/1504
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1977>
Matthew Waters [Fri, 22 Jan 2021 08:26:18 +0000 (19:26 +1100)]
ldac: also look for the ldac/ldacBT.h header.
Otherwise there will be a scenario where the library can be found but
not the header and a compilation build error will result
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1975>
Víctor Manuel Jáquez Leal [Fri, 22 Jan 2021 08:35:30 +0000 (09:35 +0100)]
va: filter: fix assignation to proper variable
Fix the result of a wrong copy&paste
Fixes: #1501
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1976>
Seungha Yang [Wed, 20 Jan 2021 19:41:44 +0000 (04:41 +0900)]
mfvideoenc: Add support for P010 d3d11 texture
Add P010 Direct3D11 texture format support
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1970>
Seungha Yang [Tue, 19 Jan 2021 17:29:43 +0000 (02:29 +0900)]
d3d11: Don't use hardcoded maximum resolution value
Maximum supported texture dimension is pre-defined based on
feature level and it couldn't be INT_MAX in any case.
See also https://docs.microsoft.com/en-us/windows/win32/direct3d11/overviews-direct3d-11-devices-downlevel-intro
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1964>
He Junyan [Sat, 16 Jan 2021 11:14:06 +0000 (19:14 +0800)]
doc: Add the av1 parse element.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1614>
He Junyan [Sat, 16 Jan 2021 08:48:38 +0000 (16:48 +0800)]
codecparsers: Exclude the size of obu_size when identify OBU.
obu->obu_size does not contain the bytes of obu_size itself, we need
to exclude it when doing the saint check.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1614>
He Junyan [Wed, 6 Jan 2021 15:33:24 +0000 (23:33 +0800)]
test: Add test cases for av1parse element.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1614>
He Junyan [Tue, 22 Sep 2020 06:54:19 +0000 (14:54 +0800)]
videoparsers: av1: Add the AV1 parse.
This AV1 parse implements the conversion between alignment of obu,
tu and frame, and the conversion between stream-format of obu-stream
and annexb.
TODO:
1. May need a property of operating_point to filter the OBUs
2. May add a property to disable deep parse.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1614>
He Junyan [Tue, 19 Jan 2021 16:57:05 +0000 (00:57 +0800)]
codecs: mpeg2decoder: Fix a typo in header file's comment.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1963>
Seungha Yang [Mon, 18 Jan 2021 11:30:44 +0000 (20:30 +0900)]
d3d11videosink: Fix ugly thread name for Win32 window impl.
Don't need to put Win32 twice
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1962>
Seungha Yang [Mon, 18 Jan 2021 11:28:14 +0000 (20:28 +0900)]
d3d11videosink: Fix MSVC build warnings around UWP code
gstd3d11window_corewindow.cpp(408): warning C4189:
'storage': local variable is initialized but not referenced
gstd3d11window_corewindow.cpp(490): warning C4189:
'self': local variable is initialized but not referenced
gstd3d11window_swapchainpanel.cpp(481): warning C4189:
'self': local variable is initialized but not referenced
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1962>
Seungha Yang [Mon, 18 Jan 2021 10:17:14 +0000 (19:17 +0900)]
d3d11: Allow building UWP features with Desktop features if possible
WINAPI_PARTITION_DESKTOP and WINAPI_PARTITION_APP can coexist.
Although UWP only binaries should be used for production stage,
this change will be useful for development stage
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1962>
Seungha Yang [Sun, 27 Dec 2020 17:35:38 +0000 (02:35 +0900)]
d3d11decoder: Do more retry for ID3D11VideoContext::DecoderBeginFrame failure
Some GPUs (especially NVIDIA) are complaining that GPU is still busy
even we did 50 times of retry with 1ms sleep per failure.
Because DXVA/D3D11 doesn't provide API for "GPU-IS-READY-TO-DECODE"
like signal, there seems to be still no better solution other than sleep.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1913>
Seungha Yang [Mon, 18 Jan 2021 10:23:30 +0000 (19:23 +0900)]
d3d11videosink: Fix build error on UWP
gstd3d11videosink.c(662): error C2065: 'sink': undeclared identifier
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1961>
He Junyan [Sat, 16 Jan 2021 17:16:17 +0000 (01:16 +0800)]
va: Fix some gst_object_unref error because the pointer is NULL.
!1957 introduces some error of gst_object_unref for NULL pointer.
Fixes all of them.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1959>
He Junyan [Fri, 15 Jan 2021 08:05:06 +0000 (16:05 +0800)]
va: Make the caps pointer operation atomic in vadecoder.
The vadecoder's srcpad_caps and sinkpad_caps pointers are outside of the
mutex protection. Just make all operation for them atomic.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1957>
He Junyan [Fri, 15 Jan 2021 07:22:07 +0000 (15:22 +0800)]
va: Fix a latent race condition in vabasedec.
The vabasedec's display and decoder are created/destroyed between
the gst_va_base_dec_open/close pair. All the data and event handling
functions are between this pair and so the accessing to these pointers
are safe. But the query function can be called anytime. So we need to:
1. Make these pointers operation in open/close and query atomic.
2. Hold an extra ref during query function to avoid it destroyed.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1957>
Sebastian Dröge [Thu, 14 Jan 2021 12:37:32 +0000 (14:37 +0200)]
decklinkaudiosrc: Allow disabling audio sample alignment code by setting the alignment-threshold to 0
And handle setting it to GST_CLOCK_TIME_NONE as always aligning without
ever detecting a discont.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1956>
Seungha Yang [Sun, 20 Dec 2020 20:11:03 +0000 (05:11 +0900)]
mfvideoenc: Add support for Direct3D11 texture
Initial support for d3d11 texture so that encoder can copy
upstream d3d11 texture into encoder's own texture pool without
downloading memory.
This implementation requires MFTEnum2() API for creating
MFT (Media Foundation Transform) object for specific GPU but
the API is Windows 10 desktop only. So UWP is not target
of this change.
See also https://docs.microsoft.com/en-us/windows/win32/api/mfapi/nf-mfapi-mftenum2
Note that, for MF plugin to be able to support old OS versions
without breakage, this commit will load MFTEnum2() symbol
by using g_module_open()
Summary of required system environment:
- Needs Windows 10 (probably at least RS 1 update)
- GPU should support ExtendedNV12SharedTextureSupported feature
- Desktop application only (UWP is not supported yet)
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1903>
Mathieu Duponchelle [Tue, 12 Jan 2021 18:12:42 +0000 (19:12 +0100)]
webrtc: expose transport property on sender and receiver
As advised by !1366#note_629558 , the nice transport should be
accessed through:
> transceiver->sender/receiver->transport/rtcp_transport->icetransport
All the objects on the path can be accessed through properties
except sender/receiver->transport. This patch addresses that.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1952>
Seungha Yang [Sun, 20 Dec 2020 17:47:45 +0000 (02:47 +0900)]
d3d11: Move core methods to gst-libs
Move d3d11 device, memory, buffer pool and minimal method
to gst-libs so that other plugins can access d3d11 resource.
Since Direct3D is primary graphics API on Windows, we need
this infrastructure for various plugins can share GPU resource
without downloading GPU memory.
Note that this implementation is public only for -bad scope
for now.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/464>
Seungha Yang [Mon, 11 Jan 2021 15:13:22 +0000 (00:13 +0900)]
va: allocator: Fix deadlock caused by double lock
Trivial bug fix for deadlock
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1949>
Matthew Waters [Mon, 4 Jan 2021 08:34:40 +0000 (19:34 +1100)]
wpesrc: replace object lock usage with a new lock
Using the object lock is problematic for anything that can dispatch to
another thread which is what createWPEView() does inside
gst_wpe_src_start(). Using the object lock there can cause a deadlock.
One example of such a deadlock is when createWPEView is called, but
another (or the same) wpesrc is on the WPEContextThread and e.g. posts a
bus message. This message propagations takes and releases the object
lock of numerous elements in quick succession for determining various
information about the elements in the bin. If the object lock is
already held, then the message propagation will block and stall bin
processing (state changes, other messages) and wpe servicing any events.
Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/issues/1490
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1934>
Seungha Yang [Sun, 10 Jan 2021 14:16:55 +0000 (23:16 +0900)]
codecs: h264picture: Count only complete complementary field pair for dpb fullness decision
Our DPB implementation was designed as such that allowing
temporary DPB overflow in the middle of field picture decoding
and incomplete field pair should not trigger DPB bumping.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1947>
Seungha Yang [Sun, 10 Jan 2021 14:11:01 +0000 (23:11 +0900)]
codecs: h264decoder: Add support for field-pair input frame
In case that upstream pushed buffer as a frame unit, not picture
unit for interlaced stream, baseclass should be able to detect
AU boundary (i.e., complementary field pair).
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1947>
Seungha Yang [Sun, 10 Jan 2021 13:01:27 +0000 (22:01 +0900)]
codecs: h264decoder: Remove unused private variables
... and reset() method to clear internal status at one place
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1947>
Mathieu Duponchelle [Tue, 22 Dec 2020 01:29:03 +0000 (02:29 +0100)]
webrtcbin: try harder not to pick duplicate media ids
On renegotiation, or when the user has specified a mid for
a transceiver, we need to avoid picking a duplicate mid for
a transceiver that doesn't yet have one.
Also assign the mid we created to the transceiver, that doesn't
fix a specific bug but seems to make sense to me.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1902>
Seungha Yang [Thu, 7 Jan 2021 14:47:35 +0000 (23:47 +0900)]
meson: va: Skip configuration on non-linux environment
VA plugin is linux-only plugin, so we can skip it earlier.
Note that this plugin is making use of libdrm meson fallback,
which is unusable on the other platforms such as Windows
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1946>
Haihao Xiang [Thu, 7 Jan 2021 04:41:16 +0000 (12:41 +0800)]
msdkenc: the unit for max-frame-size is kbyte
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1944>
Edward Hervey [Thu, 7 Jan 2021 08:21:47 +0000 (09:21 +0100)]
srt: Define options added in later revisions
Allows compiling the plugin against old headers.
For SRTO_BINDTODEVICE there's nothing we can do, since the value depends on
configuration options of the library. Nice.
Fixes build with libsrt < 1.4.2
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1945>
Jakub Adam [Fri, 16 Oct 2020 17:30:59 +0000 (19:30 +0200)]
srtobject: distinguish authentication error messages
Use GST_RESOURCE_ERROR_NOT_AUTHORIZED code in posted error messages
related to SRT authentication (e.g. incorrect or missing password) so
that the application can recognize them more easily.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1943>
Jakub Adam [Fri, 16 Oct 2020 17:27:37 +0000 (19:27 +0200)]
srtobject: detect socket errors from srt_epoll_wait()
On an error event, epoll wait puts the failed socket in both readfds and
writefds. We can take advantage of this and avoid explicitly checking
socket state before every read or write attempt.
In addition, srt_getrejectreason() will give us more detailed
description of the connection failure.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1943>
Olivier Crête [Wed, 30 Dec 2020 18:51:21 +0000 (13:51 -0500)]
webrtcbin: Remove remnant of non-rtcp-mux mode
There was some code left that wasn't used anymore.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1930>
Jakub Adam [Tue, 24 Nov 2020 21:25:15 +0000 (22:25 +0100)]
srtobject: make possible to specify more sockopts in SRT URI
Any socket option that can be passed to libsrt's srt-live-transmit
through SRT URI query string is now recognized.
Also make the code that applies options to SRT sockets more generic.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1842>
Jakub Adam [Wed, 26 Aug 2020 12:33:57 +0000 (14:33 +0200)]
srtsrc: fix typos
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1541>
Jakub Adam [Tue, 25 Aug 2020 11:44:42 +0000 (13:44 +0200)]
srtsink: remove unused connection_mode variable
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1541>
Jakub Adam [Mon, 23 Nov 2020 15:12:39 +0000 (16:12 +0100)]
srtobject: obey "wait-for-connection" in caller mode
The pipeline now gets stuck in gst_srt_object_write_one() until the
receiver comes online, which may or may not be desired based on the use
case.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1836>
Víctor Manuel Jáquez Leal [Tue, 5 Jan 2021 13:18:39 +0000 (14:18 +0100)]
va: mpeg2dec: refactor the picture reference filling
Add the helper function _get_surface_id() which extracts the
VASurfaceID from the passed picture. This function gets the surface of
the next and previous reference picture.
Instead of if-statements, this refactor uses a switch-statement with a
fall-through, for P-type pictures, making the code a bit more readable.
Also it adds quirks for gallium driver, which cannot handle invalid
surfaces as forwarding nor backwarding references, so the function fails.
Also iHD cannot handle them, but to avoid failing, the current picture
is used as self-reference.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1939>
Víctor Manuel Jáquez Leal [Tue, 5 Jan 2021 13:16:45 +0000 (14:16 +0100)]
va: mpeg2dec: set first field either frame or has a first field
Add a helper function _is_frame_start() which check if picture has a
frame structure or if it has not an interlaced first field yet. This
function is used with filling is_first_field parameter.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1939>
Víctor Manuel Jáquez Leal [Wed, 6 Jan 2021 15:38:14 +0000 (16:38 +0100)]
codecs: mpeg2decoder: decode only if B and not closed gop
Mark as decode only if picture type is B, without previous picture in DBP and
closed_gop is 0 as might be understood in "6.3.8 Group of pictures header".
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1939>
Víctor Manuel Jáquez Leal [Wed, 6 Jan 2021 11:48:14 +0000 (12:48 +0100)]
codecs: mpeg2decoder: rename variables
Since prev_picture and next_picture are plain pointers, not pointer to pointers,
it's misleading to name them with _ptr suffix.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1939>
Víctor Manuel Jáquez Leal [Mon, 4 Jan 2021 20:02:35 +0000 (21:02 +0100)]
va: display: parse and set driver implementation
This enum can be used for quirk handling. It's not a property because
the driver enum list might change, it's not static, thus avoiding the
update of GType declaration.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1938>
Víctor Manuel Jáquez Leal [Mon, 4 Jan 2021 19:56:26 +0000 (20:56 +0100)]
va: display: add function precondition check
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1938>
Jakub Adam [Tue, 25 Aug 2020 17:12:13 +0000 (19:12 +0200)]
srtobject: post a message on the bus when broken socket is detected
So that the application gets notified may react to it.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1935>
He Junyan [Wed, 30 Dec 2020 15:29:47 +0000 (23:29 +0800)]
va: mpeg2dec: Using the current picture's surface when missing reference.
When missing the reference frames, we should not just discard the current
frame. Some streams have group of picture header. It is an optional header
that can be used immediately before a coded I-frame to indicate to the decoder
if the first consecutive B-pictures immediately following the coded I-frame can
be reconstructed properly in the case of a random access.
In that case, the B frames may miss the previous reference and can still be
correctly decoded. We also notice that the second field of the I frame may
be set to P type, and it only ref its first field.
We should not skip all those frames, and even the frame really misses the
reference frame, some manner such as inserting grey picture should be used
to handle these cases.
The driver crashes when it needs to access the reference picture while we set
forward_reference_picture or backward_reference_picture to VA_INVALID_ID. We
now set it to current picture to avoid this. This is just a temp manner.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1929>
He Junyan [Wed, 30 Dec 2020 15:14:01 +0000 (23:14 +0800)]
codecs: mpeg2decoder: Creating the field based on its arriving time.
Spec says:
In a frame picture top_field_first being set to ‘1’ indicates that the
top field of the reconstructed frame is the first field output by the
decoding process. top_field_first being set to ‘0’ indicates that the
bottom field of the reconstructed frame is the first field output by
decoding process.
Here, the "output" should be interpreted just as the output order, not
including the decoding order. The field should be decoded as the order
they comes in the stream. Namely, no matter top_field_first is 0 or 1,
the first coming field is the first one to be decoded.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1929>
He Junyan [Fri, 1 Jan 2021 08:00:10 +0000 (16:00 +0800)]
va: mpeg2dec: Apply buffer_flags to the output buffer.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1929>
He Junyan [Fri, 1 Jan 2021 07:56:03 +0000 (15:56 +0800)]
codecs: Add buffer_flags for mpeg2 picture.
We need to store the buffer flags such as GST_VIDEO_BUFFER_FLAG_INTERLACED
and GST_VIDEO_BUFFER_FLAG_TFF for interlaced video. Without these flags,
the VPP and display elements can not apply filter correctly.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1929>
He Junyan [Wed, 30 Dec 2020 15:00:51 +0000 (23:00 +0800)]
codecs: Reset the quant matrices for each sequence in mpeg2 decoder.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1929>
Raghavendra [Tue, 27 Oct 2020 06:22:09 +0000 (11:52 +0530)]
srt: Add authentication to srtsink and srtsrc elements
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1725>
Haihua Hu [Wed, 30 Dec 2020 14:52:01 +0000 (22:52 +0800)]
dashsink: fix critical log when exit dynamic pipeline
availability-start-time and publish-time shared the same
GstDateTime object, this object will be unref twice and
cause reference count issue. Should use g_value_dup_boxed()
to copy this object.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1928>
Haihao Xiang [Wed, 23 Dec 2020 08:11:42 +0000 (16:11 +0800)]
msdkenc{h264,h265}: add min-qp and max-qp properties
The SDK allows user to set a QP range [1], so add min-qp and max-qp to
sepecify QP range. By default, there is no limitations on QP.
[1] https://github.com/Intel-Media-SDK/MediaSDK/blob/master/doc/mediasdk-man.md#mfxextcodingoption2
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1908>
Haihao Xiang [Wed, 23 Dec 2020 05:36:02 +0000 (13:36 +0800)]
msdkenc{h264,h265}: add p-pyramid property
The SDK can support P-Pyramid reference structure [1], so add a new
property to enable this feature in msdkenc{h264,h265}.
[1] https://github.com/Intel-Media-SDK/MediaSDK/blob/master/doc/mediasdk-man.md#preftype
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1908>
Haihao Xiang [Tue, 22 Dec 2020 08:17:18 +0000 (16:17 +0800)]
msdkh265enc: add b-pyramid property
Like as msdkh264enc, b-pyramid is added to enable B-Pyramid reference
structure for H265 encoding
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1908>
Haihao Xiang [Tue, 22 Dec 2020 06:54:59 +0000 (14:54 +0800)]
msdkh265enc: add transform-skip property
Since the SDK API 1.26, TransformSkip was added to control
transform_skip_enabled_flag setting in PPS [1]
[1] https://github.com/Intel-Media-SDK/MediaSDK/blob/master/doc/mediasdk-man.md#mfxextcodingoption3
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1908>
Haihao Xiang [Tue, 29 Dec 2020 01:41:05 +0000 (09:41 +0800)]
msdk: needn't close mfx session when failed
Otherwise we will get double free issue because mfx session is closed in
finalize. See
https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1867#note_739346
for the double free issue.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1916>
Olivier Crête [Tue, 29 Dec 2020 18:29:05 +0000 (13:29 -0500)]
webrtcstats: PLI/FIR/NACK direction are the opposite of the media
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1924>
Sebastian Dröge [Tue, 29 Dec 2020 11:15:10 +0000 (13:15 +0200)]
assrender: Don't try unlocking unlocked mutex
When flushing right at the beginning of the video chain function or
when failing negotiation at the top of the function, the assrender mutex
would be unlocked without being previously locked.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1918>
Seungha Yang [Sun, 27 Dec 2020 13:16:13 +0000 (22:16 +0900)]
d3d11compositor: Add support for resolution change
Not only for position update (e.g., xpos, ypos),
we need to configure shader again per resolution change of each
input stream.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1912>
Seungha Yang [Sun, 27 Dec 2020 19:33:11 +0000 (04:33 +0900)]
d3d11shader: Fix ID3DBlob object leak
Even if HLSL compiler was able to compile our shader code, D3DCompile()
might return ID3DBlob object for compile warnings and the object
should be released.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1914>
He Junyan [Mon, 28 Dec 2020 09:13:22 +0000 (17:13 +0800)]
codecs: Fix a typo in mpeg2 stateless decoder base class.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1915>
Víctor Manuel Jáquez Leal [Thu, 24 Dec 2020 19:07:09 +0000 (20:07 +0100)]
va: mpeg2dec: cosmetic changes
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1798>
Víctor Manuel Jáquez Leal [Sun, 27 Dec 2020 14:47:13 +0000 (15:47 +0100)]
codecs: mpeg2decoder: fix documentation
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1798>
Víctor Manuel Jáquez Leal [Thu, 24 Dec 2020 15:20:31 +0000 (16:20 +0100)]
codecs: mpeg2decoder: simplify macros
For constructors, instead of casting to pointers, cast to the structures.
For compare, use inlined functions.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1798>
He Junyan [Fri, 18 Dec 2020 14:28:41 +0000 (22:28 +0800)]
va: Add mpeg2 VA decoder.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1798>
He Junyan [Fri, 18 Dec 2020 13:25:08 +0000 (21:25 +0800)]
codecs: Add mpeg2 stateless decoder base class.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1798>
Seungha Yang [Sat, 26 Dec 2020 18:16:28 +0000 (03:16 +0900)]
mfvideoenc: Re-define default GOP size value
The behavior for zero AVEncMPVGOPSize value would be
varying depending on GPU vendor implementation and some
GPU will produce keyframe only once at the beginning of encoding.
That's unlikely expected result for users.
To make this property behave consistently among various GPUs,
this commit will change default value of "gop-size" property to -1
which means "auto". When "gop-size" is unspecified, then
mfvideoenc will calculate GOP size based on framerate
like that of our x264enc implementation.
See also
https://docs.microsoft.com/en-us/windows/win32/directshow/avencmpvgopsize-property
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1911>
Seungha Yang [Sat, 26 Dec 2020 18:43:11 +0000 (03:43 +0900)]
mfvideoenc: Fix use of uninitialized value
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1911>
Seungha Yang [Thu, 24 Dec 2020 12:31:04 +0000 (21:31 +0900)]
d3d11device: Add property for getting adapter LUID
LUID (Locally Unique Identifier) can used for identifying GPU
and that's required for some Windows APIs (e.g., MFTEnum2()) to setup device.
See also
https://docs.microsoft.com/en-us/windows/win32/api/mfapi/nf-mfapi-mftenum2
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1910>
Seungha Yang [Sat, 26 Dec 2020 11:39:07 +0000 (20:39 +0900)]
mfvideoenc: Remove duplicated class registration code
Each codec subclass has the same code for class/element registration,
so we can move the code into one helper methodm and that will make
future enhancement simple.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1909>
Haihao Xiang [Thu, 10 Dec 2020 03:11:04 +0000 (11:11 +0800)]
msdk: check GstMsdkContext instead of mfxSession instance
When creating a GstMsdkContext instance, it also creates a mfxSession
instance, so we may check GstMsdkContext instead of mfxSession instance
to make sure MSDK is available. In addition, according to MSDK doc [1],
MFXVideoCORE_SetHandle function should be executed before any actual
usage of library including queries, otherwise the behavior is
unexpected, so we should call MFXVideoCORE_QueryPlatform after
MFXVideoCORE_SetHandle on Linux
[1] https://github.com/Intel-Media-SDK/MediaSDK/blob/master/doc/mediasdk-man.md#working-with-va-api-applications
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1867>
Seungha Yang [Wed, 23 Dec 2020 12:21:55 +0000 (21:21 +0900)]
d3d11: Remove unnecessary helper methods
We can query selected D3D_FEATURE_LEVEL and factory version
by using native D3D11 API
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1906>
Seungha Yang [Fri, 20 Nov 2020 18:20:36 +0000 (03:20 +0900)]
d3d11: Re-implement Desktop Duplication source
Add a new video source element "d3d11desktopdupsrc" for capturing desktop image
via Desktop Duplication based on Microsoft's Desktop Duplication sample available at
https://github.com/microsoft/Windows-classic-samples/tree/master/Samples/DXGIDesktopDuplication
This element is expected to be a replacement of existing dxgiscreencapsrc
element in winscreencap plugin.
Currently this element can support (but dxgiscreencapsrc cannot)
- Copying captured D3D11 texture to output buffer without download
- Support desktop session transition
e.g., can capture desktop without error even in case that
"Lock desktop" and "Permission dialog"
- Multiple d3d11desktopdupsrc elements can capture the same monitor
Not yet implemented features
- Cropping rect is not implemented, but that can be handled by downstream
- Mult-monitor is not supported. But that is also can be implemented by
downstream element for example via multiple d3d11desktopdup elements
with d3d11compositor
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1855>
Seungha Yang [Mon, 21 Dec 2020 15:47:09 +0000 (00:47 +0900)]
d3d11device: Add an optional flags argument for creating device
Extend gst_d3d11_device_new() method so that caller can specify
D3D11_CREATE_DEVICE_FLAG value to use.
See https://docs.microsoft.com/en-us/windows/win32/api/d3d11/ne-d3d11-d3d11_create_device_flag
for more detail about D3D11_CREATE_DEVICE_FLAG
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1901>
Raju Babannavar [Mon, 21 Dec 2020 08:36:53 +0000 (14:06 +0530)]
dvbsuboverlay: Add support for dynamic resolution update.
Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/issues/1487
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1897>