diff --git a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/analytics/PlayerId.java b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/analytics/PlayerId.java index 1dabeaa1c7..965c41e7ce 100644 --- a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/analytics/PlayerId.java +++ b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/analytics/PlayerId.java @@ -38,8 +38,8 @@ public final class PlayerId { /** Creates an instance for API < 31. */ public PlayerId() { - this(/* logSessionIdApi31= */ (LogSessionIdApi31) null); checkState(Util.SDK_INT < 31); + this.logSessionIdApi31 = null; } /** @@ -52,7 +52,7 @@ public final class PlayerId { this(new LogSessionIdApi31(logSessionId)); } - private PlayerId(@Nullable LogSessionIdApi31 logSessionIdApi31) { + private PlayerId(LogSessionIdApi31 logSessionIdApi31) { this.logSessionIdApi31 = logSessionIdApi31; } diff --git a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/drm/DrmUtil.java b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/drm/DrmUtil.java index f9101ae08a..d75ca0793d 100644 --- a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/drm/DrmUtil.java +++ b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/drm/DrmUtil.java @@ -86,7 +86,7 @@ public final class DrmUtil { return PlaybackException.ERROR_CODE_DRM_DEVICE_REVOKED; } else if (exception instanceof UnsupportedDrmException) { return PlaybackException.ERROR_CODE_DRM_SCHEME_UNSUPPORTED; - } else if (exception instanceof DefaultDrmSessionManager.MissingSchemeDataException) { + } else if (Util.SDK_INT >= 18 && Api18.isMissingSchemeDataException(exception)) { return PlaybackException.ERROR_CODE_DRM_CONTENT_ERROR; } else if (exception instanceof KeysExpiredException) { return PlaybackException.ERROR_CODE_DRM_LICENSE_EXPIRED; @@ -118,6 +118,11 @@ public final class DrmUtil { 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) diff --git a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/video/VideoFrameReleaseHelper.java b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/video/VideoFrameReleaseHelper.java index 11f179b974..6c1255c9fa 100644 --- a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/video/VideoFrameReleaseHelper.java +++ b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/video/VideoFrameReleaseHelper.java @@ -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 (surface instanceof PlaceholderSurface) { + if (Util.SDK_INT >= 17 && Api17.isPlaceholderSurface(surface)) { // We don't care about dummy surfaces for release timing, since they're not visible. surface = null; } @@ -653,4 +653,13 @@ public final class VideoFrameReleaseHelper { } } } + + @RequiresApi(17) + private static final class Api17 { + + @DoNotInline + public static boolean isPlaceholderSurface(@Nullable Surface surface) { + return surface instanceof PlaceholderSurface; + } + } }