From 31eef77cf14dd9d70d8474b7f2614478314b8d69 Mon Sep 17 00:00:00 2001 From: Yuriy Liskov Date: Mon, 3 Nov 2025 22:38:26 +0200 Subject: [PATCH] exoplayer: upd sabr classes --- MediaServiceCore | 2 +- .../controllers/VideoLoaderController.java | 2 +- .../exoplayer/other/DebugInfoManager.java | 7 ++-- .../source/sabr/DefaultSabrChunkSource.java | 33 ++++++++++++++++--- .../source/sabr/parser/SabrExtractor.java | 22 +++---------- smarttubetv/build.gradle | 4 +-- 6 files changed, 39 insertions(+), 31 deletions(-) diff --git a/MediaServiceCore b/MediaServiceCore index 8a1a35cd3..e394cf62c 160000 --- a/MediaServiceCore +++ b/MediaServiceCore @@ -1 +1 @@ -Subproject commit 8a1a35cd3da5ce33d326d65b797b6e8c799da63a +Subproject commit e394cf62cb9be74cd4b42835d78296887f98c8e4 diff --git a/common/src/main/java/com/liskovsoft/smartyoutubetv2/common/app/models/playback/controllers/VideoLoaderController.java b/common/src/main/java/com/liskovsoft/smartyoutubetv2/common/app/models/playback/controllers/VideoLoaderController.java index 15e517d01..34fd64cbb 100644 --- a/common/src/main/java/com/liskovsoft/smartyoutubetv2/common/app/models/playback/controllers/VideoLoaderController.java +++ b/common/src/main/java/com/liskovsoft/smartyoutubetv2/common/app/models/playback/controllers/VideoLoaderController.java @@ -41,7 +41,7 @@ public class VideoLoaderController extends BasePlayerController { private static final long BUFFERING_THRESHOLD_MS = 3_000; private static final long BUFFERING_WINDOW_MS = 60_000; private static final long BUFFERING_RECURRENCE_COUNT = 5; - private static final long BUFFERING_CONTINUATION_MS = 15_000; + private static final long BUFFERING_CONTINUATION_MS = 20_000; private final Playlist mPlaylist; private Video mPendingVideo; private int mLastErrorType = -1; diff --git a/common/src/main/java/com/liskovsoft/smartyoutubetv2/common/exoplayer/other/DebugInfoManager.java b/common/src/main/java/com/liskovsoft/smartyoutubetv2/common/exoplayer/other/DebugInfoManager.java index c449a2b67..a64be3f4e 100644 --- a/common/src/main/java/com/liskovsoft/smartyoutubetv2/common/exoplayer/other/DebugInfoManager.java +++ b/common/src/main/java/com/liskovsoft/smartyoutubetv2/common/exoplayer/other/DebugInfoManager.java @@ -27,6 +27,7 @@ import com.google.android.exoplayer2.mediacodec.MediaCodecInfo; import com.google.android.exoplayer2.source.TrackGroupArray; import com.google.android.exoplayer2.trackselection.TrackSelectionArray; import com.liskovsoft.sharedutils.helpers.AppInfoHelpers; +import com.liskovsoft.sharedutils.helpers.DeviceHelpers; import com.liskovsoft.sharedutils.helpers.FileHelpers; import com.liskovsoft.sharedutils.helpers.Helpers; import com.liskovsoft.sharedutils.querystringparser.UrlQueryStringFactory; @@ -359,10 +360,8 @@ public final class DebugInfoManager implements Runnable, Player.EventListener { } private void appendMemoryInfo() { - long maxMemory = Runtime.getRuntime().maxMemory(); - long allocatedMemory = Runtime.getRuntime().totalMemory(); - appendRow("Memory limit (MB)", (int)(maxMemory / (1024 * 1024))); // Growth Limit - appendRow("Allocated memory (MB)", (int)(allocatedMemory / (1024 * 1024))); + appendRow("Max heap memory (MB)", DeviceHelpers.getMaxHeapMemoryMB()); // Growth Limit + appendRow("Allocated heap memory (MB)", DeviceHelpers.getAllocatedHeapMemoryMB()); } private void appendWebViewInfo() { diff --git a/exoplayer-amzn-2.10.6/library/sabr/src/main/java/com/google/android/exoplayer2/source/sabr/DefaultSabrChunkSource.java b/exoplayer-amzn-2.10.6/library/sabr/src/main/java/com/google/android/exoplayer2/source/sabr/DefaultSabrChunkSource.java index cde652c54..f2d32c41b 100644 --- a/exoplayer-amzn-2.10.6/library/sabr/src/main/java/com/google/android/exoplayer2/source/sabr/DefaultSabrChunkSource.java +++ b/exoplayer-amzn-2.10.6/library/sabr/src/main/java/com/google/android/exoplayer2/source/sabr/DefaultSabrChunkSource.java @@ -32,6 +32,7 @@ import com.google.android.exoplayer2.source.sabr.manifest.RangedUri; import com.google.android.exoplayer2.source.sabr.manifest.Representation; import com.google.android.exoplayer2.source.sabr.manifest.SabrManifest; import com.google.android.exoplayer2.source.sabr.parser.SabrExtractor; +import com.google.android.exoplayer2.source.sabr.parser.SabrStream; import com.google.android.exoplayer2.trackselection.TrackSelection; import com.google.android.exoplayer2.upstream.DataSource; import com.google.android.exoplayer2.upstream.DataSpec; @@ -111,6 +112,8 @@ public class DefaultSabrChunkSource implements SabrChunkSource { private boolean missingLastSegment; private long liveEdgeTimeUs; + private final SabrStream sabrStream; + /** * @param manifestLoaderErrorThrower Throws errors affecting loading of manifests. * @param manifest The initial manifest. @@ -157,6 +160,22 @@ public class DefaultSabrChunkSource implements SabrChunkSource { long periodDurationUs = manifest.getPeriodDurationUs(periodIndex); liveEdgeTimeUs = C.TIME_UNSET; + // TODO: replace nulls with the actual values + sabrStream = new SabrStream( + null, + null, + null, + null, + null, + null, + -1, + -1, + -1, + null, + false, + null + ); + List representations = getRepresentations(); representationHolders = new RepresentationHolder[trackSelection.length()]; for (int i = 0; i < representationHolders.length; i++) { @@ -168,7 +187,8 @@ public class DefaultSabrChunkSource implements SabrChunkSource { representation, enableEventMessageTrack, closedCaptionFormats, - playerTrackEmsgHandler); + playerTrackEmsgHandler, + sabrStream); } } @@ -611,7 +631,8 @@ public class DefaultSabrChunkSource implements SabrChunkSource { Representation representation, boolean enableEventMessageTrack, List closedCaptionFormats, - TrackOutput playerEmsgTrackOutput) { + TrackOutput playerEmsgTrackOutput, + SabrStream sabrStream) { this( periodDurationUs, representation, @@ -620,7 +641,8 @@ public class DefaultSabrChunkSource implements SabrChunkSource { representation, enableEventMessageTrack, closedCaptionFormats, - playerEmsgTrackOutput), + playerEmsgTrackOutput, + sabrStream), /* segmentNumShift= */ 0, representation.getIndex()); } @@ -773,7 +795,8 @@ public class DefaultSabrChunkSource implements SabrChunkSource { Representation representation, boolean enableEventMessageTrack, List closedCaptionFormats, - TrackOutput playerEmsgTrackOutput) { + TrackOutput playerEmsgTrackOutput, + SabrStream sabrStream) { String containerMimeType = representation.format.containerMimeType; if (mimeTypeIsRawText(containerMimeType)) { return null; @@ -795,7 +818,7 @@ public class DefaultSabrChunkSource implements SabrChunkSource { // flags, null, null, null, closedCaptionFormats, playerEmsgTrackOutput); //} - Extractor extractor = new SabrExtractor(trackType, representation.format); // TODO: add more params (from the manifest) into the constructor + Extractor extractor = new SabrExtractor(trackType, representation.format, sabrStream); // TODO: add more params (from the manifest) into the constructor // Prefer drmInitData obtained from the manifest over drmInitData obtained from the stream, // as per DASH IF Interoperability Recommendations V3.0, 7.5.3. diff --git a/exoplayer-amzn-2.10.6/library/sabr/src/main/java/com/google/android/exoplayer2/source/sabr/parser/SabrExtractor.java b/exoplayer-amzn-2.10.6/library/sabr/src/main/java/com/google/android/exoplayer2/source/sabr/parser/SabrExtractor.java index cf80d29e3..54266c95b 100644 --- a/exoplayer-amzn-2.10.6/library/sabr/src/main/java/com/google/android/exoplayer2/source/sabr/parser/SabrExtractor.java +++ b/exoplayer-amzn-2.10.6/library/sabr/src/main/java/com/google/android/exoplayer2/source/sabr/parser/SabrExtractor.java @@ -274,26 +274,12 @@ public class SabrExtractor implements Extractor { * @param trackType The type of the track. Typically one of the {@link com.google.android.exoplayer2.C} * {@code TRACK_TYPE_*} constants. */ - public SabrExtractor(int trackType, @NonNull Format format) { - this(0, trackType, format); + public SabrExtractor(int trackType, @NonNull Format format, @NonNull SabrStream sabrStream) { + this(0, trackType, format, sabrStream); } - private SabrExtractor(@Flags int flags, int trackType, @NonNull Format format) { - // TODO: replace nulls with the actual values - sabrStream = new SabrStream( - null, - null, - null, - null, - null, - null, - -1, - -1, - -1, - null, - false, - null - ); + private SabrExtractor(@Flags int flags, int trackType, @NonNull Format format, @NonNull SabrStream sabrStream) { + this.sabrStream = sabrStream; this.format = format; this.trackType = trackType; seekForCuesEnabled = (flags & FLAG_DISABLE_SEEK_FOR_CUES) == 0; diff --git a/smarttubetv/build.gradle b/smarttubetv/build.gradle index c3163f145..fb7dfb3c8 100644 --- a/smarttubetv/build.gradle +++ b/smarttubetv/build.gradle @@ -60,8 +60,8 @@ android { applicationId "com.liskovsoft.smarttubetv" minSdkVersion project.properties.minSdkVersion targetSdkVersion project.properties.targetSdkVersion - versionCode 2214 - versionName "30.24" + versionCode 2215 + versionName "30.25" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" buildConfigField "long", "TIMESTAMP", System.currentTimeMillis() + "L"