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 743677 - gl: new element caopengllayersink
gl: new element caopengllayersink
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-bad
git master
Other Mac OS
: Normal enhancement
: 1.5.1
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2015-01-29 07:36 UTC by Matthew Waters (ystreet00)
Modified: 2015-02-24 08:15 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
new caopengllayersink element (36.21 KB, patch)
2015-01-29 07:37 UTC, Matthew Waters (ystreet00)
none Details | Review
new caopengllayersink element (36.63 KB, patch)
2015-02-17 09:04 UTC, Matthew Waters (ystreet00)
none Details | Review

Description Matthew Waters (ystreet00) 2015-01-29 07:36:31 UTC
This is a new element that renders to a CAOpenGLLayer.  The layer is retrievable through a property on the element that can then be used like a normal CALayer.
Comment 1 Matthew Waters (ystreet00) 2015-01-29 07:37:03 UTC
Created attachment 295724 [details] [review]
new caopengllayersink element
Comment 2 Sebastian Dröge (slomo) 2015-02-04 09:16:06 UTC
It would be good if _ensure_gl_setup() would be called in NULL->READY state change. Otherwise it would be very difficult for the application to get the layer.
Comment 3 Matthew Waters (ystreet00) 2015-02-09 02:24:03 UTC
Ah, now I remember why I didn't do that.  Calling _ensure_gl_setup() tries to setup the GL context which the cocoa backend needs to run stuff on the main thread.  Deadlock ensues due to cocoa waiting for the _ensure_gl_setup to complete which is waiting for the cocoa stuff to initialize in the main thread.

One solution is to make Cocoa multi-threaded much like the X11 backend by initializing a dummy NSThread and not do the GL initialisation in the main thread.
Comment 4 Sebastian Dröge (slomo) 2015-02-10 15:26:57 UTC
Not sure if that is possible, we also call some UI related things which are probably not possible from a non-main thread.


But alternatively, just make sure to the emit "notify::layer" signal so applications know when the layer is there. And maybe also a custom GstMessage on the bus so applications don't have to worry about getting signals from random threads.
Comment 5 Matthew Waters (ystreet00) 2015-02-11 09:31:34 UTC
(In reply to Sebastian Dröge (slomo) from comment #4)
> Not sure if that is possible, we also call some UI related things which are
> probably not possible from a non-main thread.

It is possible, you just need to start a NSThread somewhere and Cocoa becomes multithreaded much like XInitThreads [0].  It's also possible to draw on separate threads [1] although on ios UIView's are main thread only but with CoreAnimation it is all possible to draw on a secondary thread.

[0] http://stackoverflow.com/questions/5908728/is-there-any-way-to-enter-cocoa-multithreaded-mode-without-creating-fake-nsthrea
[1] http://stackoverflow.com/questions/19954424/multiple-threads-to-draw-in-nsview
Comment 6 Matthew Waters (ystreet00) 2015-02-17 09:04:02 UTC
Created attachment 296992 [details] [review]
new caopengllayersink element
Comment 7 Matthew Waters (ystreet00) 2015-02-24 08:15:52 UTC
commit e505f6257cb938483f675891967cbb2810c9531c
Author: Matthew Waters <matthew@centricular.com>
Date:   Mon Jan 19 12:43:23 2015 +1100

    applemedia: new AVSampleBufferLayerSink
    
    Renders buffers using the CALayer subclass AVSampleBufferDisplayLayer
    which can be placed inside a Core Animation render tree.