Commit graph

3498 commits

Author SHA1 Message Date
Aaron Boxer
86b01bb291 d3dvideosink: support OverlayComposition for GPU overlay compositing 2019-11-06 01:05:33 +00:00
Aaron Boxer
6d3429af34 documentation: fixed a heap o' typos 2019-11-05 09:11:25 -05:00
Roman Shpuntov
f84ebbd95f vtdec: fix leak of CMFormatDescription
There was consideration for replacing the CMFormatDescription used
on format changes in `set_format()` however on shutdown, we were
leaking the CMFormatDescription at the end of processing.

'https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/issues/1106'
2019-11-04 12:12:57 +00:00
Roman Shpuntov
b0543d6ea5 vtdec: memory leaks bugfix
release 'videoDecoderSpecification' variable in 'gst_vtdec_create_session' function.
release 'extensions' variable in 'create_format_description_from_codec_data' function.
2019-11-02 13:58:56 +00:00
Haihao Xiang
1dd3ef24b1 msdkmjpegenc: convert UYVY to YUY2 instead of NV12
Before this fix, the chroma subsampling of the output is 4:2:0. It is
4:2:2 with this fix, which is better for UYVY input
2019-11-02 09:52:36 +00:00
Haihao Xiang
e1b8b81e84 msdkmjpegenc: don't need conversion for BGRA and YUY2
jpeg encoder in MSDK can accept BGRA and YUY2 input.
2019-11-02 09:52:36 +00:00
Haihao Xiang
fbeaa37b79 msdkenc: add need_conversion method
In future, a sub class of GstMsdkEncClass may decide a native format by
using this method, e.g. JPEG encoder may accept YUY2 input, however the
current implemation needs a conversion from YUY2 to NV12 before encoding.

In addtion, a sub class may choose a format for encoding if the input
format is not supported by MSDK, e.g. the current implemation does
UYVY->NV12 if the input format is UYVY. We may do UYVY->YUY2 for JPEG
encoder in future
2019-11-02 09:52:36 +00:00
Haihao Xiang
afce02b392 msdk: support for MFX_FOURCC_BGR4 frame allocation
MFX_FOURCC_BGR4 is mapped to VA_FOURCC_ABGR and JPEG encoder needs a
MFX_FOURCC_BGR4 frame for internal usage when the input format is
MFX_FOURCC_RGB4

This is a preparation for supporting native formats of JPEG encoder
2019-11-02 09:52:36 +00:00
Víctor Manuel Jáquez Leal
10d4c0c511 msdkdec: use decoder base class packetized flag
Instead of using a proxy of `is_packetized` flag this patch
replaces it with the accessor to that flag in decoder base class,
avoiding probable mismatches.
2019-10-29 14:58:54 +00:00
Haihao Xiang
cd883427e9 msdkdec: add parse callback for non-packetized input
commit 55c0d720 added the capability to handle non-packetized bitstream,
and there is a loop to handle multiple frames in a non-packetized buffer
in gst_msdkdec_handle_frame. However it is possible that a
non-packetized buffer still contains valid data but there is no long any
pending unfinished frame. Currently gst_video_decoder_decode_frame is
invoked to send a new frame with new input data, the situaltion is
repeated till an EOS is received. An application has to exit when
receiving an EOS, however there is still valid data in a
non-packetezied input buffer, hence some frames are dropped.

This fix adds a parse callback for non-packeteized input, a new frame
will be sent to the subclass as soon as the input buffer has valid data

This fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/issues/665
2019-10-29 14:58:54 +00:00
Haihao Xiang
a2cafcfc3e msdkh265enc: Add support for tiled encoding
Add num-tile-rows and num-tile-cols properties to set the number of rows
and columns
2019-10-27 18:40:15 +00:00
Haihao Xiang
9fcd3bdd2b msdk: support P010_10LE in DMABuf mode for VP9/HEVC encoding 2019-10-25 16:54:57 +00:00
Cheng-Chang Wu
b5e506d12b androidmedia: Make sure that the first member of GstAmcSurfaceTextureJNI is correct
It's a subclass of GstAmcSurfaceTexture so should have that as first
struct member or otherwise it won't work.

Fixes #1105
2019-10-25 13:56:13 +00:00
Cheng-Chang Wu
e71f620eb0 androidmedia: Call JNI method with the actual Java object instead of our wrapper struct
Fixes #1105
2019-10-25 13:56:13 +00:00
Haihao Xiang
351a3934ec msdkvpp: add support Y410 and Y210 formats
And clean up some macros
2019-10-24 13:57:51 +00:00
U. Artie Eoff
b7ee6dc49a msdkvpp: allow cropping via properties
Add crop-left, crop-right, crop-top and crop-bottom
properties to msdkvpp and apply to input surface at
vpp transform run-time.

