platform/upstream/gstreamer.git
6 years agowayland: don't poll if there are no pending frames
Michael Olbrich [Fri, 13 Apr 2018 07:28:53 +0000 (09:28 +0200)]
wayland: don't poll if there are no pending frames

Otherwise the following poll may not return for an arbitrary amount of
time. This can happen if another wayland event queue has flushed and read
our events.

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

6 years agolibs: encoder: h265: 16 bit rounding of picture width and height
Hyunjun Ko [Mon, 16 Oct 2017 03:09:08 +0000 (12:09 +0900)]
libs: encoder: h265: 16 bit rounding of picture width and height

pic_width_in_luma_samples/pic_height_in_luma_samples can be 16-bit rounded
instead of 32-bit.

In addition, codedbuf_size must be calculated according to this change.

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

6 years agoAutomatic update of common submodule
Tim-Philipp Müller [Mon, 16 Apr 2018 09:53:47 +0000 (10:53 +0100)]
Automatic update of common submodule

From 3fa2c9e to ed78bee

6 years agovaapiencode: h264: find best profile in those available
Víctor Manuel Jáquez Leal [Fri, 30 Mar 2018 18:39:18 +0000 (20:39 +0200)]
vaapiencode: h264: find best profile in those available

Instead to look for the best profile in the allowed profiles by
downstream, the encoder should look for the base profile in the
available profile in VA-API.

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

6 years agoBack to development
Tim-Philipp Müller [Tue, 20 Mar 2018 10:49:10 +0000 (10:49 +0000)]
Back to development

6 years agoRelease 1.14.0
Tim-Philipp Müller [Mon, 19 Mar 2018 20:30:28 +0000 (20:30 +0000)]
Release 1.14.0

6 years agolibs: decoder: h264: ensure num_ref_frames is greater than 0
Julien Isorce [Mon, 12 Mar 2018 16:59:01 +0000 (16:59 +0000)]
libs: decoder: h264: ensure num_ref_frames is greater than 0

Even if it is the h264parse fault or bad video file, vaapih264dec
should set a proper value for VAPictureParameterBufferH264.num_ref_frames
as the driver might use it.

Also see "info.ref_frames = dpb_size;" in
gstvaapidecoder_h264.c::ensure_context

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

6 years agoRelease 1.13.91
Tim-Philipp Müller [Tue, 13 Mar 2018 19:32:05 +0000 (19:32 +0000)]
Release 1.13.91

6 years agoRelease 1.13.90
Tim-Philipp Müller [Sat, 3 Mar 2018 22:59:30 +0000 (22:59 +0000)]
Release 1.13.90

6 years agovaapipostproc: change how the metadata is copied
Víctor Manuel Jáquez Leal [Thu, 1 Mar 2018 13:33:27 +0000 (07:33 -0600)]
vaapipostproc: change how the metadata is copied

Instead of copying the metada in prepare_output_buffer() vmethod,
it is done in append_output_buffer_metadata() thus deinterlaced
buffers could also have the proper metas.

GstVideoCropMeta now it is copied internally and it is decided via
transform_meta() vmethod.

A new internal method, copy_metadata() was added to handle VPP
transformation where non-GstVideoVaapiMeta metas were lost.

6 years agopostproc: Copy meta data from input to output
Nicolas Dufresne [Tue, 27 Feb 2018 21:20:15 +0000 (16:20 -0500)]
postproc: Copy meta data from input to output

This will ensure that meta data without memory tags will be copied. This
was noticed when testing ROI.

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

6 years agotests: element: rewrite ROI test
Víctor Manuel Jáquez Leal [Fri, 23 Feb 2018 16:48:36 +0000 (10:48 -0600)]
tests: element: rewrite ROI test

Rewrote the ROI test to use GstVideoRegionOfInterest meta rather
than injecting GstEvents. These meta are added as a pad probe in
the queue src pad.

Also

* Use of navigation messages to control de test
* Use signal watch for processing messages
* Change to H265 rather than H264 since current intel-vaapi-driver
  only supports ROI on kabylake.
  TODO: add a parameter to change the encoder/decoder to test.

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

6 years agolibs: encoder: reimplement ROI using meta
Víctor Manuel Jáquez Leal [Thu, 22 Feb 2018 20:20:42 +0000 (14:20 -0600)]
libs: encoder: reimplement ROI using meta

Check input buffers for ROI metas and pass them to VA. Also added a
new "default-roi-delta-qp" property in order to tell the encoder what
delta QP should be applied to ROI by default.

Enabled it for H264 and H265 encoders.

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

6 years agoRevert "libs: encoder: add api gst_vaapi_encoder_add/del_roi"
Víctor Manuel Jáquez Leal [Thu, 22 Feb 2018 14:22:35 +0000 (08:22 -0600)]
Revert "libs: encoder: add api gst_vaapi_encoder_add/del_roi"

