public final class VideoFrameReleaseHelper extends Object
Renderer release frames to a Surface. The helper:
Surface frame rate to inform the underlying platform of a fixed frame
rate, when there is one.
| Constructor | Description |
|---|---|
VideoFrameReleaseHelper(Context context) |
Constructs an instance.
|
| Modifier and Type | Method | Description |
|---|---|---|
long |
adjustReleaseTime(long releaseTimeNs) |
Adjusts the release timestamp for the next frame.
|
void |
onDisabled() |
Called when the renderer is disabled.
|
void |
onEnabled() |
Called when the renderer is enabled.
|
void |
onFormatChanged(float formatFrameRate) |
Called when the renderer's output format changes.
|
void |
onNextFrame(long framePresentationTimeUs) |
Called by the renderer for each frame, prior to it being skipped, dropped or rendered.
|
void |
onPlaybackSpeed(float playbackSpeed) |
Called when the renderer's playback speed changes.
|
void |
onPositionReset() |
Called when the renderer's position is reset.
|
void |
onStarted() |
Called when the renderer is started.
|
void |
onStopped() |
Called when the renderer is stopped.
|
void |
onSurfaceChanged(Surface surface) |
Called when the renderer changes which
Surface it's rendering to renders to. |
public VideoFrameReleaseHelper(@Nullable
Context context)
context - A context from which information about the default display can be retrieved.public void onEnabled()
public void onStarted()
public void onSurfaceChanged(@Nullable
Surface surface)
Surface it's rendering to renders to.surface - The new Surface, or null if the renderer does not have one.public void onPositionReset()
public void onPlaybackSpeed(float playbackSpeed)
playbackSpeed - The factor by which playback is sped up.public void onFormatChanged(float formatFrameRate)
formatFrameRate - The format's frame rate, or Format.NO_VALUE if unknown.public void onNextFrame(long framePresentationTimeUs)
framePresentationTimeUs - The frame presentation timestamp, in microseconds.public void onStopped()
public void onDisabled()
public long adjustReleaseTime(long releaseTimeNs)
onNextFrame(long).
This method may be called any number of times for each frame, including zero times (for skipped frames, or when rendering the first frame prior to playback starting), or more than once (if the caller wishes to give the helper the opportunity to refine a release time closer to when the frame needs to be released).
releaseTimeNs - The frame's unadjusted release time, in nanoseconds and in the same time
base as System.nanoTime().System.nanoTime().