mirror of
https://github.com/yuliskov/SmartTube.git
synced 2026-05-04 20:09:26 -05:00
exoplayer: upd sabr classes
This commit is contained in:
+2
-1
@@ -43,6 +43,7 @@ import com.liskovsoft.sharedutils.helpers.FileHelpers;
|
||||
import com.liskovsoft.sharedutils.mylogger.Log;
|
||||
import com.liskovsoft.sharedutils.okhttp.OkHttpManager;
|
||||
import com.liskovsoft.smartyoutubetv2.common.exoplayer.errors.DashDefaultLoadErrorHandlingPolicy;
|
||||
import com.liskovsoft.smartyoutubetv2.common.exoplayer.errors.SabrDefaultLoadErrorHandlingPolicy;
|
||||
import com.liskovsoft.smartyoutubetv2.common.exoplayer.errors.TrackErrorFixer;
|
||||
import com.liskovsoft.smartyoutubetv2.common.prefs.PlayerTweaksData;
|
||||
import com.liskovsoft.smartyoutubetv2.common.utils.Utils;
|
||||
@@ -186,7 +187,7 @@ public class ExoMediaSourceFactory {
|
||||
getSabrChunkSourceFactory(),
|
||||
null
|
||||
)
|
||||
.setLoadErrorHandlingPolicy(new DashDefaultLoadErrorHandlingPolicy())
|
||||
.setLoadErrorHandlingPolicy(new SabrDefaultLoadErrorHandlingPolicy())
|
||||
.createMediaSource(getSabrManifest(formatInfo));
|
||||
if (mTrackErrorFixer != null) {
|
||||
sabrSource.addEventListener(Utils.sHandler, mTrackErrorFixer);
|
||||
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
package com.liskovsoft.smartyoutubetv2.common.exoplayer.errors;
|
||||
|
||||
import com.liskovsoft.sharedutils.helpers.Helpers;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class SabrDefaultLoadErrorHandlingPolicy extends DashDefaultLoadErrorHandlingPolicy {
|
||||
@Override
|
||||
public long getBlacklistDurationMsFor(int dataType, long loadDurationMs, IOException exception, int errorCount) {
|
||||
return super.getBlacklistDurationMsFor(dataType, loadDurationMs, exception, errorCount);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getRetryDelayMsFor(int dataType, long loadDurationMs, IOException exception, int errorCount) {
|
||||
if (Helpers.contains(exception.getMessage(), "Wait 5 sec")) {
|
||||
return 5_000;
|
||||
}
|
||||
|
||||
return super.getRetryDelayMsFor(dataType, loadDurationMs, exception, errorCount);
|
||||
}
|
||||
}
|
||||
+3
-3
@@ -229,7 +229,7 @@ public final class SabrMediaSource extends BaseMediaSource {
|
||||
public static final class Factory implements AdsMediaSource.MediaSourceFactory {
|
||||
private final SabrChunkSource.Factory chunkSourceFactory;
|
||||
@Nullable private final DataSource.Factory manifestDataSourceFactory;
|
||||
private final DefaultLoadErrorHandlingPolicy loadErrorHandlingPolicy;
|
||||
private LoadErrorHandlingPolicy loadErrorHandlingPolicy;
|
||||
private final DefaultCompositeSequenceableLoaderFactory compositeSequenceableLoaderFactory;
|
||||
private long livePresentationDelayMs;
|
||||
private boolean livePresentationDelayOverridesManifest;
|
||||
@@ -313,8 +313,8 @@ public final class SabrMediaSource extends BaseMediaSource {
|
||||
* @throws IllegalStateException If one of the {@code create} methods has already been called.
|
||||
*/
|
||||
public Factory setLoadErrorHandlingPolicy(LoadErrorHandlingPolicy loadErrorHandlingPolicy) {
|
||||
//Assertions.checkState(!isCreateCalled);
|
||||
//this.loadErrorHandlingPolicy = loadErrorHandlingPolicy;
|
||||
Assertions.checkState(!isCreateCalled);
|
||||
this.loadErrorHandlingPolicy = loadErrorHandlingPolicy;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user