This reverts commit 7a6f690340dcb3b82c59efa777d4453227851de8.

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

6 years agoRevert "tests: simple-encoder: add an option to set ROI"
Víctor Manuel Jáquez Leal [Thu, 22 Feb 2018 20:29:19 +0000 (14:29 -0600)]
Revert "tests: simple-encoder: add an option to set ROI"

This reverts commit c21345c4787bb6342adddea1190f53fe62abff04.

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

6 years agoRevert "vaapiencode: handle custom event GstVaapiEncoderRegionOfInterest"
Víctor Manuel Jáquez Leal [Wed, 21 Feb 2018 16:56:47 +0000 (10:56 -0600)]
Revert "vaapiencode: handle custom event GstVaapiEncoderRegionOfInterest"

This reverts commit 8f1b88dac0e64a211325cdcb2cda693b80229bd1.

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

6 years agoplugins: copy input buffer metas
Víctor Manuel Jáquez Leal [Fri, 23 Feb 2018 15:25:51 +0000 (09:25 -0600)]
plugins: copy input buffer metas

When importing buffers to a VA-base buffer, it is required to copy
the metas in the original buffer, otherwise information will be
lost, such as GstVideoRegionOfInterestMeta.

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

6 years agolibs: surface: cast to uintptr_t pointer
Víctor Manuel Jáquez Leal [Tue, 27 Feb 2018 12:10:09 +0000 (06:10 -0600)]
libs: surface: cast to uintptr_t pointer

According to Debian package auto-building, uintptr_t is not an
unsigned long in i386 arch, raising an "incompatible pointer type"
error.

This patch adds a casting for compiler's satisfaction in i386.

6 years agolibs: encoder: add zero as valid value for periodic keyframe.
Matteo Valdina [Mon, 26 Feb 2018 02:46:56 +0000 (20:46 -0600)]
libs: encoder: add zero as valid value for periodic keyframe.

Enabled zero as valid value for keyframe-period property.

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

6 years agolibs: encoder: code-style fix
Víctor Manuel Jáquez Leal [Thu, 22 Feb 2018 14:24:12 +0000 (08:24 -0600)]
libs: encoder: code-style fix

6 years agovaapidecode: generate system allocated buffers
Víctor Manuel Jáquez Leal [Sat, 17 Feb 2018 17:32:11 +0000 (18:32 +0100)]
vaapidecode: generate system allocated buffers

Generate system allocated output buffers when downstream doesn't
support GstVideoMeta.

The VA buffer content is copied to the new output buffer, and it
replaces the VA buffer.

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

6 years agovaapipostproc: handle system allocated buffers when required
Víctor Manuel Jáquez Leal [Thu, 15 Feb 2018 18:32:37 +0000 (19:32 +0100)]
vaapipostproc: handle system allocated buffers when required

When downstream can't handle GstVideoMeta it is required to send
system allocated buffers.

The system allocated buffers are produced in prepare_output_buffer()
vmethod if downstream can't handl GstVideoMeta.

At transform() vmethod if the buffer is a system allocated buffer,
a VA buffer is instanciated and replaces the out buffer. Later
the VA buffer is copied to the system allocate buffer and it
replaces the output buffer.

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

6 years agoplugins: add gst_vaapi_copy_va_buffer()
Víctor Manuel Jáquez Leal [Thu, 15 Feb 2018 18:32:19 +0000 (19:32 +0100)]
plugins: add gst_vaapi_copy_va_buffer()

This helper function aims to copy buffers with VA memory to dumb
buffers, when GstVideoMeta is not available dowstream.

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

6 years agoplugins: add COPY_OUTPUT_FRAME flag
Víctor Manuel Jáquez Leal [Thu, 15 Feb 2018 18:29:51 +0000 (19:29 +0100)]
plugins: add COPY_OUTPUT_FRAME flag

This patch add the member copy_output_frame and set it TRUE when
when downstream didn't request GstVideoMeta API, the caps are raw
and the internal allocator is the VA-API one.

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

6 years agoplugins: store the first downstream allocator if available
Víctor Manuel Jáquez Leal [Thu, 15 Feb 2018 18:28:33 +0000 (19:28 +0100)]
plugins: store the first downstream allocator if available

The allocator will be required if we need to allocate a buffer
to store the frame with the expected strides.

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

6 years agovaapibufferpool: add gst_vaapi_video_buffer_pool_copy_buffer()
Víctor Manuel Jáquez Leal [Tue, 20 Feb 2018 01:25:13 +0000 (02:25 +0100)]
vaapibufferpool: add gst_vaapi_video_buffer_pool_copy_buffer()

This function will inform the element if it shall copy the generated
buffer by the pool to a system allocated buffer before pushing it
to downstream.

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

6 years agovaapibufferpool: don't change config when forcing video meta
Víctor Manuel Jáquez Leal [Thu, 15 Feb 2018 18:22:08 +0000 (19:22 +0100)]
vaapibufferpool: don't change config when forcing video meta

VA-API based buffer might need a video meta because of different
strides. But when donwstream doesn't support video meta we need to
force the usage of video meta.

Before we changed the buffer pool configuration, but actually this
is a hack and we cannot rely on that for downstream.

This patch add a check fo raw video caps and allocator is VA-API,
then the option is enabled without changing the pool configuration.
In this case the element is responsible to copy the frame to a
simple buffer with the expected strides.

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

6 years agovaapipostproc: set discont flag at vpp deinterlacing
Víctor Manuel Jáquez Leal [Tue, 20 Feb 2018 15:15:05 +0000 (09:15 -0600)]
vaapipostproc: set discont flag at vpp deinterlacing

When deinterlacing with VPP the discont flag was not forwarded to
the new created buffer. This patch sets the discont flag if input
buffer has it.

6 years agovaapibufferpool: remove wrong gcc annotation
Víctor Manuel Jáquez Leal [Tue, 20 Feb 2018 01:14:37 +0000 (02:14 +0100)]
vaapibufferpool: remove wrong gcc annotation

6 years agolibs: encoder: h264,h265: extend max periodic keyframe.
Matteo Valdina [Thu, 15 Feb 2018 20:55:42 +0000 (14:55 -0600)]
libs: encoder: h264,h265: extend max periodic keyframe.

Increased max values of periodic key frame for h26x codecs.
This allow more fine tunning of encoder that in certian scenario
want higher periodic key frame.

For example: it doesn't want a key frame each 10 seconds but
each 120 seconds.

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

6 years agoBack to development
Tim-Philipp Müller [Thu, 15 Feb 2018 19:44:35 +0000 (19:44 +0000)]
Back to development

6 years agoRelease 1.13.1
Tim-Philipp Müller [Thu, 15 Feb 2018 17:39:16 +0000 (17:39 +0000)]
Release 1.13.1

6 years agovaapi: dist new header
Tim-Philipp Müller [Thu, 15 Feb 2018 18:15:33 +0000 (18:15 +0000)]
vaapi: dist new header

6 years agovaapi: register vaapisink as marginal on wayland
Víctor Manuel Jáquez Leal [Mon, 12 Feb 2018 16:53:58 +0000 (17:53 +0100)]
vaapi: register vaapisink as marginal on wayland

vaapsink, when used with the Intel VA-API driver, tries to display
surfaces with format NV12, which are handled correctly by
Weston. Nonetheless, COGL cannot display YUV surfaces, making fail
pipelines on mutter.

This shall be solved either by COGL or by making the driver to paint
RGB surfaces. In the meanwhile, let's just demote vaapisink as
marginal when the Wayland environment is detected, no matter if it is
Weston.

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

6 years agoplugins: update mesa's vendor string in whitelist
Víctor Manuel Jáquez Leal [Mon, 12 Feb 2018 18:00:36 +0000 (19:00 +0100)]
plugins: update mesa's vendor string in whitelist

Mesa has updated its VA-API Gallium driver vendor string:

https://cgit.freedesktop.org/mesa/mesa/commit/?id=5db29d62ce1fefa3f2ee6e4a4688576fde4bde4a

This patch tries to cover both, the old and the new one.

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

6 years agomeson: make version numbers ints and fix int/string comparison
Tim-Philipp Müller [Thu, 8 Feb 2018 19:22:17 +0000 (19:22 +0000)]
meson: make version numbers ints and fix int/string comparison

WARNING: Trying to compare values of different types (str, int).
The result of this is undefined and will become a hard error
in a future Meson release.

6 years agoplugins: handle vaapi allocator in allocation query
Víctor Manuel Jáquez Leal [Wed, 7 Feb 2018 08:13:26 +0000 (09:13 +0100)]
plugins: handle vaapi allocator in allocation query

In propose_allocation() if the numer of allocation params is zero, the
system's allocator is added first, and lastly the native VA-API
allocator.

In decide_allocation(), the allocations params in query are travered,
looking for a native VA-API allocator. If it is found, it is reused as
src pad allocator. Otherwise, a new allocator is instantiated and
appended in the query.

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

6 years agovaapivideomemory: remove unused macro
Víctor Manuel Jáquez Leal [Wed, 7 Feb 2018 08:06:46 +0000 (09:06 +0100)]
vaapivideomemory: remove unused macro

GST_VAAPI_VIDEO_ALLOCATOR_NAME was added in commit 5b11b8332 but it
was never used, since the native VA-API allocator name has been
GST_VAAPI_VIDEO_MEMORY_NAME.

This patch removes GST_VAAPI_VIDEO_ALLOCATOR_NAME macro.

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

6 years agovaapisink: don't mask button events for foreign windows
VaL Doroshchuk [Fri, 2 Feb 2018 08:54:00 +0000 (08:54 +0000)]
vaapisink: don't mask button events for foreign windows

