Workaround for EAC crash when CTDB plugin returns long log lines

This commit is contained in:
Grigory Chudov
2017-07-13 21:18:04 -04:00
parent bd6e1cc1ed
commit 5cf95e34ee
3 changed files with 22 additions and 9 deletions

View File

@@ -304,7 +304,7 @@ namespace CUETools.AccurateRip
return count; return count;
} }
public string GetAffectedSectors(int min, int max, int offs = 0) public string GetAffectedSectors(int min, int max, int offs = 0, int coalesce = 2 * 588 * 5)
{ {
min = Math.Max(2 * min, 2 * pregap + stride - 2 * ActualOffset); min = Math.Max(2 * min, 2 * pregap + stride - 2 * ActualOffset);
max = Math.Min(2 * max, 2 * finalSampleCount - laststride - 2 * ActualOffset); max = Math.Min(2 * max, 2 * finalSampleCount - laststride - 2 * ActualOffset);
@@ -315,7 +315,7 @@ namespace CUETools.AccurateRip
{ {
int j; int j;
for (j = i + 1; j < correctableErrors; j++) for (j = i + 1; j < correctableErrors; j++)
if (erroffsorted[j] - erroffsorted[j - 1] > 2 * 588 * 5) if (erroffsorted[j] - erroffsorted[j - 1] >= coalesce)
break; break;
uint sec1 = (uint)(erroffsorted[i] - offs) / 2 / 588; uint sec1 = (uint)(erroffsorted[i] - offs) / 2 / 588;
uint sec2 = (uint)(erroffsorted[j - 1] - offs) / 2 / 588; uint sec2 = (uint)(erroffsorted[j - 1] - offs) / 2 / 588;

View File

@@ -46,7 +46,7 @@ namespace CUETools.CTDB.EACPlugin
if (resp == null) if (resp == null)
{ {
#if DEBUG #if DEBUG
string server = "hq.cuetools.net"; string server = "db.cuetools.net";
#else #else
string server = null; string server = null;
#endif #endif

View File

@@ -609,10 +609,14 @@ namespace CUETools.CTDB
string ifmt = this.Total < 10 ? "1" : this.Total < 100 ? "2" : "3"; string ifmt = this.Total < 10 ? "1" : this.Total < 100 ? "2" : "3";
for (int iTrack = 0; iTrack < this.TOC.AudioTracks; iTrack++) for (int iTrack = 0; iTrack < this.TOC.AudioTracks; iTrack++)
{ {
int conf = 0; int coalesce = 2 * 588 * 5;
List<int> resConfidence = new List<int>(); string line;
List<string> resStatus = new List<string>(); do
foreach (DBEntry entry in this.Entries) {
int conf = 0;
List<int> resConfidence = new List<int>();
List<string> resStatus = new List<string>();
foreach (DBEntry entry in this.Entries)
{ {
if (!entry.hasErrors) if (!entry.hasErrors)
{ {
@@ -633,7 +637,10 @@ namespace CUETools.CTDB
} }
resConfidence.Add(entry.conf); resConfidence.Add(entry.conf);
resStatus.Add(string.Format("differs in {0} samples @{1}", diffCount, entry.repair.GetAffectedSectors(min, max, min))); if (coalesce >= 64 * 588 * 5)
resStatus.Add(string.Format("differs in {0} samples", diffCount));
else
resStatus.Add(string.Format("differs in {0} samples @{1}", diffCount, entry.repair.GetAffectedSectors(min, max, min, coalesce)));
continue; continue;
} }
if (entry.trackcrcs != null) if (entry.trackcrcs != null)
@@ -668,7 +675,13 @@ namespace CUETools.CTDB
{ {
resStatus[i] = string.Format("({0}/{1}) {2}", resConfidence[i], this.Total, resStatus[i]); resStatus[i] = string.Format("({0}/{1}) {2}", resConfidence[i], this.Total, resStatus[i]);
} }
sw.WriteLine(string.Format(" {0,2} | {1}", iTrack + 1, string.Join(", or ", resStatus.ToArray())));
coalesce *= 2;
line = string.Join(", or ", resStatus.ToArray());
}
while (line.Length > 1024 && coalesce < 128 * 588 * 5);
if (line.Length > 1024) line = line.Substring(0, 1024) + "...";
sw.WriteLine(string.Format(" {0,2} | {1}", iTrack + 1, line));
} }
} }