Commit f500110c by aquilescanta Committed by Oliver Woodman

Use MediaLoadData and LoadEventInfo in LoadErrorInfo

PiperOrigin-RevId: 303717642
parent c7164a30
...@@ -16,6 +16,8 @@ ...@@ -16,6 +16,8 @@
package com.google.android.exoplayer2.upstream; package com.google.android.exoplayer2.upstream;
import com.google.android.exoplayer2.C; import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.source.LoadEventInfo;
import com.google.android.exoplayer2.source.MediaLoadData;
import com.google.android.exoplayer2.upstream.Loader.Callback; import com.google.android.exoplayer2.upstream.Loader.Callback;
import com.google.android.exoplayer2.upstream.Loader.Loadable; import com.google.android.exoplayer2.upstream.Loader.Loadable;
import java.io.IOException; import java.io.IOException;
...@@ -41,22 +43,23 @@ public interface LoadErrorHandlingPolicy { ...@@ -41,22 +43,23 @@ public interface LoadErrorHandlingPolicy {
/** Holds information about a load task error. */ /** Holds information about a load task error. */
final class LoadErrorInfo { final class LoadErrorInfo {
/** One of the {@link C C.DATA_TYPE_*} constants indicating the type of data to load. */ /** The {@link LoadEventInfo} associated with the load that encountered an error. */
public final int dataType; public final LoadEventInfo loadEventInfo;
/** /** {@link MediaLoadData} associated with the load that encountered an error. */
* The duration in milliseconds of the load from the start of the first load attempt up to the public final MediaLoadData mediaLoadData;
* point at which the error occurred.
*/
public final long loadDurationMs;
/** The exception associated to the load error. */ /** The exception associated to the load error. */
public final IOException exception; public final IOException exception;
/** The number of errors this load task has encountered, including this one. */ /** The number of errors this load task has encountered, including this one. */
public final int errorCount; public final int errorCount;
/** Creates an instance with the given values. */ /** Creates an instance with the given values. */
public LoadErrorInfo(int dataType, long loadDurationMs, IOException exception, int errorCount) { public LoadErrorInfo(
this.dataType = dataType; LoadEventInfo loadEventInfo,
this.loadDurationMs = loadDurationMs; MediaLoadData mediaLoadData,
IOException exception,
int errorCount) {
this.loadEventInfo = loadEventInfo;
this.mediaLoadData = mediaLoadData;
this.exception = exception; this.exception = exception;
this.errorCount = errorCount; this.errorCount = errorCount;
} }
...@@ -88,8 +91,8 @@ public interface LoadErrorHandlingPolicy { ...@@ -88,8 +91,8 @@ public interface LoadErrorHandlingPolicy {
*/ */
default long getBlacklistDurationMsFor(LoadErrorInfo loadErrorInfo) { default long getBlacklistDurationMsFor(LoadErrorInfo loadErrorInfo) {
return getBlacklistDurationMsFor( return getBlacklistDurationMsFor(
loadErrorInfo.dataType, loadErrorInfo.mediaLoadData.dataType,
loadErrorInfo.loadDurationMs, loadErrorInfo.loadEventInfo.loadDurationMs,
loadErrorInfo.exception, loadErrorInfo.exception,
loadErrorInfo.errorCount); loadErrorInfo.errorCount);
} }
...@@ -127,8 +130,8 @@ public interface LoadErrorHandlingPolicy { ...@@ -127,8 +130,8 @@ public interface LoadErrorHandlingPolicy {
*/ */
default long getRetryDelayMsFor(LoadErrorInfo loadErrorInfo) { default long getRetryDelayMsFor(LoadErrorInfo loadErrorInfo) {
return getRetryDelayMsFor( return getRetryDelayMsFor(
loadErrorInfo.dataType, loadErrorInfo.mediaLoadData.dataType,
loadErrorInfo.loadDurationMs, loadErrorInfo.loadEventInfo.loadDurationMs,
loadErrorInfo.exception, loadErrorInfo.exception,
loadErrorInfo.errorCount); loadErrorInfo.errorCount);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment