Commit graph

2468 commits

Author SHA1 Message Date
Hyunjun Ko
d94001b820 vaapiencode: implement flush() vmethod
In order to handle correctly seek and other operations, vaapiencode should
flush all the remaining data from the encoder without pushing it downstream.

This patch implements the flush() vmethod, only after of pausing the
source pad task, and restarting it again after the flush stop.

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

Signed-off-by: Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com>
2016-07-11 19:03:52 +02:00
Víctor Manuel Jáquez Leal
fcc08627e5 decoder: vc1: flush dpb only if opened
Flush the decode picture buffer, if and only if, the decoder is
started. Otherwise the dpb structure might be NULL.

https://bugzilla.gnome.org/show_bug.cgi?id=742922
2016-07-11 10:44:06 +02:00
Hyunjun Ko
19c0c8a973 vaapidecode: drop non-keyframe in reverse playback
To avoid surface-exhausted situation during reverse playback,
drop frames except for key frame.

Also, to avoid the corruption of the parser state, flush() vmethod
doesn't destroy the VA decoder when playing in reverse.

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

Signed-off-by: Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com>
2016-07-11 10:42:46 +02:00
Víctor Manuel Jáquez Leal
c9a5801c35 vaapidecode: unref output frame earlier
The queue in GstVaapiDecode adds an extra reference to the frames. This patch
unref that extra reference earlier making the code simpler to follow.

https://bugzilla.gnome.org/show_bug.cgi?id=768652
2016-07-11 10:40:15 +02:00
Víctor Manuel Jáquez Leal
cb0ec6b60c vaapidecode: remove gst_vaapidecode_internal_flush()
As gst_vaapidecode_finish() is the only callee of
gst_vaapidecode_internal_flush(), it is better to inline it.

https://bugzilla.gnome.org/show_bug.cgi?id=768652
2016-07-11 10:40:14 +02:00
Víctor Manuel Jáquez Leal
b392b4f064 vaapidecode: flush output adapter at drain()
Calling drain() vmethod means "decode any data it can at this point, but that
more data may arrive after". Hence, vaapidecode should check if there is data
in the output adapter and process them, without destroying the decoded picture
buffer (dpb).

Since this operation is done by gst_vaapidecode_internal_flush(), the operation
was refactored into a new function gst_vaapidecode_flush_output_adapter().

https://bugzilla.gnome.org/show_bug.cgi?id=768652
2016-07-11 10:40:14 +02:00
Víctor Manuel Jáquez Leal
03e85bbc0f vaapidecode: call purge at flush()
Calling flush() vmethod means "to flush all remaining data from the decoder
without pushing it downstream".

Nonetheless flush() is calling gst_vaapidecode_internal_flush(), which calls
gst_video_decoder_have_frame() if there is still something in the input
adapter, which may push buffers to downstream by calling handle_frame().

This patch changes this behavior by calling gst_vaapidecode_purge() rather
than gst_vaapidecode_internal_flush(), which does what we want: flushes the VA
decoder and releases all the rest of decoded frames.

https://bugzilla.gnome.org/show_bug.cgi?id=768652
2016-07-11 10:40:14 +02:00
Víctor Manuel Jáquez Leal
6970dc1277 test: elements: remove spurious linkage
Element tests only need to link against gstreamer libraries.
2016-07-06 18:38:37 +02:00
Sebastian Dröge
f7ea48597e configure: Require GLib >= 2.40 like everywhere else 2016-07-06 14:41:21 +03:00
Sebastian Dröge
9bc53dd3ca Back to development 2016-07-06 13:51:21 +03:00
Sebastian Dröge
27c55d34ed Release 1.9.1 2016-07-06 13:48:07 +03:00
Víctor Manuel Jáquez Leal
2310273a69 tests: elements: rotate orientation event 2016-07-05 21:01:52 +02:00
Hyunjun Ko
da4d916a8c tests: elements: Add testsuite for vaapisink
https://bugzilla.gnome.org/show_bug.cgi?id=765798
2016-07-05 21:01:38 +02:00
Hyunjun Ko
e8fabf6a99 vaapisink: add support for GST_TAG_IMAGE_ORIENTATION
https://bugzilla.gnome.org/show_bug.cgi?id=765798
2016-07-05 20:17:12 +02:00
Víctor Manuel Jáquez Leal
649c00d3c7 vaapipostproc: return caps template if no display
This patch is a fix for my bad review of commit 6d73ca8d. The element should
be able to return the available raw caps handled by the VA display, but that
only should happen when there a VA display. If there's none, the element
should use the caps template.

