Remove some API-dependant classes

This commit is contained in:
Gaëtan Muller 2024-01-16 11:34:08 +01:00 committed by Ian Baker
parent 08ab18be77
commit e1ba75c871
2 changed files with 4 additions and 30 deletions

View File

@ -80,13 +80,13 @@ public final class DrmUtil {
return Api21.mediaDrmStateExceptionToErrorCode(exception);
} else if (Util.SDK_INT >= 23 && Api23.isMediaDrmResetException(exception)) {
return PlaybackException.ERROR_CODE_DRM_SYSTEM_ERROR;
} else if (Api18.isNotProvisionedException(exception)) {
} else if (exception instanceof NotProvisionedException) {
return PlaybackException.ERROR_CODE_DRM_PROVISIONING_FAILED;
} else if (Api18.isDeniedByServerException(exception)) {
} else if (exception instanceof DeniedByServerException) {
return PlaybackException.ERROR_CODE_DRM_DEVICE_REVOKED;
} else if (exception instanceof UnsupportedDrmException) {
return PlaybackException.ERROR_CODE_DRM_SCHEME_UNSUPPORTED;
} else if (Api18.isMissingSchemeDataException(exception)) {
} else if (exception instanceof DefaultDrmSessionManager.MissingSchemeDataException) {
return PlaybackException.ERROR_CODE_DRM_CONTENT_ERROR;
} else if (exception instanceof KeysExpiredException) {
return PlaybackException.ERROR_CODE_DRM_LICENSE_EXPIRED;
@ -106,24 +106,6 @@ public final class DrmUtil {
// Internal classes.
private static final class Api18 {
@DoNotInline
public static boolean isNotProvisionedException(@Nullable Throwable throwable) {
return throwable instanceof NotProvisionedException;
}
@DoNotInline
public static boolean isDeniedByServerException(@Nullable Throwable throwable) {
return throwable instanceof DeniedByServerException;
}
@DoNotInline
public static boolean isMissingSchemeDataException(@Nullable Throwable throwable) {
return throwable instanceof DefaultDrmSessionManager.MissingSchemeDataException;
}
}
@RequiresApi(21)
private static final class Api21 {

View File

@ -172,7 +172,7 @@ public final class VideoFrameReleaseHelper {
* @param surface The new {@link Surface}, or {@code null} if the renderer does not have one.
*/
public void onSurfaceChanged(@Nullable Surface surface) {
if (Api17.isPlaceholderSurface(surface)) {
if (surface instanceof PlaceholderSurface) {
// We don't care about dummy surfaces for release timing, since they're not visible.
surface = null;
}
@ -650,12 +650,4 @@ public final class VideoFrameReleaseHelper {
}
}
}
private static final class Api17 {
@DoNotInline
public static boolean isPlaceholderSurface(@Nullable Surface surface) {
return surface instanceof PlaceholderSurface;
}
}
}