Commit 44de468f by Googler Committed by microkatz

Generalize frame processing error codes.

TransformationException error codes were previously tied to OpenGL
but other FrameProcessor implementations are possible. So this CL
renames the error codes.
Also, remove GL_INIT_FAILED error code, as FrameProcessor
implemenations may initialize resources on a background thread
after the factory method returns, so it's not obvious how to
distinguish between initialization failures and processing failures.

PiperOrigin-RevId: 463704902
(cherry picked from commit bac323d3)
parent 5c7dcf42
......@@ -68,8 +68,7 @@ public final class TransformationException extends Exception {
ERROR_CODE_ENCODING_FAILED,
ERROR_CODE_OUTPUT_FORMAT_UNSUPPORTED,
ERROR_CODE_HDR_EDITING_UNSUPPORTED,
ERROR_CODE_GL_INIT_FAILED,
ERROR_CODE_GL_PROCESSING_FAILED,
ERROR_CODE_FRAME_PROCESSING_FAILED,
ERROR_CODE_MUXING_FAILED,
})
public @interface ErrorCode {}
......@@ -155,10 +154,8 @@ public final class TransformationException extends Exception {
// Video editing errors (5xxx).
/** Caused by a GL initialization failure. */
public static final int ERROR_CODE_GL_INIT_FAILED = 5001;
/** Caused by a failure while using or releasing a GL program. */
public static final int ERROR_CODE_GL_PROCESSING_FAILED = 5002;
/** Caused by a frame processing failure. */
public static final int ERROR_CODE_FRAME_PROCESSING_FAILED = 5001;
// Muxing errors (6xxx).
/** Caused by a failure while muxing media samples. */
......@@ -183,8 +180,7 @@ public final class TransformationException extends Exception {
.put("ERROR_CODE_ENCODING_FAILED", ERROR_CODE_ENCODING_FAILED)
.put("ERROR_CODE_OUTPUT_FORMAT_UNSUPPORTED", ERROR_CODE_OUTPUT_FORMAT_UNSUPPORTED)
.put("ERROR_CODE_HDR_EDITING_UNSUPPORTED", ERROR_CODE_HDR_EDITING_UNSUPPORTED)
.put("ERROR_CODE_GL_INIT_FAILED", ERROR_CODE_GL_INIT_FAILED)
.put("ERROR_CODE_GL_PROCESSING_FAILED", ERROR_CODE_GL_PROCESSING_FAILED)
.put("ERROR_CODE_FRAME_PROCESSING_FAILED", ERROR_CODE_FRAME_PROCESSING_FAILED)
.put("ERROR_CODE_MUXING_FAILED", ERROR_CODE_MUXING_FAILED)
.buildOrThrow();
......@@ -202,7 +198,7 @@ public final class TransformationException extends Exception {
* Equivalent to {@link TransformationException#getErrorCodeName(int)
* TransformationException.getErrorCodeName(this.errorCode)}.
*/
public final String getErrorCodeName() {
public String getErrorCodeName() {
return getErrorCodeName(errorCode);
}
......
......@@ -120,7 +120,7 @@ import org.checkerframework.dataflow.qual.Pure;
public void onFrameProcessingError(FrameProcessingException exception) {
asyncErrorListener.onTransformationException(
TransformationException.createForFrameProcessingException(
exception, TransformationException.ERROR_CODE_GL_PROCESSING_FAILED));
exception, TransformationException.ERROR_CODE_FRAME_PROCESSING_FAILED));
}
@Override
......@@ -140,7 +140,7 @@ import org.checkerframework.dataflow.qual.Pure;
/* useHdr= */ encoderWrapper.isHdrEditingEnabled());
} catch (FrameProcessingException e) {
throw TransformationException.createForFrameProcessingException(
e, TransformationException.ERROR_CODE_GL_INIT_FAILED);
e, TransformationException.ERROR_CODE_FRAME_PROCESSING_FAILED);
}
frameProcessor.setInputFrameInfo(
new FrameInfo(
......
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