I’ve been working on fixing up a mistake I made on Saturday.
I had found and fixed the problem with not being able to stop recording. The ‘can’t stop recording issue’ I think was hiding something I’d introduced (by mistake) previously while making capture smoother.
While working on the Lion integration I’d changed the compressor so that it could handle not quantizing frames. Part of that involved the compressor being smarter and checking for zero durations before submitting frames. If it saw a zero, it would notify HD and should then have exited. If the duration was non-zero, it should have hummed merrily along and let the frame through for compression. One or the other please. Not both.
Unfortunately, I left out one critical line. And that meant that the compressor could do both. Bad bad bad. It would notify HD that the frame was ‘bad’ and then also submit it for compression.
The upshot of all that was that the ‘hey, I’m done’ code would return the frame to it’s pool and (this is the important part) if that pool was gone (think: you’ve stopped recording) would release the frame. OK. It’s supposed to do that. That’s right. It’s good. Otherwise a requirement of iShowU HD would be to have a trillion gigs of RAM. I don’t think you buy a trillion gigs of RAM for a Mac (yet).
Buuuut. I had made the mistake of also compressing this same frame. One of the things that happens when the compressor is done with a frame is that it calls you back and says “hey, we’re done”. Guess what we do then? Yup. We call exactly the same method above and a) return the frame to the pool and b) release it if required.
All good housekeeping.
Except when you do it’s twice in a row. When you do that, you get what we had with the latest build. Weird crashes that don’t always occur. I had tried this build on a number of machines before uploading it. It seemed fine. Only when I tried it on my Core2Duo laptop did I fine that indeed – something was very wrong.
So, apologies for the regression there. I’ve fixed that and am just waiting for a build to complete before I upload the update.
Why is it the most annoying, persistent, hard to find bugs … that take you five hours to find, are always one line fixes?