summaryrefslogtreecommitdiffstats
path: root/src/plugins/avfoundation/mediaplayer
diff options
context:
space:
mode:
authorFrank Osterfeld <frank.osterfeld@kdab.com>2015-02-22 13:15:03 +0100
committerYoann Lopes <yoann.lopes@theqtcompany.com>2015-02-25 12:36:38 +0000
commitb0f283b65e8dc9e9dbfe81b3fd58e8898cbb6676 (patch)
tree02cba8fa20ffb167b2979f65afa42847c1265a89 /src/plugins/avfoundation/mediaplayer
parent39bb642cb297dcd95273ba0dba417beec03e686c (diff)
ios: Do not leak texture cache objects
Do not recreate m_textureCache if it already exists. This changes the memory allocation behavior of a simple iOS example program from linearly increasing to constant over time. Change-Id: I6ff13b586c653fb7b4cadfa9f4ebf985b07ee455 Reviewed-by: Yoann Lopes <yoann.lopes@theqtcompany.com>
Diffstat (limited to 'src/plugins/avfoundation/mediaplayer')
-rw-r--r--src/plugins/avfoundation/mediaplayer/avfvideoframerenderer_ios.mm20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/plugins/avfoundation/mediaplayer/avfvideoframerenderer_ios.mm b/src/plugins/avfoundation/mediaplayer/avfvideoframerenderer_ios.mm
index 0c8e8c52d..b5ad8538a 100644
--- a/src/plugins/avfoundation/mediaplayer/avfvideoframerenderer_ios.mm
+++ b/src/plugins/avfoundation/mediaplayer/avfvideoframerenderer_ios.mm
@@ -240,14 +240,16 @@ void AVFVideoFrameRenderer::initRenderer()
//Need current context
m_glContext->makeCurrent(m_offscreenSurface);
- // Create a new open gl texture cache
- CVReturn err = CVOGLTextureCacheCreate(kCFAllocatorDefault, NULL,
- [EAGLContext currentContext],
- NULL, &m_textureCache);
-
- if (err) {
-#ifdef QT_DEBUG_AVF
- qWarning("Error at CVOGLTextureCacheCreate %d", err);
-#endif
+ if (!m_textureCache) {
+ // Create a new open gl texture cache
+ CVReturn err = CVOGLTextureCacheCreate(kCFAllocatorDefault, NULL,
+ [EAGLContext currentContext],
+ NULL, &m_textureCache);
+ if (err) {
+ #ifdef QT_DEBUG_AVF
+ qWarning("Error at CVOGLTextureCacheCreate %d", err);
+ #endif
+ }
}
+
}