summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMart Raudsepp <mart@leio.tech>2020-11-26 14:52:26 +0200
committerGStreamer Merge Bot <gitlab-merge-bot@gstreamer-foundation.org>2020-12-04 17:29:24 +0000
commite30272d3d06d0fcdedfab519b80e0f338edb54e0 (patch)
tree742a8b2e1a23090cb23123bc20adb72b4a5e7efe
parent0854d168e99c53bf8fcaae4228aa2070a28d2c70 (diff)
downloadgstreamer-plugins-base-e30272d3d06d0fcdedfab519b80e0f338edb54e0.tar.gz
gl/eagl: Fix automatic resize behaviour
https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/681 added a layoutSubViews, which never gets called, because it should have been called layoutSubviews (non-capital "v"). However after fixing that, it still doesn't work correctly, because window_width/height values are immediately updated and then draw_cb will never trigger the resize path, because the values are already up to date. Update the values inside the resize path again instead, so the check for entering the resize path is logically always correct. This makes the layoutSubviews unnecessary, as it only updated the internal size values prematurely, so it is deleted instead of method naming fixed. These changes were originally done to avoid accessing UIKit objects on the main thread, but no additional accesses are added here, only internal private variable assignments under the same draw_lock, so there should be no threading issues reintroduced. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/960>
-rw-r--r--gst-libs/gst/gl/eagl/gstglwindow_eagl.m13
1 files changed, 3 insertions, 10 deletions
diff --git a/gst-libs/gst/gl/eagl/gstglwindow_eagl.m b/gst-libs/gst/gl/eagl/gstglwindow_eagl.m
index b7364be07..482605beb 100644
--- a/gst-libs/gst/gl/eagl/gstglwindow_eagl.m
+++ b/gst-libs/gst/gl/eagl/gstglwindow_eagl.m
@@ -313,6 +313,9 @@ draw_cb (gpointer data)
if (window->queue_resize || window_eagl->priv->window_width != size.width ||
window_eagl->priv->window_height != size.height) {
+ window_eagl->priv->window_width = size.width;
+ window_eagl->priv->window_height = size.height;
+
gst_gl_context_eagl_resize (eagl_context);
gst_gl_window_resize (window, window_eagl->priv->window_width,
@@ -368,16 +371,6 @@ gst_gl_window_eagl_get_layer (GstGLWindowEagl * window_eagl)
window_eagl = window;
}
--(void) layoutSubViews
-{
- g_mutex_lock (&window_eagl->priv->draw_lock);
- [super layoutSubviews];
- CGSize rect = self.bounds.size;
- self->window_eagl->priv->window_width = rect.width;
- self->window_eagl->priv->window_height = rect.height;
- g_mutex_unlock (&window_eagl->priv->draw_lock);
-}
-
@end
void