[vlc-commits] [Git][videolan/vlc][master] 3 commits: VLCOpenGLES2VideoView: remove EAGL context in close
Jean-Baptiste Kempf (@jbk)
gitlab at videolan.org
Fri Dec 2 18:03:50 UTC 2022
Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC
Commits:
f9fc7d64 by Alexandre Janniaux at 2022-12-02T17:39:23+00:00
VLCOpenGLES2VideoView: remove EAGL context in close
Fix a crash where the destructor of the VLCOpenGLES2VideoView
(.cxx_destruct) is calling the destructor of the EAGL context, which
leads into unknown stacktraces in the EAGLContext_setDebugLabel symbol.
The setup of the crash needs using CVPixelBuffer backed by an IOSurface,
so typically a filter using the VLCCVOpenGLProvider offscreen OpenGL
implementation, which seems to imply some live-binding is still in use
if we don't close the context soon enough.
- - - - -
1ccf3eac by Alexandre Janniaux at 2022-12-02T17:39:23+00:00
VLCOpenGLES2VideoView: don't remove opengl resources
The OpenGL resources are removed when the EAGLContext is destroyed, so
there is no need destroying them ourselves, which avoids one callsite
where we're making a context current and avoid listing the resources.
- - - - -
eb5bc46d by Alexandre Janniaux at 2022-12-02T17:39:23+00:00
VLCCVOpenGLProvider: re-order destruction of objects
The CVOpenGLTextureRef is created from the CVPixelBuffer. Although it
should reference it, there's no reason not to destroy them in the
correct order.
- - - - -
2 changed files:
- modules/video_output/apple/VLCCVOpenGLProvider.m
- modules/video_output/apple/VLCOpenGLES2VideoView.m
Changes:
=====================================
modules/video_output/apple/VLCCVOpenGLProvider.m
=====================================
@@ -154,10 +154,10 @@ static void Close(vlc_gl_t *gl)
static void FreeCVBuffer(picture_t *picture)
{
struct vlc_cvbuffer *buffer = picture->p_sys;
- if (buffer->cvpx)
- CFRelease(buffer->cvpx);
if (buffer->texture)
CFRelease(buffer->texture);
+ if (buffer->cvpx)
+ CFRelease(buffer->cvpx);
free(buffer);
}
=====================================
modules/video_output/apple/VLCOpenGLES2VideoView.m
=====================================
@@ -277,12 +277,6 @@ static void Close(vlc_gl_t *gl)
- (void)detachFromWindow
{
- EAGLContext *previous_context = [EAGLContext currentContext];
- [EAGLContext setCurrentContext:_eaglContext];
- glDeleteFramebuffers(1, &_frameBuffer);
- glDeleteRenderbuffers(1, &_renderBuffer);
- [EAGLContext setCurrentContext:previous_context];
-
/* Flush the OpenGL pipeline before leaving. */
vlc_mutex_lock(&_mutex);
if (_eaglEnabled)
@@ -290,6 +284,11 @@ static void Close(vlc_gl_t *gl)
_eaglEnabled = NO;
vlc_mutex_unlock(&_mutex);
+ /* We can drop the context as fast as possible since we don't use it
+ * anymore. It avoids crashes with the context modifying destroyed
+ * resources when it is being deallocated in the main thread. */
+ _eaglContext = nil;
+
/* This cannot be a synchronous dispatch because player is usually running
* in the main thread and block the main thread unless we accept our fate
* and exit here. */
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/cf52315abaf9252c7c19e740ba485a274bc3d7bd...eb5bc46d21b479e6389a7f0205c65035e200c9da
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/cf52315abaf9252c7c19e740ba485a274bc3d7bd...eb5bc46d21b479e6389a7f0205c65035e200c9da
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the vlc-commits
mailing list