Don't subscribe to button press events when using a foreing window,
because the user created window would trap those events, preveting the
show of frames.

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

6 years agoautotools: use -fno-strict-aliasing where supported
Tim-Philipp Müller [Mon, 5 Feb 2018 07:51:56 +0000 (08:51 +0100)]
autotools: use -fno-strict-aliasing where supported

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

6 years agomeson: use -fno-strict-aliasing where supported
Tim-Philipp Müller [Tue, 30 Jan 2018 20:38:37 +0000 (20:38 +0000)]
meson: use -fno-strict-aliasing where supported

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

6 years agovaapi: add NULL-sentinel to kernel_names
Philippe Normand [Tue, 30 Jan 2018 12:56:49 +0000 (12:56 +0000)]
vaapi: add NULL-sentinel to kernel_names

The array needs to be NULL-terminated according to the
gst_plugin_add_dependency() documentation.

6 years agovaapipostproc: remove spurious code
Víctor Manuel Jáquez Leal [Thu, 18 Jan 2018 17:53:29 +0000 (18:53 +0100)]
vaapipostproc: remove spurious code

This assignation is dead code, since gst_video_info_from_caps() set
to 1 by default.

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

6 years agovaapipostproc: if no p-a-r in out caps define a range
Víctor Manuel Jáquez Leal [Thu, 18 Jan 2018 17:51:57 +0000 (18:51 +0100)]
vaapipostproc: if no p-a-r in out caps define a range

Instead of copying the pixel-aspect-ratio from the sink caps, define
an open range for the src caps pixel-aspect-ratio. Later it will be
defined.

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

6 years agovaapisink: check for display's color-balance properties
Víctor Manuel Jáquez Leal [Thu, 18 Jan 2018 12:10:59 +0000 (13:10 +0100)]
vaapisink: check for display's color-balance properties

Check for display's color-balance properties, available by the VA-API
driver, before setting them.

Also logs an info message of those unavailable properties.

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

6 years agoplugins: re-using buffer pool breaks renegotiation
Víctor Manuel Jáquez Leal [Wed, 17 Jan 2018 16:30:50 +0000 (17:30 +0100)]
plugins: re-using buffer pool breaks renegotiation

at propose_allocation() we should not reuse the proposed buffer,
because it could break renegotiation.

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

6 years agoplugins: use g_clear_object() to unref sinkpad_buffer_pool
Víctor Manuel Jáquez Leal [Wed, 17 Jan 2018 16:26:24 +0000 (17:26 +0100)]
plugins: use g_clear_object() to unref sinkpad_buffer_pool

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

6 years agobuild: meson: add missing GstGL dependency
Víctor Manuel Jáquez Leal [Wed, 17 Jan 2018 11:42:12 +0000 (12:42 +0100)]
build: meson: add missing GstGL dependency

6 years agolibs: utils: egl: add missing guards for GstGL
Víctor Manuel Jáquez Leal [Wed, 17 Jan 2018 11:41:54 +0000 (12:41 +0100)]
libs: utils: egl: add missing guards for GstGL

6 years agoplugins: remove dmabuf-import hack
Víctor Manuel Jáquez Leal [Thu, 11 Jan 2018 10:48:02 +0000 (11:48 +0100)]
plugins: remove dmabuf-import hack

Remove the hack to check if an upstream element has enabled the
property io-mode enabled as dmabuf-import.

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

6 years agolibs: egl: utils: use eglGetPlatformDisplay()
Víctor Manuel Jáquez Leal [Fri, 1 Dec 2017 14:04:35 +0000 (15:04 +0100)]
libs: egl: utils: use eglGetPlatformDisplay()

eglGetDisplay() is currently broken in Mesa for Wayland.  Also using
eglGetDisplay() is rather fragile, and it is recommended to use
eglGetPlatformDisplay() when possible.

In order to do that, this patch uses the helper in GstGL. If
gstreamer-vaapi is not compiled with GstGL support, eglGetDisplay()
will be used.

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

6 years agovaapipostproc: lock ensure_filter with postproc_lock
Michael Tretter [Fri, 8 Dec 2017 13:46:02 +0000 (14:46 +0100)]
vaapipostproc: lock ensure_filter with postproc_lock

gst_vaapipostproc_ensure_filter might free the allowed_srcpad_caps
and allowed_sinkpad_caps. This can race with copying these caps in
gst_vaapipostproc_transform_caps and lead to segfaults.

The gst_vaapipostproc_transform_caps function already locks
postproc_lock before copying the caps. Make sure that calls to
gst_vaapipostproc_ensure_filter also acquire this lock.

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

6 years agotests: test-filter: fix dereference before null check
Víctor Manuel Jáquez Leal [Wed, 10 Jan 2018 16:10:28 +0000 (17:10 +0100)]
tests: test-filter: fix dereference before null check