https://bugzilla.gnome.org/show_bug.cgi?id=768161
2016-06-29 14:05:18 +02:00
Matthew Waters
6d73ca8da2 vaapipostproc: don't require a vaapi display for all caps queries
This delays the requirement of having a GstVaapiDisplay until later

https://bugzilla.gnome.org/show_bug.cgi?id=768161
2016-06-29 21:35:06 +10:00
Víctor Manuel Jáquez Leal
22647090be utils: report VP9 profiles
Add VP9Profile0-3 name mapping.
2016-06-28 16:34:30 +02:00
Víctor Manuel Jáquez Leal
326011af58 vaapi: nest includes under USE_ENCODER macro
This is a missed changeset from commit 1c05c53, since also header includes
should be nested.
2016-06-28 16:33:55 +02:00
Víctor Manuel Jáquez Leal
1c05c53b02 vaapi: nest encoders under USE_ENCODER macro
Though USE_{JPEG,VP8,VP9,H265}_ENCODER macros definition depend on USE_ENCODER
macro, it is clearer to nest them, showing explicitly the dependency relation.
2016-06-28 11:54:33 +02:00
Víctor Manuel Jáquez Leal
80c4396830 vaapivideocontext: check if query context is NULL
Under certain conditions the element might receive a positive context query
but without a context instance. This situation will lead to a segmentation
fault when traversing the context list in the pipeline.

https://bugzilla.gnome.org/show_bug.cgi?id=767946
2016-06-24 12:24:55 +02:00
Scott D Phillips
60cd511fad remove unused glibcompat.h
glibcompat.h is no longer doing anything. Remove it.

Signed-off-by: Scott D Phillips <scott.d.phillips@intel.com>

https://bugzilla.gnome.org/show_bug.cgi?id=767886
2016-06-23 12:47:52 +02:00
Scott D Phillips
4aec5bdd72 encoder: h264: Use high profile by default
Change defaults for max-bframes, cabac, and dct8x8 to be enabled
by default. This will cause the default profile to be high instead
of baseline. In most situations this is the right decision, and
the profile can still be lowered in the case of caps restrictions.

Signed-off-by: Scott D Phillips <scott.d.phillips@intel.com>

https://bugzilla.gnome.org/show_bug.cgi?id=757941
2016-06-23 12:28:50 +02:00
Víctor Manuel Jáquez Leal
55e244817d vaapidecodebin: element warning if missing element
Raise an element warning if a required element is not available, thus the
pipeline will post a warning message and the application will be informed.
2016-06-23 12:25:39 +02:00
Hyunjun Ko
05cf583c97 decoder: h265: fix to release all dpb pictures
Without this, all dpb pictures are not released during flush,
because we used the global dpb_count variable for checking the
dpb fullness which get decremented in dpb_remove_index()
routine during each loop iteration.

https://bugzilla.gnome.org/show_bug.cgi?id=767934
2016-06-22 15:11:56 +03:00
Nicolas Dufresne
c5681cff6a Automatic update of common submodule
From ac2f647 to f363b32
2016-06-21 11:48:54 -04:00
Hyunjun Ko
2fb05613a0 vaapi: fix minor leaks
https://bugzilla.gnome.org/show_bug.cgi?id=767868
2016-06-21 11:08:48 +03:00
Víctor Manuel Jáquez Leal
fc8fbddc5c vaapi: remove an already included header
gst/gst.h is already included in gstcompat.h
2016-06-17 18:16:09 +02:00
Víctor Manuel Jáquez Leal
c3c7f08e5d vaapidecodebin: add vp9 in sink pad template 2016-06-17 18:16:09 +02:00
Víctor Manuel Jáquez Leal
aee9166c7f vaapisink: return caps template if no display
If vaapisink received a caps query before getting a VA display, it returned
only the surfaces related caps. This behavior broke the autovideosink
negotiation.

This patch returns the pad's template caps if no VA display, otherwise the
caps are crafted as before.