Implements #1097
2019-10-24 12:44:49 +00:00
Javier Celaya
8684dffe50 Fix get_supported_types function name 2019-10-16 06:42:37 +00:00
Javier Celaya
f267adeb4a Fix releasing local refs 2019-10-16 06:42:37 +00:00
Javier Celaya
3f0d60515a Fix names of MediaCodecInfo inner classes 2019-10-16 06:42:37 +00:00
Javier Celaya
26ea6d7fbb Fix getting MediaCodecList static methods 2019-10-16 06:42:37 +00:00
Julien Isorce
5de00b9ffb msdkenc: close encoder upon bitrate change
Upon bitrate change, make sure to close the encoder otherwise
the encoder is not re-initialized and the target bitrate is
never reached, and the encoder was flushed at each frame
from this moment.

Regression introduced in f2b35abcab which replaced the call
that was closing the encoder by an early return to avoid
re-initialization.
2019-10-15 15:53:20 -07:00
Seungha Yang
76654539b9 wasapi: Fix build warnings
gstwasapiutil.c(173) : warning C4715: 'gst_wasapi_device_role_to_erole': not all control paths return a value
gstwasapiutil.c(188) : warning C4715: 'gst_wasapi_erole_to_device_role': not all control paths return a value
2019-10-14 14:43:59 +00:00
Seungha Yang
baaa965ebc wasapi: Don't cast GstDeviceProvider to GstElement
The GstDeviceProvider isn't subclass of GstElement.

(gst-device-monitor-1.0:49356): GLib-GObject-WARNING **: 20:21:18.651:
invalid cast from 'GstWasapiDeviceProvider' to 'GstElement'
2019-10-14 14:43:59 +00:00
Tim-Philipp Müller
f218ec2794 Remove autotools build system 2019-10-14 13:54:27 +01:00
Matthew Waters
4d528776b6 decklink: fix timestamp tracking when pausing
play->pause->sleep()->play would result in late frames being scheduled
2019-10-14 19:22:36 +11:00
Haihao Xiang
e5279cd97a msdk: return the right pointer
The first channel in memory for MFX_FOURCC_RGB4 (VA_FOURCC_ARGB or
GST_VIDEO_FORMAT_BGRA) is B, not A. In MSDK, channle B is used to access
data for RGB4 surface. In addition, the returned pointers for
MFX_FOURCC_AYUV and MFX_FOURCC_Y410 in gst_msdk_video_memory_map_full
were wrong too before this fix.
2019-10-11 14:07:17 +00:00
Josep Torra
f2c75d548d msdkenc: handle bitrate changes in playing state
When the bitrate is changed in playing state the encoder issues a reconfig
that drains and recreates the underlaying hw encoder instance.
With this set of changes we ensure that all this work is only made when
the bitrate did actually change. It also tries to reuse the vpp buffer
pool and fixes the pool leak spotted when testing this feature.
2019-10-08 06:37:48 -07:00
Haihao Xiang
4525f8707f msdkh265enc: add the missing profile string 2019-10-08 09:40:06 +08:00
Seungha Yang
5e8755cf07 d3d11window: Protect registration/creation of WIN32 window
Querying existing window class info and creation of window object
should be protected since they are not thread safe.
2019-10-04 21:15:25 +09:00
Seungha Yang
44cb5b4ff7 d3d11videosink: Don't try to post error message by d3d11window self
The d3d11window isn't GstElement. To post error message, proxy it
to d3d11videosink instead.
2019-10-04 21:15:15 +09:00
Víctor Manuel Jáquez Leal
5140bf1a1f msdkenc: guard MFX_FOURCC_Y410 with MFX version 1027 2019-10-03 13:50:15 +00:00
Haihao Xiang
71ff8236b5 msdkdec: set lockable flag
When postpone_free_surface is TRUE, the output buffer is not writable,
however the base decoder needs a writable buffer as output buffer,
otherwise it will make a copy of the output buffer. As the underlying
memory is always lockable, so we may set the LOCKABLE flag for this buffer
to avoid buffer copy in the base class.

The refcount of the output buffer is 1 when postpone_free_surface is
FALSE, so needn't set the LOCKABLE flag for this case.
2019-09-30 18:15:38 +00:00
Haihao Xiang
83100b3504 msdkh265enc: add support for Y410 in sink pad
Sample pipeline:
gst-launch-1.0 videotestsrc ! video/x-raw,format=Y410 !
msdkh265enc low-power=1 ! filesink location=output.h265
2019-09-30 10:44:50 +08:00
Haihao Xiang
0507547646 msdkh265enc: add support for VUYA in sink pad
sample pipelie:
gst-launch-1.0 videotestsrc ! video/x-raw,format=VUYA !
msdkh265enc low-power=1 ! filesink location=output.h265
2019-09-30 10:44:38 +08:00
Haihao Xiang
85914997f5 msdkenc: clean up code by using switch
It is convenient for us to add support for new formats in future, there
is no change in functionality.
2019-09-30 10:42:41 +08:00
Haihao Xiang
0c1c2ce45a msdk: remove some dead code 2019-09-30 09:10:31 +08:00
Seungha Yang
22d8d77b13 d3d11videosink: Use pixel aspect ratio to setup window draw area
... instead of calculated display ratio from given PAR and DAR.

