Update test code based on Google comments

This commit is contained in:
ybai001 2024-08-05 16:20:03 +08:00
parent 6b6d66c7ce
commit 2822919df6
2 changed files with 20 additions and 16 deletions

View File

@ -30,6 +30,7 @@ import static androidx.media3.transformer.AndroidTestUtil.recordTestSkipped;
import static androidx.media3.transformer.Composition.HDR_MODE_KEEP_HDR;
import static androidx.media3.transformer.Composition.HDR_MODE_TONE_MAP_HDR_TO_SDR_USING_OPEN_GL;
import static com.google.common.truth.Truth.assertThat;
import static org.junit.Assume.assumeTrue;
import android.content.Context;
import android.net.Uri;
@ -144,11 +145,7 @@ public final class HdrEditingTest {
public void export_transmuxDolbyVisionFile() throws Exception {
Context context = ApplicationProvider.getApplicationContext();
if (Util.SDK_INT < 24) {
// TODO: b/285543404 - Remove suppression once we can transmux H.265/HEVC before API 24.
recordTestSkipped(context, testId, /* reason= */ "Can't transmux H.265/HEVC before API 24");
return;
}
assumeTrue(Util.SDK_INT >= 24);
if (AndroidTestUtil.skipAndLogIfFormatsUnsupported(
context,
@ -165,15 +162,12 @@ public final class HdrEditingTest {
new TransformerAndroidTestRunner.Builder(context, transformer)
.build()
.run(testId, mediaItem);
Format trackFormat =
retrieveTrackFormat(context, exportTestResult.filePath, C.TRACK_TYPE_VIDEO);
@C.ColorTransfer
int actualColorTransfer =
retrieveTrackFormat(context, exportTestResult.filePath, C.TRACK_TYPE_VIDEO)
.colorInfo
.colorTransfer;
int actualColorTransfer = trackFormat.colorInfo.colorTransfer;
assertThat(actualColorTransfer).isEqualTo(C.COLOR_TRANSFER_HLG);
String actualMimeType =
retrieveTrackFormat(context, exportTestResult.filePath, C.TRACK_TYPE_VIDEO)
.sampleMimeType;
String actualMimeType = trackFormat.sampleMimeType;
assertThat(actualMimeType).isEqualTo(VIDEO_DOLBY_VISION);
}

View File

@ -292,8 +292,13 @@ import java.nio.ByteBuffer;
return supportedMimeTypes.build();
}
// Get Dolby Vision profile
// Refer to https://professionalsupport.dolby.com/s/article/What-is-Dolby-Vision-Profile
/**
* Get Dolby Vision profile
*
* <p>Refer to <a
* href="https://professionalsupport.dolby.com/s/article/What-is-Dolby-Vision-Profile">What
* are Dolby Vision profiles and levels</a>.
*/
@RequiresApi(33)
private static int getDvProfile(Format format) {
// Currently, only profile 8 is supported for encoding
@ -301,8 +306,13 @@ import java.nio.ByteBuffer;
return MediaCodecInfo.CodecProfileLevel.DolbyVisionProfileDvheSt;
}
// Get Dolby Vision level
// Refer to https://professionalsupport.dolby.com/s/article/What-is-Dolby-Vision-Profile
/**
* Get Dolby Vision level
*
* <p>Refer to <a
* href="https://professionalsupport.dolby.com/s/article/What-is-Dolby-Vision-Profile">What
* are Dolby Vision profiles and levels</a>.
*/
@RequiresApi(33)
private static int getDvLevel(Format format) {
int level = -1;