Update color info mismatch test

This should now expect transformation to succeed.

PiperOrigin-RevId: 470950411
(cherry picked from commit 1023254d8e)
This commit is contained in:
andrewlewis 2022-08-30 11:02:46 +00:00 committed by microkatz
parent 179eafb247
commit 585dfaf55b
2 changed files with 7 additions and 17 deletions

View file

@ -17,15 +17,12 @@ package com.google.android.exoplayer2.transformer.mh;
import static com.google.android.exoplayer2.transformer.AndroidTestUtil.MP4_ASSET_1080P_1_SECOND_HDR10_VIDEO_SDR_CONTAINER;
import static com.google.android.exoplayer2.transformer.AndroidTestUtil.recordTestSkipped;
import static com.google.common.truth.Truth.assertThat;
import static org.junit.Assert.assertThrows;
import android.content.Context;
import android.net.Uri;
import androidx.test.core.app.ApplicationProvider;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import com.google.android.exoplayer2.MediaItem;
import com.google.android.exoplayer2.transformer.TransformationException;
import com.google.android.exoplayer2.transformer.TransformationRequest;
import com.google.android.exoplayer2.transformer.Transformer;
import com.google.android.exoplayer2.transformer.TransformerAndroidTestRunner;
@ -37,7 +34,7 @@ import org.junit.runner.RunWith;
@RunWith(AndroidJUnit4.class)
public class SetHdrEditingTransformationTest {
@Test
public void videoDecoderUnexpectedColorInfo_completesWithError() throws Exception {
public void transformUnexpectedColorInfo() throws Exception {
Context context = ApplicationProvider.getApplicationContext();
if (Util.SDK_INT < 29) {
recordTestSkipped(
@ -53,17 +50,10 @@ public class SetHdrEditingTransformationTest {
.setTransformationRequest(
new TransformationRequest.Builder().experimental_setEnableHdrEditing(true).build())
.build();
TransformationException exception =
assertThrows(
TransformationException.class,
() ->
new TransformerAndroidTestRunner.Builder(context, transformer)
.build()
.run(
/* testId= */ "videoDecoderUnexpectedColorInfo_completesWithError",
MediaItem.fromUri(
Uri.parse(MP4_ASSET_1080P_1_SECOND_HDR10_VIDEO_SDR_CONTAINER))));
assertThat(exception).hasCauseThat().isInstanceOf(IllegalStateException.class);
assertThat(exception.errorCode).isEqualTo(TransformationException.ERROR_CODE_DECODING_FAILED);
new TransformerAndroidTestRunner.Builder(context, transformer)
.build()
.run(
/* testId= */ "transformUnexpectedColorInfo",
MediaItem.fromUri(Uri.parse(MP4_ASSET_1080P_1_SECOND_HDR10_VIDEO_SDR_CONTAINER)));
}
}

View file

@ -328,7 +328,7 @@ public final class DefaultCodec implements Codec {
isToneMappingEnabled ? ColorInfo.SDR_BT709_LIMITED : configurationFormat.colorInfo;
if (!areColorTransfersEqual(expectedColorInfo, outputFormat.colorInfo)) {
// TODO(b/237674316): The container ColorInfo's transfer doesn't match the decoder output
// MediaFormat, or we requested tone-mapping but it hasn't bee applied. We should
// MediaFormat, or we requested tone-mapping but it hasn't been applied. We should
// reconfigure downstream components for this case instead.
Log.w(
TAG,