REQ-3345: 同步消息

This commit is contained in:
yanglin 2025-01-23 14:45:47 +08:00
parent 0572e43384
commit 5d52e9639d

View File

@ -20,7 +20,7 @@ public class Timeline {
public Timeline(Long beginMs, Long endMs) { public Timeline(Long beginMs, Long endMs) {
BizAssertions.assertTrue(beginMs <= endMs, "beginMs must be less than or equal to endMs"); BizAssertions.assertTrue(beginMs <= endMs, "beginMs must be less than or equal to endMs");
nodes = new LinkedList<>(); nodes = new LinkedList<>();
prepend(split(beginMs, endMs, splitCount)); prepend(split(beginMs, endMs));
} }
private void prepend(List<TimeNode> nodes) { private void prepend(List<TimeNode> nodes) {
@ -34,7 +34,7 @@ public class Timeline {
BizAssertions.assertTrue(node.isSplittable(), "node is not splittable"); BizAssertions.assertTrue(node.isSplittable(), "node is not splittable");
nodes.removeFirst(); nodes.removeFirst();
splitCount *= 2; splitCount *= 2;
prepend(split(node.getBeginMs(), node.getEndMs(), splitCount)); prepend(split(node.getBeginMs(), node.getEndMs()));
return peek(); return peek();
} }
@ -51,7 +51,7 @@ public class Timeline {
return nodes.peek(); return nodes.peek();
} }
private List<TimeNode> split(Long beginMs, Long endMs, int splitCount) { private List<TimeNode> split(Long beginMs, Long endMs) {
BizAssertions.assertTrue(beginMs <= endMs, "beginMs must be less than or equal to endMs"); BizAssertions.assertTrue(beginMs <= endMs, "beginMs must be less than or equal to endMs");
List<TimeNode> nodes = new ArrayList<>(); List<TimeNode> nodes = new ArrayList<>();
long totalDuration = endMs - beginMs; long totalDuration = endMs - beginMs;