Commit 4496cf55 by huangdarwin Committed by Ian Baker

HDR: Limit Z Fold 4 c2.qti decoder pending frame count.

Bypass Z Fold 4 HDR10 tone-mapping bug by limiting the max frame count to 12.

This passed with a value of 14, and failed with a value of 15, but I figured I'd use 12 just to be safe.

PiperOrigin-RevId: 491684058
parent 349144f6
...@@ -20,6 +20,7 @@ import static com.google.android.exoplayer2.util.Assertions.checkArgument; ...@@ -20,6 +20,7 @@ import static com.google.android.exoplayer2.util.Assertions.checkArgument;
import static com.google.android.exoplayer2.util.Assertions.checkNotNull; import static com.google.android.exoplayer2.util.Assertions.checkNotNull;
import static com.google.android.exoplayer2.util.Assertions.checkState; import static com.google.android.exoplayer2.util.Assertions.checkState;
import static com.google.android.exoplayer2.util.Assertions.checkStateNotNull; import static com.google.android.exoplayer2.util.Assertions.checkStateNotNull;
import static com.google.android.exoplayer2.util.Util.MODEL;
import static com.google.android.exoplayer2.util.Util.SDK_INT; import static com.google.android.exoplayer2.util.Util.SDK_INT;
import android.content.Context; import android.content.Context;
...@@ -64,6 +65,7 @@ public final class DefaultCodec implements Codec { ...@@ -64,6 +65,7 @@ public final class DefaultCodec implements Codec {
private final MediaCodec mediaCodec; private final MediaCodec mediaCodec;
@Nullable private final Surface inputSurface; @Nullable private final Surface inputSurface;
private final boolean decoderNeedsFrameDroppingWorkaround; private final boolean decoderNeedsFrameDroppingWorkaround;
private final boolean requestedHdrToneMapping;
private @MonotonicNonNull Format outputFormat; private @MonotonicNonNull Format outputFormat;
@Nullable private ByteBuffer outputBuffer; @Nullable private ByteBuffer outputBuffer;
...@@ -104,7 +106,7 @@ public final class DefaultCodec implements Codec { ...@@ -104,7 +106,7 @@ public final class DefaultCodec implements Codec {
@Nullable MediaCodec mediaCodec = null; @Nullable MediaCodec mediaCodec = null;
@Nullable Surface inputSurface = null; @Nullable Surface inputSurface = null;
try { try {
boolean requestedHdrToneMapping = requestedHdrToneMapping =
SDK_INT >= 29 && Api29.isSdrToneMappingEnabled(configurationMediaFormat); SDK_INT >= 29 && Api29.isSdrToneMappingEnabled(configurationMediaFormat);
mediaCodec = MediaCodec.createByCodecName(mediaCodecName); mediaCodec = MediaCodec.createByCodecName(mediaCodecName);
configureCodec(mediaCodec, configurationMediaFormat, isDecoder, outputSurface); configureCodec(mediaCodec, configurationMediaFormat, isDecoder, outputSurface);
...@@ -162,6 +164,15 @@ public final class DefaultCodec implements Codec { ...@@ -162,6 +164,15 @@ public final class DefaultCodec implements Codec {
// OMX video codecs should no longer exist from android.os.Build.DEVICE_INITIAL_SDK_INT 31+. // OMX video codecs should no longer exist from android.os.Build.DEVICE_INITIAL_SDK_INT 31+.
return 5; return 5;
} }
if (requestedHdrToneMapping
&& getName().equals("c2.qti.hevc.decoder")
&& MODEL.equals("SM-F936B")) {
// This decoder gets stuck if too many frames are rendered without being processed when
// tone-mapping HDR10. This value is experimentally determined. See also b/260408846.
// TODO(b/260713009): Add API version check after bug is fixed on new API versions.
return 12;
}
// Otherwise don't limit the number of frames that can be pending at a time, to maximize // Otherwise don't limit the number of frames that can be pending at a time, to maximize
// throughput. // throughput.
return UNLIMITED_PENDING_FRAME_COUNT; return UNLIMITED_PENDING_FRAME_COUNT;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment