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 728107 - gl: No surface resizing logic on Android/iOS
gl: No surface resizing logic on Android/iOS
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-bad
git master
Other Linux
: Normal normal
: 1.3.1
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2014-04-13 08:34 UTC by Sebastian Dröge (slomo)
Modified: 2014-04-13 14:56 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Sebastian Dröge (slomo) 2014-04-13 08:34:32 UTC
On Android and iOS when the surface is resized, glimagesink does not notice this and continues to render for the old surface size. Especially this means that the video is only rendered in the original size.

Both platforms seem to provide nothing for getting notified about such changes, so in eglglessink we were polling for changes before rendering each frame.

On Android (EGL) you can query the EGL_WIDTH and EGL_HEIGHT of the surface, on iOS you can get the CAEAGLLayer's frame.size.
Comment 1 Sebastian Dröge (slomo) 2014-04-13 09:27:43 UTC
Matthew, Julien, any ideas how to best integrate this into gst-plugins-gl? We could poll manually before each draw in the GstGLWindow subclasses, and if size changes call the resize callback... but is that enough? And it doesn't seem very elegant...
Comment 2 Matthew Waters (ystreet00) 2014-04-13 10:45:12 UTC
If nobody can tell us that the window size has changed i guess we have to check every draw.  When all of the other implementations detect a resize (normally from the window system), they resize their window and call the resize callback.  If the window resize is handled by the underlying window system, then the callback is all that is required to be called.
Comment 3 Sebastian Dröge (slomo) 2014-04-13 10:53:41 UTC
I'll take a look at implementing that then.
Comment 4 Julien Isorce 2014-04-13 13:20:55 UTC
There are some options:

1: do like osxvideosink, i.e. manage an internal UIView and then set it as a subview (addSubView) of the one you get from gst_set_window_handle. Then in you internal UIView you could override "layoutSubviews" method. For the NSView it was the "reshape" method.
(By the way I noticed osxvideosink implement navigation interface, shouldn't be hard to move that code in cocoa backend of gstgl)

2: do like in cocoa backend of gstgl, not sure if this is practical here as I decided to pass the NSWindow handle. But then it relies on the NSView too. "reshape" method here too.

3: add an observer to  "bounds" property of the UIView you get from gst_set_window_handle. Not sure what would be the result but worth to try.

4: Override UIView::layoutSubviews in your application but then it would requires to add a new function to the GstVideoOverlay. gst_video_overlay_set_window_size. (or modify the description of gst_video_overlay_set_window_rectangle)
waylandsink is in this 4th situation when using subsurface/st_window_handle, http://cgit.collabora.com/git/user/gkiagia/gst-wayland-gtk-demo.git/tree/main.c#n177 (gst_wayland_video_set_surface_size) . For me it would make sense to add gst_video_overlay_set_window_size for this purpose.

With iOS/UIView I'm not sure in which situation you will fall but polling is not the right thing to do.
So if possible do it the way Matthew described, if not your are in case 4.
Comment 5 Sebastian Dröge (slomo) 2014-04-13 14:56:22 UTC
commit 39c3ae5e5a717db507daad54dc6a7775a2fc09e3
Author: Sebastian Dröge <sebastian@centricular.com>
Date:   Sun Apr 13 16:53:58 2014 +0200

    gl/eagl: Notify the window's resize callback about surface dimension changes
    
    https://bugzilla.gnome.org/show_bug.cgi?id=728107

commit 158cbc2cdf596ff5c21fea04501029e3bea5b0a3
Author: Sebastian Dröge <sebastian@centricular.com>
Date:   Sun Apr 13 16:46:11 2014 +0200

    gl/eagl: Remove spurious private struct pointer

commit e927d307203306a82ec67e096bc946a7bf9f7eec
Author: Sebastian Dröge <sebastian@centricular.com>
Date:   Sun Apr 13 16:40:58 2014 +0200

    gl/android: Notify the window's resize callback about surface dimension changes
    
    https://bugzilla.gnome.org/show_bug.cgi?id=728107