Skip to content

Commit

Permalink
Util.getMaxPendingFramesCountForMediaCodecDecoders(): Remove unused a…
Browse files Browse the repository at this point in the history
…rguments

PiperOrigin-RevId: 554838494
  • Loading branch information
christosts authored and tianyif committed Aug 10, 2023
1 parent 7be15b7 commit cba027c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3012,19 +3012,22 @@ public static int getErrorCodeFromPlatformDiagnosticsInfo(@Nullable String diagn
}
}

@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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2264,8 +2264,7 @@ public MediaFormat amendMediaFormatKeys(MediaFormat mediaFormat) {
*/
public void onCodecInitialized(String codecName) {
videoFrameProcessorMaxPendingFrameCount =
Util.getMaxPendingFramesCountForMediaCodecDecoders(
renderer.context, codecName, /* requestedHdrToneMapping= */ false);
Util.getMaxPendingFramesCountForMediaCodecDecoders(renderer.context);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,7 @@ public DefaultCodec(
}
this.mediaCodec = mediaCodec;
this.inputSurface = inputSurface;
maxPendingFrameCount =
Util.getMaxPendingFramesCountForMediaCodecDecoders(
context, mediaCodecName, requestedHdrToneMapping);
maxPendingFrameCount = Util.getMaxPendingFramesCountForMediaCodecDecoders(context);
}

@Override
Expand Down

0 comments on commit cba027c

Please sign in to comment.