From 1220cf9eb5bbe3a17ecebfa375f682a0887421b4 Mon Sep 17 00:00:00 2001 From: Yuriy Liskov Date: Tue, 16 Aug 2022 01:41:51 +0300 Subject: [PATCH] player: live streams: buffer size fix --- .../common/exoplayer/LiveDashManifestParser.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 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 b5b9a5595..6b79d1eec 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 @@ -33,8 +33,9 @@ public class LiveDashManifestParser extends DashManifestParser { private static final String TAG = LiveDashManifestParser.class.getSimpleName(); // Usually gaming streams. 10 hours max. private static final long MAX_PAST_STREAM_LENGTH_MS = 10 * 60 * 60 * 1_000; - // Should be zero for non seekable streams (Record Radio). Higher values may produce 'url not working' error. - private static final long MAX_LIVE_STREAM_LENGTH_MS = 0 * 60 * 60 * 1_000; + // Should be close to zero but not zero (small buffer size fix on Radio Record). + // Higher values may produce 'url not working' error. + private static final long MAX_LIVE_STREAM_LENGTH_MS = 30 * 60 * 1_000; private DashManifest mOldManifest; private long mOldSegmentNum; @@ -183,7 +184,8 @@ public class LiveDashManifestParser extends DashManifestParser { minUpdatePeriodMs = durationMs / (lastSegmentNum - firstSegmentNum) / 10 * 10; // Round ending digits } - boolean isPastLiveStream = firstSegmentNum <= 10_000; + //boolean isPastLiveStream = firstSegmentNum <= 10_000; + boolean isPastLiveStream = durationMs > 0; long maxSegmentsCount = (isPastLiveStream ? MAX_PAST_STREAM_LENGTH_MS : MAX_LIVE_STREAM_LENGTH_MS) / minUpdatePeriodMs; long segmentCount = Math.min(firstSegmentNum, maxSegmentsCount - (lastSegmentNum - firstSegmentNum - 1));