Builder
class Builder
Summary
Public constructors
Public methods
setChangeFrameRateStrategy
fun setChangeFrameRateStrategy(changeFrameRateStrategy: Int): Surface.FrameRateParams.Builder
Whether display refresh rate transitions caused by this surface should be seamless. A seamless transition is one that doesn't have any visual interruptions, such as a black screen for a second or two. Value is Surface.CHANGE_FRAME_RATE_ONLY_IF_SEAMLESS, or Surface.CHANGE_FRAME_RATE_ALWAYS
setDesiredRateRange
fun setDesiredRateRange(
desiredMinRate: Float,
desiredMaxRate: Float
): Surface.FrameRateParams.Builder
Sets the desired frame rate range (inclusive) values for the surface, specifying that the surface prefers the device render rate to be in the range [desiredMinRate, desiredMaxRate]. Set desiredMaxRate to FLOAT.MAX_VALUE to indicate the surface prefers any value greater than or equal to desiredMinRate. Set desiredMinRate = desiredMaxRate to indicate the surface prefers an exact frame rate. Note that this is different than specifying the fixed source frame rate with FrameRateParams.Builder#setFixedSourceRate
. To reiterate, this call is used to specify the surface's frame rate preference to be within the desired range. desiredMaxRate must be greater than or equal to desiredMinRate. The values should be greater than or equal to 0. If the surface has no preference and any frame rate is acceptable, use the constant FrameRateParams.IGNORE in setFrameRate(android.view.Surface.FrameRateParams)
instead of building FrameRateParams.Builder
.
Parameters |
desiredMinRate |
Float: Value is 0.0 or greater |
desiredMaxRate |
Float: Value is 0.0 or greater |
setFixedSourceRate
fun setFixedSourceRate(fixedSourceRate: Float): Surface.FrameRateParams.Builder
Sets the fixed frame rate of the surface when its content has a fixed frame rate, e.g. a video with a fixed frame rate. When the frame rate chosen for the surface is the fixedSourceRate
or a multiple, the surface can render without frame pulldown, for optimal smoothness. For example, a 30 fps video (fixedSourceRate=30
) renders just as well on 30 fps, 60 fps, 90 fps, 120 fps, and so on. This method to set the fixed source rate can also be used together with a desired frame rate range via FrameRateParams.Builder#setDesiredRateRange
. This still means the surface's content has a fixed frame rate of the provided fixedSourceRate
, as well as it preferring to be within the desired frame rate range. For example, a 30 fps video fixedSourceRate=30
and desired frame rate range [60,90] means the surface ideally prefers 60 fps (which is 30 fps * 2) or 90 fps (30 fps * 3).
Parameters |
fixedSourceRate |
Float: Value is 0.0 or greater |