Fix several API level checks
PiperOrigin-RevId: 556751372
This commit is contained in:
parent
dca4f1a9db
commit
08067eff14
@ -38,8 +38,8 @@ public final class PlayerId {
|
|||||||
|
|
||||||
/** Creates an instance for API < 31. */
|
/** Creates an instance for API < 31. */
|
||||||
public PlayerId() {
|
public PlayerId() {
|
||||||
this(/* logSessionIdApi31= */ (LogSessionIdApi31) null);
|
|
||||||
checkState(Util.SDK_INT < 31);
|
checkState(Util.SDK_INT < 31);
|
||||||
|
this.logSessionIdApi31 = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -52,7 +52,7 @@ public final class PlayerId {
|
|||||||
this(new LogSessionIdApi31(logSessionId));
|
this(new LogSessionIdApi31(logSessionId));
|
||||||
}
|
}
|
||||||
|
|
||||||
private PlayerId(@Nullable LogSessionIdApi31 logSessionIdApi31) {
|
private PlayerId(LogSessionIdApi31 logSessionIdApi31) {
|
||||||
this.logSessionIdApi31 = logSessionIdApi31;
|
this.logSessionIdApi31 = logSessionIdApi31;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@ public final class DrmUtil {
|
|||||||
return PlaybackException.ERROR_CODE_DRM_DEVICE_REVOKED;
|
return PlaybackException.ERROR_CODE_DRM_DEVICE_REVOKED;
|
||||||
} else if (exception instanceof UnsupportedDrmException) {
|
} else if (exception instanceof UnsupportedDrmException) {
|
||||||
return PlaybackException.ERROR_CODE_DRM_SCHEME_UNSUPPORTED;
|
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;
|
return PlaybackException.ERROR_CODE_DRM_CONTENT_ERROR;
|
||||||
} else if (exception instanceof KeysExpiredException) {
|
} else if (exception instanceof KeysExpiredException) {
|
||||||
return PlaybackException.ERROR_CODE_DRM_LICENSE_EXPIRED;
|
return PlaybackException.ERROR_CODE_DRM_LICENSE_EXPIRED;
|
||||||
@ -118,6 +118,11 @@ public final class DrmUtil {
|
|||||||
public static boolean isDeniedByServerException(@Nullable Throwable throwable) {
|
public static boolean isDeniedByServerException(@Nullable Throwable throwable) {
|
||||||
return throwable instanceof DeniedByServerException;
|
return throwable instanceof DeniedByServerException;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@DoNotInline
|
||||||
|
public static boolean isMissingSchemeDataException(@Nullable Throwable throwable) {
|
||||||
|
return throwable instanceof DefaultDrmSessionManager.MissingSchemeDataException;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequiresApi(21)
|
@RequiresApi(21)
|
||||||
|
@ -172,7 +172,7 @@ public final class VideoFrameReleaseHelper {
|
|||||||
* @param surface The new {@link Surface}, or {@code null} if the renderer does not have one.
|
* @param surface The new {@link Surface}, or {@code null} if the renderer does not have one.
|
||||||
*/
|
*/
|
||||||
public void onSurfaceChanged(@Nullable Surface surface) {
|
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.
|
// We don't care about dummy surfaces for release timing, since they're not visible.
|
||||||
surface = null;
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user