mirror of
https://github.com/androidx/media.git
synced 2025-05-09 08:30:43 +08:00
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 83190a0fe9b7f0cd30398ecc6d1246412ec555d7)
This commit is contained in:
parent
7adca46e4b
commit
55c9d10022
@ -27,6 +27,7 @@ import android.os.Build;
|
||||
import android.util.Pair;
|
||||
import android.view.Surface;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.media3.common.C;
|
||||
import androidx.media3.common.ColorInfo;
|
||||
import androidx.media3.common.Format;
|
||||
import androidx.media3.common.MimeTypes;
|
||||
@ -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")
|
||||
|
Loading…
x
Reference in New Issue
Block a user