https://bugzilla.gnome.org/show_bug.cgi?id=767699
2016-06-16 13:18:15 +02:00
Scott D Phillips
57ee937b8c decoder: vp9: Update comment about context resets
Clarify that vaapi context resets are never needed for vp9, but
that ensure_context() needs called when the size increases so that
new surfaces can be allocated.

Signed-off-by: Scott D Phillips <scott.d.phillips@intel.com>

https://bugzilla.gnome.org/show_bug.cgi?id=767474
2016-06-15 20:50:20 +02:00
Scott D Phillips
ad9fcb9386 gstvaapicontext: control reset_on_resize with option
Signed-off-by: Scott D Phillips <scott.d.phillips@intel.com>

https://bugzilla.gnome.org/show_bug.cgi?id=767474
2016-06-15 20:50:20 +02:00
Scott D Phillips
b5bf2e83f7 vaapivideobufferpool: add video meta to config when needed
In cases where we know the video meta must be present, add it to
the pool configuration.

Signed-off-by: Scott D Phillips <scott.d.phillips@intel.com>

https://bugzilla.gnome.org/show_bug.cgi?id=766184
2016-06-15 15:44:00 +02:00
Scott D Phillips
2e5367a23c plugins: retry pool config
if gst_buffer_pool_set_config returns FALSE, check the modified
config and retry set_config if the config is still acceptable.

Signed-off-by: Scott D Phillips <scott.d.phillips@intel.com>

https://bugzilla.gnome.org/show_bug.cgi?id=766184
2016-06-14 17:25:58 +02:00
Víctor Manuel Jáquez Leal
fec82052d5 vaapivideomemory: internal attributes to methods
Mark as internal the functions used by VA-API dmabuf allocator.
2016-06-08 19:20:33 +02:00
Víctor Manuel Jáquez Leal
f189af8dc5 plugins: remove precondition for decide_allocation()
There's no need to check for the display in the plugin object when
decide_allocation() vmethod is called, because the display will created or
re-created along the method execution.
2016-06-08 19:20:33 +02:00
Víctor Manuel Jáquez Leal
4c99077af4 plugins: avoid possible memory leaks
Get the pool config just before use it, to avoid a memory leak if the
allocator cannot be instantiated. Similarly, return FALSE if the configuration
cannot be set, avoid keep a not used allocator in the pool.
2016-06-08 19:20:33 +02:00
Víctor Manuel Jáquez Leal
8d7a0ae16c plugins: use GstParentBufferMeta
Instead of using the VASurface proxy's notify, which is internal gstvaapi API,
use the GStreamer's GstParentBufferMeta.

https://bugzilla.gnome.org/show_bug.cgi?id=765435
2016-06-08 10:19:01 +02:00
Víctor Manuel Jáquez Leal
8292acfdd4 plugins: cache VASurfaces from dmabufs
This patch avoids the creation of a VASurface each time a new input buffer is
processed, caching them in the input buffer itself.

https://bugzilla.gnome.org/show_bug.cgi?id=765435
2016-06-08 10:19:01 +02:00
Víctor Manuel Jáquez Leal
73d1228896 libs: change gst_vaapi_surface_new_with_dma_buf_handle()
Instead of passing the data already in GstVideoInfo, let's just pass the
GstVideoInfo structure.

https://bugzilla.gnome.org/show_bug.cgi?id=765435
2016-06-08 10:19:01 +02:00
Víctor Manuel Jáquez Leal
ad4c38b36f plugins: use an unique allocator per pad
Instead of instantiating an allocator per vaapivideobufferpool, only one
allocator is instantiated per element's pad and shared among future pools.
If the pad's caps changes, the allocator is reset.

https://bugzilla.gnome.org/show_bug.cgi?id=765435
2016-06-08 10:19:01 +02:00
Víctor Manuel Jáquez Leal
6c5b6232da vaapivideobufferpool: share options flag with pluginbase
Originally, vaapivideobufferpool has a set of boolean variables for the
buffer configuration options.

This pach changes these boolean variables for a single bitwise, just as
it is used in pluginbase. Hence, the internal enum was moved to
vaapivideobufferpool header.

