优化多Period处理逻辑

This commit is contained in:
nilaoda 2023-06-01 22:52:29 +08:00
parent 3bb4c4cb0c
commit 711bbb02a4
1 changed files with 17 additions and 8 deletions

View File

@ -456,7 +456,11 @@ namespace N_m3u8DL_RE.Parser.Extractor
}
else
{
//点播这种情况作为新的part出现
//点播这种情况如果URL不同则作为新的part出现否则仅把时间加起来
var url1 = streamList[_index].Playlist!.MediaParts.Last().MediaSegments.Last().Url;
var url2 = streamSpec.Playlist.MediaParts[0].MediaSegments.LastOrDefault()?.Url;
if (url1 != url2)
{
var startIndex = streamList[_index].Playlist!.MediaParts.Last().MediaSegments.Last().Index + 1;
var enumerator = streamSpec.Playlist.MediaParts[0].MediaSegments.GetEnumerator();
while (enumerator.MoveNext())
@ -468,6 +472,11 @@ namespace N_m3u8DL_RE.Parser.Extractor
MediaSegments = streamSpec.Playlist.MediaParts[0].MediaSegments
});
}
else
{
streamList[_index].Playlist!.MediaParts.Last().MediaSegments.Last().Duration += streamSpec.Playlist.MediaParts[0].MediaSegments.Sum(x => x.Duration);
}
}
}
else
{