Null-checking op_info suggests that it may be null, but it has already
been dereferenced on all paths leading to the check.

There may be a null pointer dereference, or else the comparison
against null is unnecessary.

6 years agotests: y4mreader: fix string state checkup
Víctor Manuel Jáquez Leal [Wed, 10 Jan 2018 16:06:53 +0000 (17:06 +0100)]
tests: y4mreader: fix string state checkup

str cannot be null in that moment, but it may be the end of string.

6 years agotests: y4mreader: use int for fgetc
Víctor Manuel Jáquez Leal [Wed, 10 Jan 2018 15:59:56 +0000 (16:59 +0100)]
tests: y4mreader: use int for fgetc

Assigning the return value of fgetc to char truncates its value.

It will not be possible to distinguish between EOF and a valid
character.

6 years agotests: y4mreader: fix incompatible cast
Víctor Manuel Jáquez Leal [Wed, 10 Jan 2018 15:48:07 +0000 (16:48 +0100)]
tests: y4mreader: fix incompatible cast

Passed pointer in parse_int() are unsigned int (32 bits, unsigned) but
they are dereferenced as a wider long (64 bits, signed). This may lead
to memory corruption.

6 years agomeson: fix fallback for gstreamer-gl-1.0, it's now in -base
Tim-Philipp Müller [Tue, 19 Dec 2017 16:01:10 +0000 (16:01 +0000)]
meson: fix fallback for gstreamer-gl-1.0, it's now in -base

6 years agoAutomatic update of common submodule
Matthew Waters [Thu, 14 Dec 2017 03:53:27 +0000 (14:53 +1100)]
Automatic update of common submodule

From e8c7a71 to 3fa2c9e

6 years agovideoconvert: gst_element_post_message() is transfer full on msg
Nicolas Dufresne [Wed, 6 Dec 2017 21:11:46 +0000 (16:11 -0500)]
videoconvert: gst_element_post_message() is transfer full on msg

For this reson we need not to unref the message, even if it failed.

6 years agoRevert "vaapivideocontext: possible memleak when no bus attached"
Nicolas Dufresne [Wed, 6 Dec 2017 21:11:25 +0000 (16:11 -0500)]
Revert "vaapivideocontext: possible memleak when no bus attached"

This reverts commit 0438a3e62660e64ed390b6bb83bfb560b91664aa.

6 years agotest: vaapicontext: process have-context bus message
Víctor Manuel Jáquez Leal [Fri, 1 Dec 2017 22:03:32 +0000 (23:03 +0100)]
test: vaapicontext: process have-context bus message

6 years agotest: vaapicontext: app context is not persistent
Víctor Manuel Jáquez Leal [Wed, 29 Nov 2017 17:29:45 +0000 (18:29 +0100)]
test: vaapicontext: app context is not persistent

6 years agovaapivideocontext: only vaapisink process app context
Víctor Manuel Jáquez Leal [Wed, 29 Nov 2017 10:02:03 +0000 (11:02 +0100)]
vaapivideocontext: only vaapisink process app context

gst.vaapi.app.Display context is made for applications that will
provide the VA display and the native display to used by the
pipeline, when are using vaapisink as overlay. There are no use
case for encoders, decoders, neither for the postprocessor.

In the case of the vaapisink, it shall query for gst.vaapi.Display
upstream first, and then, if there is no reply,
gst.vaapi.app.Display context will be posted in the bus for the
application. If the application replies, a GstVaapiDisplay object
is instantiated given the context info, otherwise a
GstVaapiDisplay is created with the normal algorithm to guess the
graphics platform. Either way, the instantiated GstVaapiDisplay
is propagated among the pipeline and the have-message bus message.

Also only vaapisink will process the gst.vaapi.app.Display, if
and only if, it doesn't have a display already set. This is
caused because if vaapisink is in a bin (playsink, for example)
the need-context is posted twice, leading to an error state.

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

6 years agovaapivideocontext: log the name of GstVaapiDisplay
Víctor Manuel Jáquez Leal [Fri, 1 Dec 2017 19:21:54 +0000 (20:21 +0100)]
vaapivideocontext: log the name of GstVaapiDisplay

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

6 years agovaapivideocontext: possible memleak when no bus attached
Víctor Manuel Jáquez Leal [Thu, 30 Nov 2017 13:24:43 +0000 (14:24 +0100)]
vaapivideocontext: possible memleak when no bus attached

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

6 years agolibs: window: wayland: remove unused header include
Víctor Manuel Jáquez Leal [Mon, 27 Nov 2017 12:04:24 +0000 (13:04 +0100)]
libs: window: wayland: remove unused header include

Remove wayland-client.h include since there is no exposed symbols from
it.

6 years agolibs: encoder: h264,h265: guard rate control's macroblock
Víctor Manuel Jáquez Leal [Mon, 27 Nov 2017 11:18:56 +0000 (12:18 +0100)]
libs: encoder: h264,h265: guard rate control's macroblock