https://bugzilla.gnome.org/show_bug.cgi?id=765435
2016-06-08 10:19:01 +02:00
Víctor Manuel Jáquez Leal
d0c72182a4 plugins: add gst_vaapi_plugin_base_create_pool()
This patch refactors the code in pluginbase in order to centralize the buffer
pool instantiation. As the buffer pool config may have different options, these
are gathered using a bitwise flag.

https://bugzilla.gnome.org/show_bug.cgi?id=765435
2016-06-08 10:19:01 +02:00
Víctor Manuel Jáquez Leal
50b2423a2b pluginbase negotiates allocator with bufferpool
Originally vaapivideobufferpool instantiates its own allocator regardless the
received configuration, and it relies in custom configuration options to
choose which kind of allocator instantiate.

This patch transfers the responsibility of the allocator instantiate to
vaapipluginbase and pass it to the vaapivideobufferpool through its
configuration.

* gst/vaapi/gstvaapipluginbase.c
  + set_dmabuf_allocator(): inserts a dmabuf allocator in the bufferpool
  + ensure_sinkpad_buffer_pool(): set a normal vaapi video allocator in
    bufferpool configuration
  + gst_vaapi_plugin_base_propose_allocation(): call set_dmabuf_allocator() if
    needed.
  + gst_vaapi_plugin_base_decide_allocation(): set a normal vaapi video
    allocator in bufferpool configuration
* gst/vaapi/gstvaapivideobufferpool.c
  + gst_vaapi_video_buffer_pool_set_config(): instead of instantiate the
    allocator, process the received one through its configuration.
* gst/vaapi/gstvaapivideobufferpool.h: removed
  GST_BUFFER_POOL_OPTION_DMABUF_MEMORY since it is not used anymore.
* gst/vaapi/gstvaapivideomemory.c
  + gst_vaapi_is_dmabuf_allocator(): new helper function to identify a dmabuf
    allocator with the vaapi qdata.

https://bugzilla.gnome.org/show_bug.cgi?id=765435
2016-06-08 10:19:01 +02:00
Víctor Manuel Jáquez Leal
2643ae980a vaapivideobufferpool: keep only current video info
Instead of keeping old and new GstVideoInfo video structure, we only keep one,
the current one, the negotiated. The old one is not needed at all.

https://bugzilla.gnome.org/show_bug.cgi?id=765435
2016-06-08 10:19:01 +02:00
Víctor Manuel Jáquez Leal
3d9f8dd41f pluginutil: add gst_video_info_force_nv12_if_encoded()
This lines repeat a couple times in the code, so it would be better to put it
a helper function.

https://bugzilla.gnome.org/show_bug.cgi?id=765435
2016-06-08 10:19:01 +02:00
Víctor Manuel Jáquez Leal
2562cd51be pluginutil: add gst_video_info_changed() helper
This function is shared among different elements, so let factorized it.

https://bugzilla.gnome.org/show_bug.cgi?id=765435
2016-06-08 10:19:01 +02:00
Hyunjun Ko
08ee0f9e78 vaapipostproc: Add colorimetry attributes to src caps
https://bugzilla.gnome.org/show_bug.cgi?id=766596
2016-06-08 10:17:02 +02:00
Hyunjun Ko
1e52269b89 vaapidecode: remove chroma-site and colorimetry from src caps
https://bugzilla.gnome.org/show_bug.cgi?id=766596
2016-06-08 10:17:02 +02:00
Scott D Phillips
4791e9f2ea vaapipostproc: add postproc_lock to protect data members
Add a mutex to postproc to protect concurrent access to data members.
Previously set_caps() could release the allowed_srcpad_caps while
transform_caps was in the middle of using it.

Signed-off-by: Scott D Phillips <scott.d.phillips@intel.com>

https://bugzilla.gnome.org/show_bug.cgi?id=766940
2016-06-08 10:03:59 +02:00
Sreerenj Balachandran
76c2e5fdb5 encoder: vp9: Add simple algorithms for reference picture selection
Added two modes(as properties) for reference picture selection:

ref-mode-0: AltRef and GoldRef pointing to the recent keyframe
and LastRef is pointing to the previous frame.

ref-mode-1: Previous frame (n) as LastRef , n-1 th frame as GoldRef
and n-2 th frame as AltRef

https://bugzilla.gnome.org/show_bug.cgi?id=766048
2016-05-30 12:18:04 +03:00