From a5be895c8aa3f3d10450df899ec88e47990289ab Mon Sep 17 00:00:00 2001 From: Yuriy Liskov Date: Sun, 14 Aug 2022 09:35:34 +0300 Subject: [PATCH] player: dash: Skip past streams that are truncated: upd --- .../common/exoplayer/LiveDashManifestParser.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/common/src/main/java/com/liskovsoft/smartyoutubetv2/common/exoplayer/LiveDashManifestParser.java b/common/src/main/java/com/liskovsoft/smartyoutubetv2/common/exoplayer/LiveDashManifestParser.java index 72cce602d..b5b9a5595 100644 --- a/common/src/main/java/com/liskovsoft/smartyoutubetv2/common/exoplayer/LiveDashManifestParser.java +++ b/common/src/main/java/com/liskovsoft/smartyoutubetv2/common/exoplayer/LiveDashManifestParser.java @@ -183,8 +183,9 @@ public class LiveDashManifestParser extends DashManifestParser { minUpdatePeriodMs = durationMs / (lastSegmentNum - firstSegmentNum) / 10 * 10; // Round ending digits } - long maxSegmentsCount = (timeShiftBufferDepthMs > 0 ? // active live stream - MAX_LIVE_STREAM_LENGTH_MS : MAX_PAST_STREAM_LENGTH_MS) / minUpdatePeriodMs; + boolean isPastLiveStream = firstSegmentNum <= 10_000; + long maxSegmentsCount = (isPastLiveStream ? + MAX_PAST_STREAM_LENGTH_MS : MAX_LIVE_STREAM_LENGTH_MS) / minUpdatePeriodMs; long segmentCount = Math.min(firstSegmentNum, maxSegmentsCount - (lastSegmentNum - firstSegmentNum - 1)); if (segmentCount <= 0) { @@ -196,8 +197,8 @@ public class LiveDashManifestParser extends DashManifestParser { return; // url won't work on small (2_000Ms) segments } - // Skip past streams that are truncated - if (durationMs > 0 && firstSegmentNum > segmentCount) { + // Skip past streams that are truncated (truncated streams have a problems) + if (isPastLiveStream && firstSegmentNum > segmentCount) { return; }