mirror of
https://github.com/samsonjs/media.git
synced 2026-04-12 12:25:47 +00:00
Util.getMaxPendingFramesCountForMediaCodecDecoders(): Remove unused arguments
PiperOrigin-RevId: 554838494
This commit is contained in:
parent
7be15b7603
commit
cba027c3b4
3 changed files with 13 additions and 13 deletions
|
|
@ -3012,19 +3012,22 @@ public final class Util {
|
|||
}
|
||||
}
|
||||
|
||||
@UnstableApi
|
||||
public static boolean isFrameDropAllowedOnSurfaceInput(Context context) {
|
||||
// Prior to API 29, decoders may drop frames to keep their output surface from growing out of
|
||||
// bounds. From API 29, if the app targets API 29 or later, the {@link
|
||||
// MediaFormat#KEY_ALLOW_FRAME_DROP} key prevents frame dropping even when the surface is
|
||||
// full.
|
||||
return Util.SDK_INT < 29 || context.getApplicationInfo().targetSdkVersion < 29;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of maximum pending output frames that are allowed on a {@link MediaCodec}
|
||||
* decoder.
|
||||
*/
|
||||
@UnstableApi
|
||||
public static int getMaxPendingFramesCountForMediaCodecDecoders(
|
||||
Context context, String codecName, boolean requestedHdrToneMapping) {
|
||||
if (SDK_INT < 29
|
||||
|| context.getApplicationContext().getApplicationInfo().targetSdkVersion < 29) {
|
||||
// Prior to API 29, decoders may drop frames to keep their output surface from growing out of
|
||||
// bounds. From API 29, if the app targets API 29 or later, the {@link
|
||||
// MediaFormat#KEY_ALLOW_FRAME_DROP} key prevents frame dropping even when the surface is
|
||||
// full.
|
||||
public static int getMaxPendingFramesCountForMediaCodecDecoders(Context context) {
|
||||
if (isFrameDropAllowedOnSurfaceInput(context)) {
|
||||
// Frame dropping is never desired, so a workaround is needed for older API levels.
|
||||
// Allow a maximum of one frame to be pending at a time to prevent frame dropping.
|
||||
// TODO(b/226330223): Investigate increasing this limit.
|
||||
|
|
|
|||
|
|
@ -2264,8 +2264,7 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer {
|
|||
*/
|
||||
public void onCodecInitialized(String codecName) {
|
||||
videoFrameProcessorMaxPendingFrameCount =
|
||||
Util.getMaxPendingFramesCountForMediaCodecDecoders(
|
||||
renderer.context, codecName, /* requestedHdrToneMapping= */ false);
|
||||
Util.getMaxPendingFramesCountForMediaCodecDecoders(renderer.context);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -154,9 +154,7 @@ public final class DefaultCodec implements Codec {
|
|||
}
|
||||
this.mediaCodec = mediaCodec;
|
||||
this.inputSurface = inputSurface;
|
||||
maxPendingFrameCount =
|
||||
Util.getMaxPendingFramesCountForMediaCodecDecoders(
|
||||
context, mediaCodecName, requestedHdrToneMapping);
|
||||
maxPendingFrameCount = Util.getMaxPendingFramesCountForMediaCodecDecoders(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
Loading…
Reference in a new issue