Search in sources :

Example 11 with InvalidResponseCodeException

use of com.google.android.exoplayer2.upstream.HttpDataSource.InvalidResponseCodeException in project ExoPlayer by google.

the class DefaultLoadErrorHandlingPolicyTest method getFallbackSelectionFor_responseCode404.

@Test
public void getFallbackSelectionFor_responseCode404() {
    InvalidResponseCodeException exception = buildInvalidResponseCodeException(404, "Not found");
    @Nullable LoadErrorHandlingPolicy.FallbackSelection defaultPolicyFallbackSelection = getDefaultPolicyFallbackSelection(exception, /* numberOfLocations= */
    1, /* numberOfExcludedLocations= */
    0, /* numberOfTracks= */
    10, /* numberOfExcludedTracks= */
    0);
    assertThat(defaultPolicyFallbackSelection.type).isEqualTo(FALLBACK_TYPE_TRACK);
    assertThat(defaultPolicyFallbackSelection.exclusionDurationMs).isEqualTo(DEFAULT_TRACK_EXCLUSION_MS);
    defaultPolicyFallbackSelection = getDefaultPolicyFallbackSelection(exception, /* numberOfLocations= */
    2, /* numberOfExcludedLocations= */
    0, /* numberOfTracks= */
    4, /* numberOfExcludedTracks= */
    1);
    assertThat(defaultPolicyFallbackSelection.type).isEqualTo(FALLBACK_TYPE_LOCATION);
    assertThat(defaultPolicyFallbackSelection.exclusionDurationMs).isEqualTo(DEFAULT_LOCATION_EXCLUSION_MS);
}
Also used : InvalidResponseCodeException(com.google.android.exoplayer2.upstream.HttpDataSource.InvalidResponseCodeException) Nullable(androidx.annotation.Nullable) Test(org.junit.Test)

Aggregations

Nullable (androidx.annotation.Nullable)9 InvalidResponseCodeException (com.google.android.exoplayer2.upstream.HttpDataSource.InvalidResponseCodeException)8 Test (org.junit.Test)6 DataSourceException (com.google.android.exoplayer2.upstream.DataSourceException)2 IOException (java.io.IOException)2 InterruptedIOException (java.io.InterruptedIOException)2 List (java.util.List)2 LoadEventInfo (com.google.android.exoplayer2.source.LoadEventInfo)1 MediaLoadData (com.google.android.exoplayer2.source.MediaLoadData)1 ContainerMediaChunk (com.google.android.exoplayer2.source.chunk.ContainerMediaChunk)1 MediaChunk (com.google.android.exoplayer2.source.chunk.MediaChunk)1 SingleSampleMediaChunk (com.google.android.exoplayer2.source.chunk.SingleSampleMediaChunk)1 BaseUrl (com.google.android.exoplayer2.source.dash.manifest.BaseUrl)1 DataSourceInputStream (com.google.android.exoplayer2.upstream.DataSourceInputStream)1 DataSpec (com.google.android.exoplayer2.upstream.DataSpec)1 HttpDataSource (com.google.android.exoplayer2.upstream.HttpDataSource)1 LoadErrorHandlingPolicy (com.google.android.exoplayer2.upstream.LoadErrorHandlingPolicy)1 StatsDataSource (com.google.android.exoplayer2.upstream.StatsDataSource)1 SocketTimeoutException (java.net.SocketTimeoutException)1 MediaType (okhttp3.MediaType)1