I'm having a similar issue where I am getting green frames flickering
in between correct frames when I have QTVisualContextTask in my render
loop.
If I remove it I get smooth playback (until I start running out of
resources).
Thanks for your help.
Alan
On 24/10/2007, at 4:42 PM, Matthew Veenstra wrote:
Hello,
We are using a QTVisualContext with Core Video to get a frame as a
texture and draw the texture in our apps OpenGL (agl) draw loop.
After the movie has been playing some seconds (10 or more usually)
we will start to get occasional old frames flickering in our
drawing. I assume this means I am getting old values or garbage
some where.
I have tried numerous things to work around this drawing flicker to
no real avail. I have discovered if I retrain my texture with
CVOpenGLTextureRetain() I then have no drawing issue, but I of
course leak memory like there is no tomorrow. The same holds true
if I don't call CVOpenGLTextureCacheFlush() or QTVisualContextTask()
regularly. My drawing is fixed, but I leak memory like crazy.
Is there something I must retain and release myself that I am
missing? I have spent some more time trying to understand this and
it must be some thread issue. I have modified the code to improve
things, but there are still issues when I have large movies and need
to move large amounts of texture data.
I render frames with a visualcontext call back set by this.
QTVisualContextSetImageAvailableCallback(aData->visualContext,
fImageRenderFrame, aData);
QTMLGrabMutex(aData->mutex);
QTVisualContextTask(aData->visualContext);
if (QTVisualContextIsNewImageAvailable(aData->visualContext,
theTimeStamp)) {
// MV it is possible I want to pass NULL for the time stamp to get
current time...just in case this time is off.
anErr = QTVisualContextCopyImageForTime(aData->visualContext,
kCFAllocatorDefault, theTimeStamp, &anImageBuffer);
// This is a replacement for glTexImage2D()
anErr =
CVOpenGLTextureCacheCreateTextureFromImage(kCFAllocatorDefault,
aData->textureCache, anImageBuffer, NULL, &aTextureRef);
CVOpenGLTextureCacheFlush(aData->textureCache, 0);
if (aData->textureRef) {
CVOpenGLTextureRelease(aData->textureRef);
aData->textureRef = NULL;
}
aData->textureRef = aTextureRef;
When I draw I grab the mutex and then get the texture like this.
QTMLGrabMutex(aData->mutex);
aTarget = CVOpenGLTextureGetTarget(aData->textureRef);
aName = CVOpenGLTextureGetName(aData->textureRef);
CVOpenGLTextureGetCleanTexCoords(aData->textureRef,
textureBounds.bottomLeft, textureBounds.bottomRight,
textureBounds.topRight, textureBounds.topLeft);
glBindTexture(aTarget, aName);
// do my opengl bits and texture mapping
The drawing loop I control from my main thread. I do proper
checking to make sure values are not NULL and I always NULL a value
after I release it to verify this. I have moved
QTVisualContextTask() to the main thread to no avail. I removed the
entire callback and inlined the code to my drawing routines and it
amazingly so still showed the problem.
Any thoughts.
Thanks,
Matt Veenstra
_______________________________________________
Do not post admin requests to the list. They will be ignored.
QuickTime-API mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quicktime-api/email@hidden
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
QuickTime-API mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quicktime-api/email@hidden