macroblock parameter appear on VA-API 1.0.0. It should be guarded.

6 years agoAutomatic update of common submodule
Matthew Waters [Mon, 27 Nov 2017 09:17:55 +0000 (20:17 +1100)]
Automatic update of common submodule

From 3f4aa96 to e8c7a71

6 years agolibs: encoder: h264: Add Hierarchical-B encode
Sreerenj Balachandran [Fri, 29 Jul 2016 11:58:49 +0000 (14:58 +0300)]
libs: encoder: h264: Add Hierarchical-B encode

Frames are encoded as different layers. Frame in a particular
layer will use pictures in lower or same layer as references.
Which means decoder can drop the frames in upper layer but still
decode lower layer frames.

B-frames, except the one in top most layer, are reference frames.
All the base layer frames are I or P.

eg: with 3 temporal layers

    T3:             B1            B3              B5              B7

    T2:                   B2                              B6

    T1:   I0                                P4                        P8

    T1, T2, T3: Temporal Layers
    P1...Pn:   P-Frames:
    B1...Bn:   B-frames:
    T1: I0->P4 , P4->P8 etc..
    T2: I0--> B2 <-- P4
    T3: I0--> B1 <-- B2, B2 --> B3 <-- P4

Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
https://bugzilla.gnome.org/show_bug.cgi?id=788918

6 years agolibs: encoder: h264: Add Hierarchical-P encode
Sreerenj Balachandran [Thu, 28 Jul 2016 15:33:23 +0000 (18:33 +0300)]
libs: encoder: h264: Add Hierarchical-P encode

Frames are encoded as different layers. A frame in a particular
layer will use pictures in lower or same layer as references.
Which means decoder can drop the frames in upper layer but still
decode lower layer frames.

eg: with 3 temporal layers

T3:             P1            P3              P5              P7

T2:                   P2                              P6

T1:   P0                                P4                        P8

T1, T2, T3: Temporal Layers
P1...pn:   P-Frames:
P0->P1 , P0->P2, P2->P3, P0->P4......repeat

Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
https://bugzilla.gnome.org/show_bug.cgi?id=788918

6 years agolibs: encoder: h264: Fix frame_num generation
Sreerenj Balachandran [Thu, 28 Jul 2016 13:51:28 +0000 (16:51 +0300)]
libs: encoder: h264: Fix frame_num generation

The frame_num generation was not correctly implemented.
According to h264 spec, frame_num should get incremented
for each frame if previous frame is a referece frame.

For eg: IPBPB sequece should have the frame numbers 0,1,2,2,3

Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
https://bugzilla.gnome.org/show_bug.cgi?id=788918

6 years agolibs: encoder: h264: Add new property "prediction-type"
Sreerenj Balachandran [Thu, 28 Jul 2016 12:53:48 +0000 (15:53 +0300)]
libs: encoder: h264: Add new property "prediction-type"

Adds new property "prediction-type" to select different reference
picture selection modes like hierarchical-p, hierarchical-b etc.

Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
https://bugzilla.gnome.org/show_bug.cgi?id=788918

6 years agolibs: encoder: h264: Add machinery for implementing hierarchical-prediction
XuGuangxin [Thu, 28 Jul 2016 12:12:05 +0000 (15:12 +0300)]
libs: encoder: h264: Add machinery for implementing hierarchical-prediction

Adds some basic building blocks to ease the implementation
of hierarchical prediction modes.

-- add an utility method to find temporal level of each frame
-- define max_ref_frame count based on temporal level count
-- add temporal_level_div[] for finding temporal level each frame
to be encoded.
-- find ip_period based on temporal level count

Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
https://bugzilla.gnome.org/show_bug.cgi?id=788918

6 years agolibs: encoder: h264: Add property "temporal-levels"
XuGuangxin [Thu, 28 Jul 2016 11:17:53 +0000 (14:17 +0300)]
libs: encoder: h264: Add property "temporal-levels"

Adds new property "temporal-levels" to select the number of
temporal levels to be included in the encoded stream.

Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
https://bugzilla.gnome.org/show_bug.cgi?id=788918

6 years agolibs: encoder: objects: Add a reference flag
XuGuangxin [Wed, 27 Jul 2016 13:41:01 +0000 (16:41 +0300)]
libs: encoder: objects: Add a reference flag

We can have p-frame as non-ref and also b-frame as ref
which are not supported yet. Reference flag
is the first machinery needed for more advanced
reference picture selection modes.

Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
https://bugzilla.gnome.org/show_bug.cgi?id=788918

6 years agolibs: surface: egl: add comment
Daniel van Vugt [Thu, 2 Nov 2017 12:21:34 +0000 (13:21 +0100)]
libs: surface: egl: add comment

Add a warning comment when using old intel-vaapi-drivers (>1.8.4),
where the creation of surfaces from GEM fd may fail.

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

