Commit graph

47 commits

Author SHA1 Message Date
Sebastian Dröge
eb626d8ddc glmixer: Implement GstVideoAggregator::find_best_format()
Without this, we will fixate weird pixel-aspect-ratios like 1/2147483647. But
in the end, all the negotiation code in videoaggregator needs a big cleanup
and videoaggregator needs to get rid of the software-mixer specific things
everywhere.
2017-12-09 19:32:00 +00:00
Sebastian Dröge
51d3a0a059 Revert "gl: readd glupload/download onto element pads"
This reverts commit 87d8270f30.
2017-12-09 19:32:00 +00:00
Matthew Waters
343947f383 gl: readd glupload/download onto element pads
Allows insertion of gl elements into non-gl pipelines without converter
(upload/download) elements.

https://bugzilla.gnome.org/show_bug.cgi?id=743974
2017-12-09 19:32:00 +00:00
Vineeth T M
41af2f4ad8 glmixer: Possible null pointer dereference
While printing error message when context fails, error variable is not being used anymore
so it will lead to null pointer dereference

https://bugzilla.gnome.org/show_bug.cgi?id=748287
2017-12-09 19:31:59 +00:00
Guillaume Desmottes
e6c5410a2a glmixer: fix caps leak in gst_gl_mixer_pad_sink_getcaps()
Caps refcounting was all wrong in this function. Rewrote it and add some
comments to make it clearer.

Fix caps leaks with the
validate.file.glvideomixer.simple.play_15s.synchronized scenario.

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

Signed-off-by: Guillaume Desmottes <guillaume.desmottes@collabora.co.uk>
2017-12-09 19:31:59 +00:00
Guillaume Desmottes
ce76c66f92 glmixer: unref owned caps when finalizing the mixer
Fix a caps leak with the
validate.file.glvideomixer.simple.play_15s.synchronized scenario.

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

Signed-off-by: Guillaume Desmottes <guillaume.desmottes@collabora.co.uk>
2017-12-09 19:31:59 +00:00
Guillaume Desmottes
0511d12e4a glmixer: pass the proper free function to frames and buffers array
'array_buffers' contain borrowed GstBuffer and so shouldn't have a free
function. 'frames' is the one containing GstGLMixerFrameData and so should use
_free_glmixer_frame_data as free function.

Fix GstGLMixerFrameData leaks with the
validate.file.glvideomixer.simple.play_15s.synchronized scenario.

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

Signed-off-by: Guillaume Desmottes <guillaume.desmottes@collabora.co.uk>
2017-12-09 19:31:59 +00:00
Sebastian Dröge
bff8cde2ea gl: Remove some empty ::finalize() implementations 2017-12-09 19:31:59 +00:00
Matthew Waters
93968916a4 glsyncmeta: make context to wait and set sync explicit
otherwise we may wait on a sync object in same context by accident
2017-12-09 19:31:58 +00:00
Matthew Waters
92f0aa9bd8 gl: get the context from basemixer/basefilter 2017-12-09 19:31:57 +00:00
Matthew Waters
c562a7e2d9 glmixer: remove usage of upload/download objects 2017-12-09 19:31:57 +00:00
Matthew Waters
66b349f100 gl: add a new glbasemixer class below glmixer
It deals with propagating the gl display/contexts throughout the
application/pipeline
2017-12-09 19:31:56 +00:00
Nicolas Dufresne
ccdd4d48a0 glmixer: Don't share our downstream pool with upstream
Pool cannot have multiple owner. This can lead to spurious
pool was flushing error.

https://bugzilla.gnome.org/show_bug.cgi?id=74570
2017-12-09 19:31:56 +00:00
Sebastian Dröge
cb59ace574 gl: Remove format info in glcolorconvert's transform_caps function instead of on every caller
... and let glmixer actually transform the caps it is supposed to transform
instead of inventing new caps.
2017-12-09 19:31:56 +00:00
Matthew Waters
17dba52ff3 gl: remove the egl caps from the src pads
we don't actually support producing EGLImage buffers anywhere.
2017-12-09 19:31:54 +00:00
Matthew Waters
530ae2cbb0 glupload/download/convert: provide transform_caps functions
Allows finer grain decisions about formats and features at each
stage of the pipeline.
Also provide propose_allocation for glupload besed on the supported
methods.
2017-12-09 19:31:54 +00:00
Alessandro Decina
966cad27d7 gl: initial support for texture targets other than GL_TEXTURE_2D
Make GstGLMemory hold the texture target (tex_target) the texture it represents
(tex_id) is bound to. Modify gst_gl_memory_wrapped_texture and
gst_gl_download_perform_with_data to take the texture target as an argument.

