Commit 4c1438b4 by huangdarwin Committed by Tofunmi Adigun-Hameed

HDR: Blocklist Galaxy Z Fold 4 for HLG tone mapping.

This device failed on HdrEditingTest's exportAndTranscode_hlg10File_whenHdrEditingUnsupported_toneMapsOrThrows
before this CL, and succeeds on that test after this CL.

PiperOrigin-RevId: 532796897
(cherry picked from commit 68946d992a12e3c12a06bd0157b70aacd6c70851)
parent 0445c1cc
......@@ -27,6 +27,7 @@ import android.os.Build;
import android.util.Pair;
import android.view.Surface;
import androidx.annotation.Nullable;
import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.Format;
import com.google.android.exoplayer2.mediacodec.MediaCodecInfo;
import com.google.android.exoplayer2.mediacodec.MediaCodecSelector;
......@@ -85,7 +86,10 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
checkNotNull(format.sampleMimeType);
if (ColorInfo.isTransferHdr(format.colorInfo)) {
if (requestSdrToneMapping && (SDK_INT < 31 || deviceNeedsNoToneMappingWorkaround())) {
if (requestSdrToneMapping
&& (SDK_INT < 31
|| deviceNeedsDisableToneMappingWorkaround(
checkNotNull(format.colorInfo).colorTransfer))) {
throw createExportException(
format, /* reason= */ "Tone-mapping HDR is not supported on this device.");
}
......@@ -128,10 +132,20 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
context, format, mediaFormat, mediaCodecName, /* isDecoder= */ true, outputSurface);
}
private static boolean deviceNeedsNoToneMappingWorkaround() {
// Some Pixel 6 builds report support for tone mapping but the feature doesn't work
// (see http://b/249297370#comment8).
return Util.MANUFACTURER.equals("Google") && Build.ID.startsWith("TP1A");
private static boolean deviceNeedsDisableToneMappingWorkaround(
@C.ColorTransfer int colorTransfer) {
if (Util.MANUFACTURER.equals("Google") && Build.ID.startsWith("TP1A")) {
// Some Pixel 6 builds report support for tone mapping but the feature doesn't work
// (see b/249297370#comment8).
return true;
}
if (colorTransfer == C.COLOR_TRANSFER_HLG
&& (Util.MODEL.startsWith("SM-F936") || Util.MODEL.startsWith("SM-F916"))) {
// Some Samsung Galaxy Z Fold devices report support for HLG tone mapping but the feature only
// works on PQ (see b/282791751#comment7).
return true;
}
return false;
}
@RequiresNonNull("#1.sampleMimeType")
......
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