After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 734223 - glimagesink: last-sample property useless for planar YUV formats
glimagesink: last-sample property useless for planar YUV formats
Status: RESOLVED OBSOLETE
Product: GStreamer
Classification: Platform
Component: gst-plugins-base
git master
Other Linux
: Normal normal
: git master
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2014-08-04 09:47 UTC by Sebastian Dröge (slomo)
Modified: 2018-11-03 11:30 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
convert_frame test program (1.52 KB, text/x-c)
2014-09-04 11:20 UTC, Matthew Waters (ystreet00)
  Details
glimagesink: set the caps features to sysmem for last-sample (3.18 KB, patch)
2015-05-25 14:01 UTC, Matthew Waters (ystreet00)
none Details | Review

Description Sebastian Dröge (slomo) 2014-08-04 09:47:36 UTC
W/GStreamer+default(10996): 0:00:05.788143615 0x608b7af0 gstglutils.c:522:gst_gl_context_set_error Cannot download GL luminance/luminance alpha textures

This makes the convert-sample and last-sample properties on playbin useless with planar YUV formats. Can we somehow keep around the original data until it is changed in GL and use that for mapping instead of downloading from GL?
Comment 1 Matthew Waters (ystreet00) 2014-08-04 12:36:43 UTC
IIUC, what glimagesink receives as the input buffer is the buffer that is stored in the last-sample property.  The uploaded RGBA texture is a separate GstBuffer stored internal to glimagesink.  If you already have GLMemory (or EGL images) being passed then you are going to have to download no matter what you try and do with glimagesink.

What's upstream of glimagesink?
Comment 2 Sebastian Dröge (slomo) 2014-08-04 12:45:21 UTC
avdec_h264 :)

I worked around this by inserting a tee in front of glimagesink (as tee will drop the ALLOCATION query). The problem seems to be that the GL bufferpool is used upstream.
Comment 3 Matthew Waters (ystreet00) 2014-08-04 12:54:53 UTC
Hmm, so planar YUV buffers should be passed in avdec_h264 ! glimagesink which should not have the NEED_DOWNLOAD memory flag set which should just return the data pointer used to upload.
Comment 4 Matthew Waters (ystreet00) 2014-08-04 12:55:19 UTC
Need to figure out which part of that breaks :)
Comment 5 Nicolas Dufresne (ndufresne) 2014-08-04 14:43:07 UTC
I think a simple solution is to make GlMemory a bit more lazy, and not upload right away on unmap() calls.
Comment 6 Matthew Waters (ystreet00) 2014-08-05 01:07:41 UTC
It's already as lazy as it could be... It doesn't upload on unmap... It only sets a flag that determines if the next map call requires an upload.
Comment 7 Matthew Waters (ystreet00) 2014-09-04 11:07:30 UTC
It seems as thought the convert-sample machinery ends up making a copy of the memory.  As we only copy the GPU side memory, the original data is lost for the memory used to download.

Looking at basesrc, it makes the buffer writable to mark a discontinuity.

(gdb) bt

Thread 1 (Thread 0x7ffff7fc0700 (LWP 20764))

  • #0 ppoll
    from /usr/lib/libc.so.6
  • #1 gst_poll_wait
    at gstpoll.c line 1248
  • #2 gst_bus_timed_pop_filtered
    at gstbus.c line 542
  • #3 gst_video_convert_sample
    at convertframe.c line 303
  • #4 gst_play_sink_convert_sample
    at gstplaysink.c line 3956
  • #5 ffi_call_unix64
    from /usr/lib/libffi.so.6
  • #6 ffi_call
    from /usr/lib/libffi.so.6
  • #7 g_cclosure_marshal_generic
    at gclosure.c line 1445
  • #8 g_closure_invoke
    at gclosure.c line 768
  • #9 signal_emit_unlocked_R
    at gsignal.c line 3589
  • #10 g_signal_emit_valist
    at gsignal.c line 3317
  • #11 g_signal_emit_by_name
    at gsignal.c line 3403
  • #12 main
    at convert_frame.c line 30

Comment 8 Sebastian Dröge (slomo) 2014-09-04 11:20:29 UTC
Yay, so we should probably share the other memory somehow too? And ideally not copy but share :)
Comment 9 Matthew Waters (ystreet00) 2014-09-04 11:20:41 UTC
Created attachment 285348 [details]
convert_frame test program

This is a test program to reproduce the issue with.
Comment 10 Matthew Waters (ystreet00) 2015-02-28 07:32:56 UTC
Possibly half fixed by

commit 08b1d27e14e28ed028d73de1e5f7ec2e9c0a0d71
Author: Matthew Waters <matthew@centricular.com>
Date:   Wed Feb 25 00:00:48 2015 +1100

    glmemory: allow sharing between buffers
    
    There was no real reason why the flag was set.  We should be able
    to handle it.  Fixes last-sample handling on gl sinks
Comment 11 Matthew Waters (ystreet00) 2015-05-25 14:01:42 UTC
Created attachment 303923 [details] [review]
glimagesink: set the caps features to sysmem for last-sample

So here's a patch that fixes the issue.

My question about it is if one, it's ok to mangle with the caps on the sample like this to allow videoconvert to negotiate with appsrc in the convert-sample machinery.  The second question is whether the caps should also include the original GLMemory caps features so that applications can still detect GL textures with caps features.
Comment 12 Julien Isorce 2017-09-06 13:36:28 UTC
Any update on this ?
Comment 13 Matthew Waters (ystreet00) 2017-09-06 13:54:53 UTC
No
Comment 14 GStreamer system administrator 2018-11-03 11:30:59 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/issues/129.