ExoPlayer: Remove tone-mapping workaround.

PiperOrigin-RevId: 560069496
This commit is contained in:
huangdarwin 2023-08-25 06:05:21 -07:00 committed by Copybara-Service
parent 9810d6ae92
commit dccbc7e459

View File

@ -235,8 +235,16 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
// Playback thread handler.
handler = Util.createHandlerForCurrentLooper();
Pair<ColorInfo, ColorInfo> inputAndOutputColorInfos =
experimentalGetVideoFrameProcessorColorConfiguration(sourceFormat.colorInfo);
ColorInfo inputColorInfo =
sourceFormat.colorInfo != null && ColorInfo.isTransferHdr(sourceFormat.colorInfo)
? sourceFormat.colorInfo
: ColorInfo.SDR_BT709_LIMITED;
ColorInfo outputColorInfo = inputColorInfo;
if (inputColorInfo.colorTransfer == C.COLOR_TRANSFER_HLG) {
// SurfaceView only supports BT2020 PQ input. Therefore, convert HLG to PQ.
outputColorInfo =
inputColorInfo.buildUpon().setColorTransfer(C.COLOR_TRANSFER_ST2084).build();
}
@SuppressWarnings("nullness:assignment")
@Initialized
@ -245,8 +253,8 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
videoFrameProcessorFactory.create(
context,
DebugViewProvider.NONE,
inputAndOutputColorInfos.first,
inputAndOutputColorInfos.second,
inputColorInfo,
outputColorInfo,
/* renderFramesAutomatically= */ false,
/* listenerExecutor= */ handler::post,
thisRef);
@ -512,29 +520,6 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
.build());
}
/**
* Returns a {@link Pair} of {@linkplain ColorInfo input color} and {@linkplain ColorInfo output
* color} to configure the {@code VideoFrameProcessor}.
*/
private static Pair<ColorInfo, ColorInfo> experimentalGetVideoFrameProcessorColorConfiguration(
@Nullable ColorInfo inputColorInfo) {
// TODO b/279163661 - Remove this method after VideoFrameProcessor supports texture ID
// input/output.
// explicit check for nullness
if (inputColorInfo == null || !ColorInfo.isTransferHdr(inputColorInfo)) {
return Pair.create(ColorInfo.SDR_BT709_LIMITED, ColorInfo.SDR_BT709_LIMITED);
}
if (inputColorInfo.colorTransfer == C.COLOR_TRANSFER_HLG) {
// SurfaceView only supports BT2020 PQ input, converting HLG to PQ.
return Pair.create(
inputColorInfo,
inputColorInfo.buildUpon().setColorTransfer(C.COLOR_TRANSFER_ST2084).build());
}
return Pair.create(inputColorInfo, inputColorInfo);
}
/**
* Sets the output surface info.
*