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>
This commit is contained in:
committed by
Yoann Lopes
parent
39bb642cb2
commit
b0f283b65e
@@ -240,14 +240,16 @@ void AVFVideoFrameRenderer::initRenderer()
|
|||||||
//Need current context
|
//Need current context
|
||||||
m_glContext->makeCurrent(m_offscreenSurface);
|
m_glContext->makeCurrent(m_offscreenSurface);
|
||||||
|
|
||||||
// Create a new open gl texture cache
|
if (!m_textureCache) {
|
||||||
CVReturn err = CVOGLTextureCacheCreate(kCFAllocatorDefault, NULL,
|
// Create a new open gl texture cache
|
||||||
[EAGLContext currentContext],
|
CVReturn err = CVOGLTextureCacheCreate(kCFAllocatorDefault, NULL,
|
||||||
NULL, &m_textureCache);
|
[EAGLContext currentContext],
|
||||||
|
NULL, &m_textureCache);
|
||||||
if (err) {
|
if (err) {
|
||||||
#ifdef QT_DEBUG_AVF
|
#ifdef QT_DEBUG_AVF
|
||||||
qWarning("Error at CVOGLTextureCacheCreate %d", err);
|
qWarning("Error at CVOGLTextureCacheCreate %d", err);
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user