This change is needed to support wrapping textures created outside libgstgl,
which might be bound to a target other than GL_TEXTURE_2D. For example on OSX
textures coming from VideoToolbox have target GL_TEXTURE_RECTANGLE.

With this change we still keep (and sometimes imply) GL_TEXTURE_2D as the
target of textures created with libgstgl.

API: modify GstGLMemory
API: modify gst_gl_memory_wrapped_texture
API: gst_gl_download_perform_with_data
2017-12-09 19:31:53 +00:00
Matthew Waters
02fdc64844 glvideomixer: don't upload if alpha <= 0
Implemented using a upload_buffer vfunc within GstGLMixer allowing
NULL uploaded buffers.
2017-12-09 19:31:52 +00:00
Matthew Waters
1dfeae2c42 gl: split glcolorconvert usage from glupload
the separation allows the transfer operation to occur in a separate
thread/time which may increase performance in specific circumstances.
2017-12-09 19:31:52 +00:00
Tim-Philipp Müller
3c3ca1c842 glmixer, glvideomixer: update for GstAggregatorPadForeachFunc change 2017-12-09 19:31:52 +00:00
Tim-Philipp Müller
36b4984be2 glmixer: update for aggregator start/stop vfunc change 2017-12-09 19:31:52 +00:00
Matthew Waters
4bd62ebb03 gldisplay: implement runtime GL api filtering
Needed so that the pipeline/application can limit the choice of GL api
to what it supports
2017-12-09 19:31:51 +00:00
Matthew Waters
6bb113f685 gl: add a sync meta for synchronizing across GL contexts
A context can create a GLsync object that can be waited on in order
to ensure that GL resources created in one context are able to be
used in another shared context without any chance of reading invalid
data.

This meta would be placed on buffers that are known to cross from
one context to another.  The receiving element would then wait
on the sync object to ensure that the data to be used is complete.
2017-12-09 19:31:51 +00:00
Thibault Saunier
d3fef37d61 videoaggregator: Expose vmethods to set converters and prepare/clean frames
This gives more flexibility to the subclasses and permits to remove the
GstVideoAggregatorClass->disable_frame_conversion ugly API.

WARNING: This breaks the API as it removes the disable_frame_conversion
field

API:
  + GstVideoAggregatorClass->find_best_format
  + GstVideoAggregatorPadClass->set_format
  + GstVideoAggregatorPadClass->prepare_frame
  + GstVideoAggregatorPadClass->clean_frame

  - GstVideoAggregatorClass->disable_frame_conversion

https://bugzilla.gnome.org/show_bug.cgi?id=740768
2017-12-09 19:31:50 +00:00
Matthew Waters
00506bf183 glupload: rearchitecture for non GLMemory inputs/outputs
Allows other memory types to be implemented/returned/used by the caller.
2017-12-09 19:31:50 +00:00
Matthew Waters
3455b050c2 glmixer: add read-only context property 2017-12-09 19:31:50 +00:00
Matthew Waters
af9b73043e gl: remove the width/height fields from the caps to support frame resizing
It was previously only occuring with sysmem caps features

https://bugzilla.gnome.org/show_bug.cgi?id=739334
2017-12-09 19:31:49 +00:00
Matthew Waters
b06ca547d6 glmixer: advertise support for changing input caps mid-stream
https://bugzilla.gnome.org/show_bug.cgi?id=739334
2017-12-09 19:31:49 +00:00
Matthew Waters
4a8b7c9193 glmixer: don't get the current caps from GstVideoInfo for the srcpad
It's missing the caps features needed.
2017-12-09 19:31:49 +00:00
Wang Xin-yu (王昕宇)
10eb848d57 glmixer:fix incorrect parameter passed to handle_set_context 2017-12-09 19:31:48 +00:00
Matthew Waters
0b2e5c3f95 glmixer: override the caps query in order to 'convert' capsfeatures
Otherwise, it is only possible for the sink pads and the src pads to
have the exact same caps features.  We can convert from any feature
to another feature so support that.
2017-12-09 19:31:48 +00:00
Matthew Waters
1bd6e87cfc glmixer: override the accept caps query in order to 'convert' capsfeatures
Otherwise, it is only possible for the sink pads and the src pads to
have the exact same caps features.  We can convert from any feature
to another feature so support that.
2017-12-09 19:31:48 +00:00
Matthew Waters
62e3c40d97 gl: propogate other-context using GstContext 2017-12-09 19:31:48 +00:00
Matthew Waters
f0426043ce glmixer: fixup eglimage include path 2017-12-09 19:31:48 +00:00
Matthew Waters
0806de5c75 glbufferpool: add the GstVideoGLTextureUploadMeta buffer pool option 2017-12-09 19:31:48 +00:00
Matthew Waters
3cccd77d5d videoaggregator: operate on caps rather than video info
Otherwise the CapsFeatures will be lost along with the possibility
of multiple output types and formats.

https://bugzilla.gnome.org/show_bug.cgi?id=738129
2017-12-09 19:31:48 +00:00
Sebastian Dröge
3eab72f409 glmixer: Call the pad's parent class finalize method 2017-12-09 19:31:48 +00:00
Sebastian Dröge
aed7da3d12 glmixer: Only finalize the other context in finalize()
Otherwise we change a value of a property when going to READY state,
which is unexpected behaviour.
2017-12-09 19:31:48 +00:00
Sebastian Dröge
9d1df014fd glmixer: Add other-context property 2017-12-09 19:31:48 +00:00
Matthew Waters
ae919f4475 gl: download whenever we have sysmem capsfeatures
Otherwise we could pass on a RGBA formatted buffer and downstream would
misinterpret that as some other video format.

Fixes pipelines of the form

    gleffects ! tee ! xvimagesink
2017-12-09 19:31:46 +00:00
Matthew Waters
6491af9ffc glupload: provide the output buffer that is rendered into
Allows callers to properly reference count the buffers used for
rendering.

Fixes a redraw race in glimagesink where the previous buffer
(the one used for redraw operations) is freed as soon as the next
buffer is uploaded.

1. glimagesink uploads in _prepare() to texture n
1.1 glupload holds buffer n
2. glimagesink _render()s texture n
3. glimagesink uploads texture n+1
3.1 glupload free previous buffer which deletes texture n
3.2 glupload holds buffer n+1
4. glwindow resize/expose
5. glimagesink redraws with texture n

The race is that the buffer n (the one used for redrawing) is freed as soon as
the buffer n+1 arrives.  There could be any amount of time and number of
redraws between this event and when buffer n+1 is actually rendered and thus
replaces buffer n as the redraw source.

https://bugzilla.gnome.org/show_bug.cgi?id=736740
2017-12-09 19:31:46 +00:00
Sanjay NM
4f6e9f4e41 gl: Removed unreachable break, unused variable
https://bugzilla.gnome.org/show_bug.cgi?id=736957
2017-12-09 19:31:46 +00:00
Ognyan Tonchev
276b682559 glmixer: do not leak pool in error cases
https://bugzilla.gnome.org/show_bug.cgi?id=736729
2017-12-09 19:31:46 +00:00
Matthew Waters
94efcd2595 glmixer: unref the GstGLUpload in the pad if freed while running
Dynamic pipelines that get and release the sink pads will finalize
the pad without going through gst_gl_mixer_stop() which is where the
upload object is usually freed.  Don't leak objects in such case.
2017-12-09 19:31:45 +00:00
Wang Xin-yu (王昕宇)
922cb97758 glvideomixer: avoid gl resource race condition between different thread
https://bugzilla.gnome.org/show_bug.cgi?id=734830
2017-12-09 19:31:45 +00:00
Wang Xin-yu (王昕宇)
2ce11e4bac gl: fix multi gl object leaks
1. fix FBO leaks in decide_allocation
2. fix texture leaks in decide_allocation and reset
3. fix texture leaks in FBO incomplete error path
2017-12-09 19:31:44 +00:00
Sebastian Dröge
ab7a152cd4 gl: Move GstGLMixer to the plugin for now
It depends on GstAggregator and we don't want to install headers
for that yet.

https://bugzilla.gnome.org/show_bug.cgi?id=732207
2017-12-09 19:31:44 +00:00
Renamed from gst-libs/gst/gl/gstglmixer.c (Browse further)