6 years agolibs: display: egl: add gst_vaapi_display_egl_set_current_display()
Víctor Manuel Jáquez Leal [Tue, 10 Oct 2017 11:38:21 +0000 (13:38 +0200)]
libs: display: egl: add gst_vaapi_display_egl_set_current_display()

Adds a new function that changes the internal EGL display to the
current one (eglGetCurrentDisplay()) and sets the current context
too (eglGetCurrentContext()).

This new function is called by gst_vaapi_texture_egl_create() updating
the GstVaapiDisplayEGL with the current EGL display.

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

6 years agolibs: texture: egl: update EGL display and context
Víctor Manuel Jáquez Leal [Mon, 9 Oct 2017 14:02:11 +0000 (16:02 +0200)]
libs: texture: egl: update EGL display and context

It is required to use the context of the calling thread when wrapping
a foreign texture. According the documentation of
GstVideoGLTextureUploadMeta:

 "The caller of gst_video_gl_texture_upload_meta_upload() must
  have OpenGL set up and call this from a thread where it is valid
  to upload something to an OpenGL texture."

This patch updates the EGL display and context in GstVaapiDisplay
instance to the one used by te renderer that uploads the texture.

Original-patch-by: Daniel van Vugt <daniel.van.vugt@canonical.com>
https://bugzilla.gnome.org/show_bug.cgi?id=773453

6 years agoplugins: centralize assignation of GL objects
Víctor Manuel Jáquez Leal [Tue, 10 Oct 2017 17:53:04 +0000 (19:53 +0200)]
plugins: centralize assignation of GL objects

Add plugin_set_gst_gl() where the GstGL objects are assigned.

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

6 years agoplugins: set GL objects if ensured
Víctor Manuel Jáquez Leal [Tue, 10 Oct 2017 17:13:35 +0000 (19:13 +0200)]
plugins: set GL objects if ensured

Only set the GL display and GL other context if they are ensured.

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

6 years agoplugins: set GL objects if context is handled
Víctor Manuel Jáquez Leal [Tue, 10 Oct 2017 15:14:15 +0000 (17:14 +0200)]
plugins: set GL objects if context is handled

Only set the GL display and GL other context if they are extracted
correctly from the gstreamer's context.

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

6 years agoplugins: fix memory leak when GL context is created
Víctor Manuel Jáquez Leal [Tue, 10 Oct 2017 17:57:45 +0000 (19:57 +0200)]
plugins: fix memory leak when GL context is created

When the GL display and context are created inside an VAAPI element
the created GL context is leaked.

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

6 years agolibs: display: egl: free leaked memory
Víctor Manuel Jáquez Leal [Tue, 10 Oct 2017 12:01:59 +0000 (14:01 +0200)]
libs: display: egl: free leaked memory

The EGL VAAPI display forgot to release the egl display, context and
proxied VAAPI display.

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

6 years agolibs: texture: egl: code style
Víctor Manuel Jáquez Leal [Thu, 5 Oct 2017 17:25:08 +0000 (19:25 +0200)]
libs: texture: egl: code style

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

6 years agolibs: surface: egl: error message if no extension
Víctor Manuel Jáquez Leal [Wed, 4 Oct 2017 11:51:23 +0000 (13:51 +0200)]
libs: surface: egl: error message if no extension

Instead of silently fail to export the image if there is not available
the EGL_MESA_drm_image, log an error message. Also a code refactoring
was done.

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

6 years agoplugins: direct rendering on memory:VASurface
Víctor Manuel Jáquez Leal [Tue, 31 Oct 2017 12:10:50 +0000 (13:10 +0100)]
plugins: direct rendering on memory:VASurface

As buffers negotiated with memory:VASurface caps feature can also be
mapped, they can also be configured to use VA derived images, in other
words "direct rendering".

Also, because of the changes in dmabuf allocator as default allocator,
the code for configuring the direct rendering was not clear.

This patch cleans up the code and enables direct rendering when the
environment variable GST_VAAPI_ENABLE_DIRECT_RENDERING is defined,
even then the memory:VASurface cap feature is negotiated.

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

6 years agoplugins: only dmabuf on srcpad if downstream
Víctor Manuel Jáquez Leal [Wed, 4 Oct 2017 09:54:31 +0000 (11:54 +0200)]
plugins: only dmabuf on srcpad if downstream

Set if source pad can handle dmabuf only if the GstGL context comes
from downstream.

It is possible to know that at two moments:

1\ In the case of GstGLTextureUpload caps feature is negotiated and
   downstream pool reports back gst.gl.GstGLContext.

2\ When GstGLContext is found as GstContext from dowstream.

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

6 years agovaapivideocontext: add inline documentation
Víctor Manuel Jáquez Leal [Wed, 4 Oct 2017 09:52:32 +0000 (11:52 +0200)]
vaapivideocontext: add inline documentation

