libcdio / libcdio-paranoia

CD paranoia on top of libcdio
GNU General Public License v3.0
48 stars 37 forks source link

Drive constantly revs up and down while reading CD data #33

Open dweymouth opened 2 years ago

dweymouth commented 2 years ago

I'm working on a CD player program using libcdio-paranoia to read CD data and stream it to the sound card. I'm running into an issue where, for some discs only, the drive will continually oscillate between revving the disc to high speeds and spinning down, rather than spinning at a consistently low-ish speed. My drive reports that it does support setting its speed, but calls to cdio_cddap_speed_set return error code -405. I've tried adding a small sleep to my read thread (vs. reading as fast as possible until my buffer is full, then backing down) to even out the timing of the calls to cdio_paranoia_read_limited which also doesn't solve the issue. I've also tried setting retries to 0, so that reads will always be sequential.

Does anyone have insights into how to ensure the drive will run at a more constant speed?

rocky commented 2 years ago

Might be related to #23

dweymouth commented 2 years ago

You may be correct. Here's the output of cd-paranoia -A for this drive (LG GP65NB60):

`cd-paranoia -A cdparanoia III release 10.2 libcdio 2.1.0 x86_64-apple-darwin20.1.0 (C) 2001 Monty monty@xiph.org and Xiphophorus (C) 2004, 2005, 2008 Rocky Bernstein rocky@gnu.org (C) 2014 Robert Kausch robert.kausch@freac.org

Report bugs to bug-libcdio@gnu.org

Using cdda library version: 10.2+2.0.0 x86_64-apple-darwin20.1.0 Using paranoia library version: 10.2+2.0.0 x86_64-apple-darwin20.1.0 ++ WARN: search for kIOCDMediaClass/kIODVDMediaClass/kIOBDMediaClass came up empty ++ WARN: search for kIOCDMediaClass/kIODVDMediaClass/kIOBDMediaClass came up empty Checking /dev/rdisk4 for cdrom... Setting read block size at 8 sectors (18816 bytes). Verifying drive can read CDDA... Expected command set reads OK.

Attempting to determine drive endianness from data....... Data appears to be coming back Little Endian. certainty: 100%

Attempting to set cdrom to full speed... 405: Option not supported by drive CDROM speed set FAILED. Continuing anyway...

=================== Checking drive cache/timing behavior ===================

Seek/read timing: [53:13.50]: 50ms seek, 0.60ms/sec read [22.3x] [50:00.00]: 36ms seek, 0.62ms/sec read [21.4x] [40:00.00]: 28ms seek, 0.63ms/sec read [21.3x] [30:00.00]: 63ms seek, 0.75ms/sec read [17.8x] [20:00.00]: 45ms seek, 0.87ms/sec read [15.4x] [10:00.00]: 44ms seek, 1.00ms/sec read [13.3x] [00:00.00]: 54ms seek, 1.25ms/sec read [10.6x]

Analyzing cache behavior... Slow verify for approximate cache size... 18 sectors405: Option not supported by drive ........Approximate random access cache size: 18 sector(s) 405: Option not supported by drive Drive cache tests as contiguous Drive readahead past read cursor: 219 sector(s) Cache tail cursor tied to read cursor Cache tail granularity: 0 sector(s) Cache read speed: 0.45ms/sector [29x] Access speed after backseek: 0.41ms/sector [32x] WARNING: Read timing after backseek faster than expected! It's possible/likely that this drive is not flushing the readahead cache on backward seeks!

WARNING! PARANOIA MAY NOT BE TRUSTWORTHY WITH THIS DRIVE!

The Paranoia library may not model this CDROM drive's cache correctly according to this analysis run. Analysis is not always accurate (it can be fooled by machine load or random kernel latencies), but if a failed result happens more often than one time in twenty on an unloaded machine, please mail the cdparanoia.log file produced by this failed analysis to paranoia-dev@xiph.org to assist developers in extending Paranoia to handle this CDROM properly. `