That can also indicate the optical drive is dirty. A dry-brush drive cleaning disk can help. I use this one:
http://www.ixos.co.uk/us/ixos-products-detail.asp?PROID=595&Category=20
It has resurrected several Mac drives that had been officially pronounced "dead" by certified Apple techs.
Also, you don't say which iMac variant you have. They've been in continuous production since 1998 with different types of drives. Slot-loaders have historically been more stroublesome thatn tray-loaders. Do "About ths Mac" from your Apple menu and tell us what it says for "Processor" and the Mac OS version. That will give us a start on determining which of the many iMac variants you have.