Document function gst_vaapi_find_gl_local_context().

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

6 years agovaapivideocontext: return the direction of gl context
Víctor Manuel Jáquez Leal [Wed, 4 Oct 2017 09:50:25 +0000 (11:50 +0200)]
vaapivideocontext: return the direction of gl context

In function gst_vaapi_find_gl_context() add a direction parameter to
return back the direction where the GstGL context was found.

This is going to be useful when checking if downstream can import
dmabuf-based buffers.

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

6 years agoplugins: add gst_vaapi_plugin_base_set_srcpad_can_dmabuf()
Víctor Manuel Jáquez Leal [Wed, 4 Oct 2017 06:30:51 +0000 (08:30 +0200)]
plugins: add gst_vaapi_plugin_base_set_srcpad_can_dmabuf()

This patch refactors the code by adding the function
vaapi_plugin_base_set_srcpad_can_dmabuf(), it determines if the passed
GstGLContext can handle dmabuf-based buffers.

The function is exposed publicly since it is intended to be used later
at GstVaapiDisplay instantiation.

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

6 years agovaapiencode: allow to set property on runtime
Hyunjun Ko [Fri, 20 Oct 2017 10:37:15 +0000 (12:37 +0200)]
vaapiencode: allow to set property on runtime

Tis patch, allows some properties that we want to be set on
runtime. (eg. bitrate)

Note that all properties are under control by num_codedbuf_queued.

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

6 years agolibs: encoder: allow to set bitrate on runtime
Hyunjun Ko [Fri, 15 Sep 2017 06:38:18 +0000 (15:38 +0900)]
libs: encoder: allow to set bitrate on runtime

In case of streaming, controlling bitrate dynamically for encoder might be
important to manage quality of the streaming.

This patch is to support such a scenario.

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

6 years agovaapidecodebin: Register element if no VPP support is available too
Sebastian Dröge [Tue, 10 Oct 2017 08:35:24 +0000 (11:35 +0300)]
vaapidecodebin: Register element if no VPP support is available too

VPP support is only needed for advanced deinterlacing, which is not
enabled by default either. Error out if it is selected but VPP is not
supported, and otherwise just work without VPP support.

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

6 years agoAvoid infinite loop when vaapi_create_display fails
Thibault Saunier [Mon, 16 Oct 2017 09:57:16 +0000 (11:57 +0200)]
Avoid infinite loop when vaapi_create_display fails

Which might be the case when using, for example, xvfb.

6 years agolibs: utils: log warn if display fail
Víctor Manuel Jáquez Leal [Mon, 2 Oct 2017 16:53:21 +0000 (18:53 +0200)]
libs: utils: log warn if display fail

gstreamer-vaapi initializes the display by trial-and-error, thus
logging an error message if the display initialisation fails the user
may be weary of the error message in the screen, if using VA-API 1.0

This commit set the VA error log handler to GStreamer warning level
while calling vaInitialize() and set it to error after that.

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

6 years agoplugins: try to create test display in order
Víctor Manuel Jáquez Leal [Fri, 29 Sep 2017 18:05:22 +0000 (20:05 +0200)]
plugins: try to create test display in order

When creating the test display for querying capabilites, it try in
certain order: DRM, Wayland and finally X11. GLX nor EGL are tried
since they are either composited with X11 or Wayland.

The reason for this is to reduce the posibility of failure that could
blacklist the plugin.

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

6 years agolibs: display: delay getting screen resolution
Víctor Manuel Jáquez Leal [Fri, 29 Sep 2017 13:07:47 +0000 (15:07 +0200)]
libs: display: delay getting screen resolution

Instead of extracting the screen resolution at GstVaapiDisplay
creation, this patch delay it until the screen size is requested for
first time.

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

6 years agolibs: display: egl: avoid two vaDisplay instantiates
Víctor Manuel Jáquez Leal [Thu, 28 Sep 2017 16:58:17 +0000 (18:58 +0200)]
libs: display: egl: avoid two vaDisplay instantiates

GstVaapiDisplayEGL is a wrapper of another GstVaapiDisplay, either X11
or Wayland. Nonetheless it created another vaDisplay for it, instead
of using the wrapped one.

This patch enables the reuse of the wrapped vaDisplay avoiding
instantiating two.

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

6 years agolibs: display: remove display_type from display info
Víctor Manuel Jáquez Leal [Thu, 28 Sep 2017 15:45:00 +0000 (17:45 +0200)]
libs: display: remove display_type from display info

Since it's no required to pass the display type in the display info,
the structure member is removed.

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

6 years agolibs: display: remove display_type member
Víctor Manuel Jáquez Leal [Thu, 28 Sep 2017 15:35:01 +0000 (17:35 +0200)]
libs: display: remove display_type member

It is not used any more since GstVaapiDisplay was ported as a
GstObject-based. This information is part of the class information.

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