test(core/browser/platform): 26 extreme RED/GREEN TDD cycles and full regression hardening (3,235 PASS)
Some checks failed
release / test (push) Failing after 14m5s
release / windows (push) Has been cancelled
release / android (push) Has been cancelled
release / linux (push) Has been cancelled
release / macos (push) Has been cancelled

This commit is contained in:
Yun Chan 2026-09-18 23:32:32 +09:00
parent bcd242691f
commit 8677853822
100 changed files with 4814 additions and 333 deletions

View file

@ -98,6 +98,7 @@ public static class DashParser
// t 속성은 타임라인을 해당 절대시각으로 재설정.
// #9 r=-1 은 "Period 끝까지 반복" — count=r+1=0 으로 0개를 내던 버그 수정.
var timescale = (long?)tmpl.Attribute("timescale") ?? 1;
if (timescale <= 0) timescale = 1;
long endTime = periodSec > 0 ? (long)Math.Ceiling(periodSec * timescale) : long.MaxValue;
long number = startNumber; int idx = 0; long time = 0;
const long MaxSegs = 200000; // 폭주 방지 상한
@ -130,6 +131,7 @@ public static class DashParser
else
{
var timescale = (long?)tmpl.Attribute("timescale") ?? 1;
if (timescale <= 0) timescale = 1;
var duration = (long?)tmpl.Attribute("duration") ?? 0;
if (duration > 0)
{
@ -196,7 +198,7 @@ public static class DashParser
return Uri.TryCreate(baseUri, rel, out var combined) ? combined : new Uri(rel, UriKind.RelativeOrAbsolute);
}
private static double ParseDuration(string? d)
internal static double ParseDuration(string? d)
{
if (string.IsNullOrWhiteSpace(d)) return 0;
try
@ -205,17 +207,40 @@ public static class DashParser
}
catch
{
// 폴백: 수동 파싱
var s = d.Trim();
if (!s.StartsWith("PT", StringComparison.OrdinalIgnoreCase)) return 0;
s = s.Substring(2);
double total = 0; var num = "";
// 폴백: ISO 8601 Duration (P[n]Y[n]M[n]DT[n]H[n]M[n]S) 수동 파싱
var s = d.Trim().ToUpperInvariant();
if (!s.StartsWith("P")) return 0;
s = s.Substring(1); // 'P' 제거
bool inTime = false;
double total = 0;
var num = "";
foreach (var ch in s)
{
if (char.IsDigit(ch) || ch == '.') num += ch;
else if (ch is 'H' or 'M' or 'S' && double.TryParse(num, NumberStyles.Any, CultureInfo.InvariantCulture, out var v))
if (ch == 'T')
{
total += ch == 'H' ? v * 3600 : ch == 'M' ? v * 60 : v;
inTime = true;
continue;
}
if (char.IsDigit(ch) || ch == '.')
{
num += ch;
}
else if (double.TryParse(num, NumberStyles.Any, CultureInfo.InvariantCulture, out var v))
{
if (!inTime)
{
if (ch == 'D') total += v * 86400;
else if (ch == 'W') total += v * 604800;
else if (ch == 'Y') total += v * 31536000;
}
else
{
if (ch == 'H') total += v * 3600;
else if (ch == 'M') total += v * 60;
else if (ch == 'S') total += v;
}
num = "";
}
}