From 6d1b6bb8c90981a0d7161bc25c3b660909d1ed5e Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Tue, 4 Feb 2020 00:29:56 +0000 Subject: [PATCH] When calculating pregap continue to next track if failed to get any subchannel more than 10 times. --- .../Devices/Dumping/CompactDisc/Pregap.cs | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/DiscImageChef.Core/Devices/Dumping/CompactDisc/Pregap.cs b/DiscImageChef.Core/Devices/Dumping/CompactDisc/Pregap.cs index 7c40d4688..c154b4695 100644 --- a/DiscImageChef.Core/Devices/Dumping/CompactDisc/Pregap.cs +++ b/DiscImageChef.Core/Devices/Dumping/CompactDisc/Pregap.cs @@ -175,6 +175,8 @@ namespace DiscImageChef.Core.Devices.Dumping foreach(Track track in tracks) { + int trackRetries = 0; + // First track of each session has at least 150 sectors of pregap and is not readable always if(tracks.Where(t => t.TrackSession == track.TrackSession).OrderBy(t => t.TrackSequence). FirstOrDefault().TrackSequence == track.TrackSequence) @@ -373,6 +375,44 @@ namespace DiscImageChef.Core.Devices.Dumping { if(sense) { + trackRetries++; + + if(trackRetries >= 10) + { + if(pregaps[track.TrackSequence] == 0) + { + if((previousTrack.TrackType == TrackType.Audio && + track.TrackType != TrackType.Audio) || + (previousTrack.TrackType != TrackType.Audio && + track.TrackType == TrackType.Audio)) + { + dumpLog?. + WriteLine($"Could not read subchannel for this track, supposing 150 sectors."); + + updateStatus?. + Invoke($"Could not read subchannel for this track, supposing 150 sectors."); + } + else + { + dumpLog?. + WriteLine($"Could not read subchannel for this track, supposing 0 sectors."); + + updateStatus?. + Invoke($"Could not read subchannel for this track, supposing 0 sectors."); + } + } + else + { + dumpLog?. + WriteLine($"Could not read subchannel for this track, supposing {pregaps[track.TrackSequence]} sectors."); + + updateStatus?. + Invoke($"Could not read subchannel for this track, supposing {pregaps[track.TrackSequence]} sectors."); + } + + break; + } + dumpLog?.WriteLine($"Could not read subchannel for sector {lba}"); updateStatus?.Invoke($"Could not read subchannel for sector {lba}");