views:

365

answers:

3

Got a Cocoa video capture app that works fine in 10.4. It uses NSThread to start the video capture driver. When app just started, video capture is very slow ( 1-2 fps). But after resize the UI window (or bring the window from background to foreground), video capture speed is back to normal. This only happens in 10.5.

+3  A: 

Not sure specifically why, but you should be using Instruments to figure out what's going on

Paul Betts
+2  A: 

The answer to “My app is slow” is always “Run Shark”. Occasionally, it's now “Run Instruments”, but in most cases, I find that Shark gives me an answer faster than Instruments does.

Shark is, of course, in /Developer/Applications. If you didn't install CHUD, go do that, or you're missing out.

Peter Hosey
+1  A: 

We have an application that uses multithreaded video capture and recording similar to what you describe. We use libdc1394 for the capture from a Firewire camera, an NSOpenGLView for display, and QuickTime for the video encoding. Capture from the camera is on a separate thread from the OpenGL video display and the QuickTime MPEG4 encoding.

Several months ago, we migrated this application across to Leopard with no ill effects. In fact, the CPU load at 30 frames per second of video decreased on Leopard.

Have you checked to make sure that you are properly dealing with all your NSLocks and the like? We've run into performance problems where a lock on one thread was halting operation on another, and consequently dropping our framerates. Maybe you could look at putting locks only around areas that absolutely need them or by implementing lockless versions of your operations.

Brad Larson