Skip to content

Handle cdrdao toc robustly when it gives up on q subchannel CRC errors - #719

Open
Rivers47 wants to merge 1 commit into
whipper-team:developfrom
Rivers47:cdrdao-toc-fix
Open

Rivers47 wants to merge 1 commit into
whipper-team:developfrom
Rivers47:cdrdao-toc-fix

Conversation

@Rivers47

@Rivers47 Rivers47 commented Nov 2, 2026 •

Copy link
Copy Markdown

I have a drive (Thinkpad Ultraslim DVD) that can't read the Q subchannel correctly (I think) and gives a lot of CRC errors. cdrdao gives up reading these and ends up writing pregaps equal to the track's start offset, it then subtracts the pregap from previous track's length, which causes whipper to fail with libdiscid rejecting the TOC with discid.disc.TOCError: Disc too long.

Bascially it ends up writing FILE 0 [track absolute end offset] and START track's absolute start offset.
Whipper currently doesn't handle this, but the initial fast TOC cdrdao read-toc --fast-toc actually works. The rip would work with the fix (AccurateRip completely matched), so I think the huge amount of CRC error is just noise.

The fix in toc.py

When FILE has start == 0 on trackNumber > 1:

  1. Record _absoluteEnd = length - CD_LEADIN_FRAMES instead of adding length to currentLength.
  2. On the paired START line, set absoluteOffset = length - CD_LEADIN_FRAMES, currentLength = _absoluteEnd - absoluteOffset, and pregapLength = 0.
  3. Compute table.leadout = absoluteOffset + currentLength at the end of parse() (since totalLength is no longer a valid running sum once absoluteOffset is
    reassigned).

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💖 Thanks for opening your first pull request here! 💖

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant