Add error codes to reflect failures in using effects.

PiperOrigin-RevId: 509461955
This commit is contained in:
claincly 2023-02-14 09:54:32 +00:00 committed by christosts
parent 3e2c6797bb
commit 749c10ad1e
2 changed files with 13 additions and 3 deletions

View File

@ -228,6 +228,13 @@ public class PlaybackException extends Exception implements Bundleable {
/** Caused by an expired DRM license being loaded into an open DRM session. */
public static final int ERROR_CODE_DRM_LICENSE_EXPIRED = 6008;
// Frame processing errors (7xxx).
/** Caused by a failure when initializing a {@link FrameProcessor}. */
@UnstableApi public static final int ERROR_CODE_FRAME_PROCESSOR_INIT_FAILED = 7000;
/** Caused by a failure when processing a frame. */
@UnstableApi public static final int ERROR_CODE_FRAME_PROCESSING_FAILED = 7001;
/**
* Player implementations that want to surface custom errors can use error codes greater than this
* value, so as to avoid collision with other error codes defined in this class.
@ -305,6 +312,10 @@ public class PlaybackException extends Exception implements Bundleable {
return "ERROR_CODE_DRM_DEVICE_REVOKED";
case ERROR_CODE_DRM_LICENSE_EXPIRED:
return "ERROR_CODE_DRM_LICENSE_EXPIRED";
case ERROR_CODE_FRAME_PROCESSOR_INIT_FAILED:
return "ERROR_CODE_FRAME_PROCESSOR_INIT_FAILED";
case ERROR_CODE_FRAME_PROCESSING_FAILED:
return "ERROR_CODE_FRAME_PROCESSING_FAILED";
default:
if (errorCode >= CUSTOM_ERROR_CODE_BASE) {
return "custom error code";

View File

@ -2036,8 +2036,7 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer {
renderer.createRendererException(
exception,
inputFormat,
// TODO(b/238302341) Add relevant error codes for frame processing.
PlaybackException.ERROR_CODE_UNSPECIFIED));
PlaybackException.ERROR_CODE_FRAME_PROCESSING_FAILED));
}
@Override
@ -2047,7 +2046,7 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer {
});
} catch (Exception e) {
throw renderer.createRendererException(
e, inputFormat, PlaybackException.ERROR_CODE_UNSPECIFIED);
e, inputFormat, PlaybackException.ERROR_CODE_FRAME_PROCESSOR_INIT_FAILED);
}
if (currentSurfaceAndSize != null) {