mirror of
https://github.com/samsonjs/media.git
synced 2026-03-29 10:05:48 +00:00
Improve new error type documentation and prevent NPE in error listener.
Adding new error types may cause issues when listeners assume a fixed set of error types and don't handle arbitrary defaults. Fixing error handling in one case and improving documentation to make people aware of the issue. PiperOrigin-RevId: 236093265
This commit is contained in:
parent
92a7bb534a
commit
377e550d0f
2 changed files with 10 additions and 7 deletions
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
### dev-v2 (not yet released) ###
|
||||
|
||||
* Add new `ExoPlaybackException` types for remote exceptions and out-of-memory
|
||||
errors.
|
||||
* HLS:
|
||||
* Prevent unnecessary reloads of initialization segments.
|
||||
* Form an adaptive track group out of audio renditions with matching name.
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ package com.google.android.exoplayer2;
|
|||
|
||||
import androidx.annotation.IntDef;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
import com.google.android.exoplayer2.source.MediaSource;
|
||||
import com.google.android.exoplayer2.util.Assertions;
|
||||
import java.io.IOException;
|
||||
|
|
@ -31,7 +32,8 @@ public final class ExoPlaybackException extends Exception {
|
|||
|
||||
/**
|
||||
* The type of source that produced the error. One of {@link #TYPE_SOURCE}, {@link #TYPE_RENDERER}
|
||||
* {@link #TYPE_UNEXPECTED}, {@link #TYPE_REMOTE} or {@link #TYPE_OUT_OF_MEMORY}.
|
||||
* {@link #TYPE_UNEXPECTED}, {@link #TYPE_REMOTE} or {@link #TYPE_OUT_OF_MEMORY}. Note that new
|
||||
* types may be added in the future and error handling should handle unknown type values.
|
||||
*/
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
|
|
@ -64,10 +66,7 @@ public final class ExoPlaybackException extends Exception {
|
|||
/** The error was an {@link OutOfMemoryError}. */
|
||||
public static final int TYPE_OUT_OF_MEMORY = 4;
|
||||
|
||||
/**
|
||||
* The type of the playback failure. One of {@link #TYPE_SOURCE}, {@link #TYPE_RENDERER}, {@link
|
||||
* #TYPE_UNEXPECTED}, {@link #TYPE_REMOTE} and {@link #TYPE_OUT_OF_MEMORY}.
|
||||
*/
|
||||
/** The {@link Type} of the playback failure. */
|
||||
@Type public final int type;
|
||||
|
||||
/**
|
||||
|
|
@ -104,7 +103,8 @@ public final class ExoPlaybackException extends Exception {
|
|||
* @param cause The cause of the failure.
|
||||
* @return The created instance.
|
||||
*/
|
||||
/* package */ static ExoPlaybackException createForUnexpected(RuntimeException cause) {
|
||||
@VisibleForTesting
|
||||
public static ExoPlaybackException createForUnexpected(RuntimeException cause) {
|
||||
return new ExoPlaybackException(TYPE_UNEXPECTED, cause, /* rendererIndex= */ C.INDEX_UNSET);
|
||||
}
|
||||
|
||||
|
|
@ -124,7 +124,8 @@ public final class ExoPlaybackException extends Exception {
|
|||
* @param cause The cause of the failure.
|
||||
* @return The created instance.
|
||||
*/
|
||||
/* package */ static ExoPlaybackException createForOutOfMemoryError(OutOfMemoryError cause) {
|
||||
@VisibleForTesting
|
||||
public static ExoPlaybackException createForOutOfMemoryError(OutOfMemoryError cause) {
|
||||
return new ExoPlaybackException(TYPE_OUT_OF_MEMORY, cause, /* rendererIndex= */ C.INDEX_UNSET);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue