mirror of
https://github.com/samsonjs/media.git
synced 2026-04-27 15:07:40 +00:00
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 bac323d346)
This commit is contained in:
parent
5c7dcf42a0
commit
44de468f63
2 changed files with 7 additions and 11 deletions
|
|
@ -68,8 +68,7 @@ public final class TransformationException extends Exception {
|
||||||
ERROR_CODE_ENCODING_FAILED,
|
ERROR_CODE_ENCODING_FAILED,
|
||||||
ERROR_CODE_OUTPUT_FORMAT_UNSUPPORTED,
|
ERROR_CODE_OUTPUT_FORMAT_UNSUPPORTED,
|
||||||
ERROR_CODE_HDR_EDITING_UNSUPPORTED,
|
ERROR_CODE_HDR_EDITING_UNSUPPORTED,
|
||||||
ERROR_CODE_GL_INIT_FAILED,
|
ERROR_CODE_FRAME_PROCESSING_FAILED,
|
||||||
ERROR_CODE_GL_PROCESSING_FAILED,
|
|
||||||
ERROR_CODE_MUXING_FAILED,
|
ERROR_CODE_MUXING_FAILED,
|
||||||
})
|
})
|
||||||
public @interface ErrorCode {}
|
public @interface ErrorCode {}
|
||||||
|
|
@ -155,10 +154,8 @@ public final class TransformationException extends Exception {
|
||||||
|
|
||||||
// Video editing errors (5xxx).
|
// Video editing errors (5xxx).
|
||||||
|
|
||||||
/** Caused by a GL initialization failure. */
|
/** Caused by a frame processing failure. */
|
||||||
public static final int ERROR_CODE_GL_INIT_FAILED = 5001;
|
public static final int ERROR_CODE_FRAME_PROCESSING_FAILED = 5001;
|
||||||
/** Caused by a failure while using or releasing a GL program. */
|
|
||||||
public static final int ERROR_CODE_GL_PROCESSING_FAILED = 5002;
|
|
||||||
|
|
||||||
// Muxing errors (6xxx).
|
// Muxing errors (6xxx).
|
||||||
/** Caused by a failure while muxing media samples. */
|
/** 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_ENCODING_FAILED", ERROR_CODE_ENCODING_FAILED)
|
||||||
.put("ERROR_CODE_OUTPUT_FORMAT_UNSUPPORTED", ERROR_CODE_OUTPUT_FORMAT_UNSUPPORTED)
|
.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_HDR_EDITING_UNSUPPORTED", ERROR_CODE_HDR_EDITING_UNSUPPORTED)
|
||||||
.put("ERROR_CODE_GL_INIT_FAILED", ERROR_CODE_GL_INIT_FAILED)
|
.put("ERROR_CODE_FRAME_PROCESSING_FAILED", ERROR_CODE_FRAME_PROCESSING_FAILED)
|
||||||
.put("ERROR_CODE_GL_PROCESSING_FAILED", ERROR_CODE_GL_PROCESSING_FAILED)
|
|
||||||
.put("ERROR_CODE_MUXING_FAILED", ERROR_CODE_MUXING_FAILED)
|
.put("ERROR_CODE_MUXING_FAILED", ERROR_CODE_MUXING_FAILED)
|
||||||
.buildOrThrow();
|
.buildOrThrow();
|
||||||
|
|
||||||
|
|
@ -202,7 +198,7 @@ public final class TransformationException extends Exception {
|
||||||
* Equivalent to {@link TransformationException#getErrorCodeName(int)
|
* Equivalent to {@link TransformationException#getErrorCodeName(int)
|
||||||
* TransformationException.getErrorCodeName(this.errorCode)}.
|
* TransformationException.getErrorCodeName(this.errorCode)}.
|
||||||
*/
|
*/
|
||||||
public final String getErrorCodeName() {
|
public String getErrorCodeName() {
|
||||||
return getErrorCodeName(errorCode);
|
return getErrorCodeName(errorCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -120,7 +120,7 @@ import org.checkerframework.dataflow.qual.Pure;
|
||||||
public void onFrameProcessingError(FrameProcessingException exception) {
|
public void onFrameProcessingError(FrameProcessingException exception) {
|
||||||
asyncErrorListener.onTransformationException(
|
asyncErrorListener.onTransformationException(
|
||||||
TransformationException.createForFrameProcessingException(
|
TransformationException.createForFrameProcessingException(
|
||||||
exception, TransformationException.ERROR_CODE_GL_PROCESSING_FAILED));
|
exception, TransformationException.ERROR_CODE_FRAME_PROCESSING_FAILED));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -140,7 +140,7 @@ import org.checkerframework.dataflow.qual.Pure;
|
||||||
/* useHdr= */ encoderWrapper.isHdrEditingEnabled());
|
/* useHdr= */ encoderWrapper.isHdrEditingEnabled());
|
||||||
} catch (FrameProcessingException e) {
|
} catch (FrameProcessingException e) {
|
||||||
throw TransformationException.createForFrameProcessingException(
|
throw TransformationException.createForFrameProcessingException(
|
||||||
e, TransformationException.ERROR_CODE_GL_INIT_FAILED);
|
e, TransformationException.ERROR_CODE_FRAME_PROCESSING_FAILED);
|
||||||
}
|
}
|
||||||
frameProcessor.setInputFrameInfo(
|
frameProcessor.setInputFrameInfo(
|
||||||
new FrameInfo(
|
new FrameInfo(
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue