static NoPlayer.PlayerError map(RuntimeException unexpectedException, String message) {
if (unexpectedException instanceof EGLSurfaceTexture.GlException) {
return new NoPlayerError(PlayerErrorType.UNEXPECTED, DetailErrorType.EGL_OPERATION_ERROR, message);
}
if (unexpectedException instanceof DefaultAudioSink.InvalidAudioTrackTimestampException) {
return new NoPlayerError(PlayerErrorType.UNEXPECTED, DetailErrorType.SPURIOUS_AUDIO_TRACK_TIMESTAMP_ERROR, message);
}
if (unexpectedException instanceof IllegalStateException && message.contains("Multiple renderer media clocks")) {
return new NoPlayerError(PlayerErrorType.UNEXPECTED, DetailErrorType.MULTIPLE_RENDERER_MEDIA_CLOCK_ENABLED_ERROR, message);
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && unexpectedException instanceof MediaCodec.CodecException) {
String errorMessage = ErrorFormatter.formatCodecException((MediaCodec.CodecException) unexpectedException);
return new NoPlayerError(PlayerErrorType.UNEXPECTED, DetailErrorType.UNEXPECTED_CODEC_ERROR, errorMessage);
}
return new NoPlayerError(PlayerErrorType.UNKNOWN, DetailErrorType.UNKNOWN, message);
}
}