d3d11window calculates output display ratio
to decide padding area per window resize event. In the formula,
actual PAR is required to handle both 1:1 PAR and non-1:1 PAR.
2019-09-26 10:23:46 +00:00
Haihao Xiang
ce4f9ae531 msdk: fix for mfx frame alloc response
Both MSDK and this plugin use mfxFrameAllocResponse for video and DMABuf
memory, it is possible that some GST buffers are still in use when calling
gst_msdk_frame_free, so add a reference count in the wrapper of
mfxFrameAllocResponse (GstMsdkAllocResponse) to make sure the underlying
mfx resources are still available if the corresponding buffer pool is in
use.

In addtion, currently all allocators for input or output share the same
mfxFrameAllocResponse pointer in an element, so it is possible that
the content of mfxFrameAllocResponse is updated for a new caps then all
GST buffers allocated from an old allocator will use this new content of
mfxFrameAllocResponse, which will result in unexpected behavior. In this
fix, we save the the content of mfxFrameAllocResponse in the corresponding
tructure to avoid such issue

Sample pipeline:

gst-launch-1.0 filesrc location=vp9_multi_resolutions.ivf ! ivfparse ! msdkvp9dec !
msdkvpp ! video/x-raw\(memory:DMABuf\),format=NV12 ! glimagesink
2019-09-23 09:58:28 +08:00
Haihao Xiang
e50011c064 msdk: don't cache mfxFrameAllocResponse pointer
Otherwise it is possible that different wrappers share the same
mfxFrameAllocResponse pointer, so instead of caching the pointer, we may
cache the content of mfxFrameAllocResponse
2019-09-21 19:51:38 +00:00
Haihao Xiang
f840e304f3 msdkdec: postpone surface free for VC1
For a skipped frame in VC1, MSDK returns the mfx surface of the reference
frame, so we have to make sure the corresponding surface for the
reference frame is not freed. In this fix, we postpone surface free because
we don't know whether a surface is referenced

Before this fix, the error is like as below:

New clock: GstSystemClock
0:00:00.181793130 23098 0x55f8a9d622d0 ERROR                msdkdec
gstmsdkdec.c:622:gst_msdkdec_finish_task:<msdkvc1dec0> Couldn't find the
cached MSDK surface

Sample pipeline:
gst-launch-1.0 filesrc location=input_has_skipped_frame.wmv ! asfdemux !
vc1parse ! msdkvc1dec ! glimagesink
2019-09-21 18:05:42 +00:00
Haihao Xiang
c689c94458 msdkdec: release the surface if this surface is not in use
If the surface is not in use, we may release it even if GST_FLOW_OK is going
to be returned, which may avoid the issue of failing to get surface
available

This fixes the regression caused by commit c05acf4
2019-09-21 17:34:23 +00:00
Haihao Xiang
8daac1c09a msdk: adjust the stride align
GstAllocationParams::align is set to 31 in msdkdec/msdken/msdkvpp, hence
the stride align should be greater than or equal to 31, otherwise it
will result in issue
https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/issues/861
(msdk: "GStreamer-CRITICAL: gst_buffer_resize_range failed" SPAM),

In addition, the stride should match the pitch alignment in the media driver,
otherwise it will result in some issues when a buffer is shared between
different elements, e.g. the NV12 issue mentioned in commit 3f2314a, which
can be reproduced by `gst-launch-1.0 vidoetestsrc ! msdkvpp !
video/x-raw\(memory:DMABuf\),format=NV12 ! glimagesink`

Fixed https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/issues/861
2019-09-21 16:59:10 +00:00
Seungha Yang
e0b2d34237 d3d11: Use g_cond_broadcast() to wake up waiting threads
gst_d3d11_device_thread_add() can be called concurrently from different
threads so the cond signal should reach to all waiting threads.
2019-09-18 18:47:44 +09:00
Haihao Xiang
0b0d5afb53 msdkenc: remove unneeded label 2019-09-16 10:09:00 +00:00
Matthew Waters
52cd9846eb applemedia/videocache: remove unimplemented/used upload function 2019-09-16 03:15:39 +00:00
Haihao Xiang
c05acf40a8 msdkdec: set pointer to NULL to avoid freeing an used surface
The surface should be cached in the surface list when GST_FLOW_OK is
going to be returned

This fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/issues/1051
2019-09-13 17:32:19 +00:00
Haihao Xiang
38c55de132 msdk: free mfx frames to avoid memory leaks in encoder and vpp 2019-09-13 16:54:21 +00:00
Haihao Xiang
2d4b0a5649 msdkdec: unref the caps to avoid memory leaks 2019-09-13 16:54:21 +00:00
Haihao Xiang
cc6ca4ec61 msdkvpp: free msdk surfaces to avoid memory leak 2019-09-13 16:54:21 +00:00
Haihao Xiang
93f72a5041 msdkvpp: unref buffer pools
Unref the pools first in caps re-negotiation to avoid memory leak
2019-09-13 16:54:21 +00:00