Reading CDs - scary things...!


I’m not sure what to make of this issue, so let me just describe it.

I’m developing an application that can read audio tracks from CDs. At some point in the proceedings, I was having trouble with that part of the code. It seems to be working accurately now - BUT my internal CD drive seems subtly hardware broken now (yes, I’ve rebooted) - I can no longer read DVDs properly in any program, and my JUCE application crashes or hangs when it tries to read CDs in that drive (Mac OS 10.6 desktop) - though iTunes seems to mount disks fine in that drive…?

These things happen - though I make almost no use of that internal drive (and there was no time in development where I did anything involving long reads or massive seeks - I listen very closely to the drive when I run programs).

Today, one of our Windows test machines, the one we did the most testing on reading CDs, is also exhibiting similar “hardware” weirdnesses. I emphasize that we haven’t made that much use out of the CD drives on either - not as many as 100 CD insertions and readings. We just don’t have that many machines, and I’ve never had a CD drive go before - it seems like a strange coincidence.

First - has anyone worked with the audio CD reader? If so, did you every see anything like this? It might be that I was doing wrong things during development, but I don’t see how anything I could do which didn’t wham the head around a lot with a lot of bogus seeks would damage the hardware… like, some location I accidentally wrote to that broke the unit…?

Second, I now have a broken internal CD reader that neither itunes nor iDVD crash on, but even a trivial Juce CD reader program does. It’d be great to figure out how iDVD manages to ignore what’s in there without crashing…

Third, there’s another fairly serious issue that came out from that “broken” CD player! If you’re reading in a thread that goes off to hit the CD player, and there’s an apparent hardware issue with the reader, that thread can block for arbitrarily long periods. This is true of my broken CD drive, but this also seems true with some “damaged” CDs.

This means that the thread eventually suffers a forced shutdown, which probably leaves all sorts of things in a bad condition.

While broken CD drives are rare, damaged CDs are common, and I’d really like a nice way to be able to gracefully interrupt a read from an AudioCDReader, or at least set a timeout and a recovery mechanism.