Skip to content

Commit

Permalink
增加ReconnectAnchorReStream配置
Browse files Browse the repository at this point in the history
  • Loading branch information
CHKZL committed Dec 10, 2024
1 parent 0fb075c commit 311218d
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 4 deletions.
22 changes: 22 additions & 0 deletions Core/Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1968,6 +1968,28 @@ public bool _PreventWindowsHibernation
}
}

private static string ReconnectAnchorReStream = "false";
/// <summary>
/// 碰到HLS流编号不连贯是否切断重连
/// 默认值:false
/// </summary>
public bool _ReconnectAnchorReStream
{
get
{
return bool.Parse(ReconnectAnchorReStream);
}
set
{
if (value.ToString() != ReconnectAnchorReStream)
{
ReconnectAnchorReStream = value.ToString();
OnPropertyChanged();
ModifyConfig(value);
}
}
}

}
#endregion
}
Expand Down
8 changes: 4 additions & 4 deletions Core/RuntimeObject/Download/HLS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ await Task.Run(() =>
{
downloadSizeForThisCycle += WriteToFile(fs, $"{hostClass.host}{hostClass.base_url}{hostClass.eXTM3U.Map_URI}?{hostClass.extra}");
}
if (currentLocation != 0)
if (currentLocation != 0 && Core.Config.Core_RunConfig._ReconnectAnchorReStream)
{
//用于处理流悄悄切了,但是没有发现的情况
bool FileNameTimeout = hostClass.eXTM3U.eXTINFs.All(extinf =>
Expand All @@ -133,7 +133,7 @@ await Task.Run(() =>
{
return value != currentLocation;
}
return false;
return false;
});
if (FileNameTimeout)
{
Expand All @@ -143,12 +143,12 @@ await Task.Run(() =>
}
}
foreach (var item in hostClass.eXTM3U.eXTINFs)
{
{
if (long.TryParse(item.FileName, out long index) && (index == currentLocation + 1 || currentLocation == 0))
{
downloadSizeForThisCycle += WriteToFile(fs, $"{hostClass.host}{hostClass.base_url}{item.FileName}.{item.ExtensionName}?{hostClass.extra}");
currentLocation = index;
}
}
}
hostClass.eXTM3U.eXTINFs = new();
values.Add((downloadSizeForThisCycle, DateTime.Now));
Expand Down

0 comments on commit 311218d

Please sign in to comment.