Updated golden file tests and removed deprecated ColorInfo constructor usage

This commit is contained in:
microkatz 2023-09-21 11:07:11 +00:00
parent 212e138bcf
commit e28288f9c5
50 changed files with 260 additions and 12 deletions

View File

@ -430,7 +430,7 @@ public final class MediaCodecInfoTest {
}
private static ColorInfo buildColorInfo(@C.ColorSpace int colorSpace) {
return new ColorInfo(
colorSpace, C.COLOR_RANGE_FULL, C.COLOR_TRANSFER_HLG, /* hdrStaticInfo= */ null);
return new ColorInfo.Builder().setColorSpace(
colorSpace).setColorRange(C.COLOR_RANGE_FULL).setColorTransfer(C.COLOR_TRANSFER_HLG).build();
}
}

View File

@ -90,11 +90,12 @@ public final class MediaCodecUtilTest {
@Test
public void getCodecProfileAndLevel_handlesAv1ProfileMain10HDRWithHdrInfoSet() {
ColorInfo colorInfo =
new ColorInfo(
/* colorSpace= */ C.COLOR_SPACE_BT709,
/* colorRange= */ C.COLOR_RANGE_LIMITED,
/* colorTransfer= */ C.COLOR_TRANSFER_SDR,
/* hdrStaticInfo= */ new byte[] {1, 2, 3, 4, 5, 6, 7});
new ColorInfo.Builder()
.setColorSpace(C.COLOR_SPACE_BT709)
.setColorRange(C.COLOR_RANGE_LIMITED)
.setColorTransfer(C.COLOR_TRANSFER_SDR)
.setHdrStaticInfo(new byte[] {1, 2, 3, 4, 5, 6, 7})
.build();
Format format =
new Format.Builder()
.setSampleMimeType(MimeTypes.VIDEO_AV1)
@ -110,11 +111,11 @@ public final class MediaCodecUtilTest {
@Test
public void getCodecProfileAndLevel_handlesAv1ProfileMain10HDRWithoutHdrInfoSet() {
ColorInfo colorInfo =
new ColorInfo(
/* colorSpace= */ C.COLOR_SPACE_BT709,
/* colorRange= */ C.COLOR_RANGE_LIMITED,
/* colorTransfer= */ C.COLOR_TRANSFER_HLG,
/* hdrStaticInfo= */ null);
new ColorInfo.Builder()
.setColorSpace(C.COLOR_SPACE_BT709)
.setColorRange(C.COLOR_RANGE_LIMITED)
.setColorTransfer(C.COLOR_TRANSFER_HLG)
.build();
Format format =
new Format.Builder()
.setSampleMimeType(MimeTypes.VIDEO_AV1)

View File

@ -26,6 +26,7 @@ import static org.junit.Assert.assertThrows;
import android.net.Uri;
import androidx.media3.common.C;
import androidx.media3.common.ColorInfo;
import androidx.media3.common.Format;
import androidx.media3.common.MimeTypes;
import androidx.media3.extractor.AacUtil;
@ -73,6 +74,11 @@ public class RtspMediaTrackTest {
.setHeight(544)
.setWidth(960)
.setCodecs("avc1.64001F")
.setColorInfo(new ColorInfo.Builder()
.setColorRange(1)
.setLumaBitdepth(8)
.setChromaBitdepth(8)
.build())
.setInitializationData(
ImmutableList.of(
new byte[] {
@ -246,6 +252,12 @@ public class RtspMediaTrackTest {
.setHeight(544)
.setWidth(960)
.setCodecs("avc1.64001F")
.setColorInfo(
new ColorInfo.Builder()
.setColorRange(1)
.setChromaBitdepth(8)
.setLumaBitdepth(8)
.build())
.setInitializationData(
ImmutableList.of(
new byte[] {

View File

@ -17,6 +17,11 @@ track 0:
width = 180
height = 120
pixelWidthHeightRatio = 0.5
colorInfo:
colorSpace = -1
colorRange = -1
colorTransfer = -1
hdrStaticInfo = length 0, hash 0
metadata = entries=[TSSE: description=null: values=[Lavf58.42.100], Mp4Timestamp: creation time=0, modification time=0, timescale=1000]
initializationData:
data = length 32, hash 1F3D6E87

View File

@ -17,6 +17,11 @@ track 0:
width = 180
height = 120
pixelWidthHeightRatio = 0.5
colorInfo:
colorSpace = -1
colorRange = -1
colorTransfer = -1
hdrStaticInfo = length 0, hash 0
metadata = entries=[TSSE: description=null: values=[Lavf58.42.100], Mp4Timestamp: creation time=0, modification time=0, timescale=1000]
initializationData:
data = length 32, hash 1F3D6E87

View File

@ -17,6 +17,11 @@ track 0:
width = 180
height = 120
pixelWidthHeightRatio = 0.5
colorInfo:
colorSpace = -1
colorRange = -1
colorTransfer = -1
hdrStaticInfo = length 0, hash 0
metadata = entries=[TSSE: description=null: values=[Lavf58.42.100], Mp4Timestamp: creation time=0, modification time=0, timescale=1000]
initializationData:
data = length 32, hash 1F3D6E87

View File

@ -17,6 +17,11 @@ track 0:
width = 180
height = 120
pixelWidthHeightRatio = 0.5
colorInfo:
colorSpace = -1
colorRange = -1
colorTransfer = -1
hdrStaticInfo = length 0, hash 0
metadata = entries=[TSSE: description=null: values=[Lavf58.42.100], Mp4Timestamp: creation time=0, modification time=0, timescale=1000]
initializationData:
data = length 32, hash 1F3D6E87

View File

@ -17,6 +17,11 @@ track 0:
width = 1080
height = 720
frameRate = 29.970028
colorInfo:
colorSpace = -1
colorRange = -1
colorTransfer = -1
hdrStaticInfo = length 0, hash 0
metadata = entries=[TSSE: description=null: values=[Lavf56.1.0], xyz: latitude=40.68, longitude=-74.5, Mp4Timestamp: creation time=3547558895, modification time=3547558895, timescale=1000]
initializationData:
data = length 29, hash 4746B5D9

View File

@ -17,6 +17,11 @@ track 0:
width = 1080
height = 720
frameRate = 29.970028
colorInfo:
colorSpace = -1
colorRange = -1
colorTransfer = -1
hdrStaticInfo = length 0, hash 0
metadata = entries=[TSSE: description=null: values=[Lavf56.1.0], xyz: latitude=40.68, longitude=-74.5, Mp4Timestamp: creation time=3547558895, modification time=3547558895, timescale=1000]
initializationData:
data = length 29, hash 4746B5D9

View File

@ -17,6 +17,11 @@ track 0:
width = 1080
height = 720
frameRate = 29.970028
colorInfo:
colorSpace = -1
colorRange = -1
colorTransfer = -1
hdrStaticInfo = length 0, hash 0
metadata = entries=[TSSE: description=null: values=[Lavf56.1.0], xyz: latitude=40.68, longitude=-74.5, Mp4Timestamp: creation time=3547558895, modification time=3547558895, timescale=1000]
initializationData:
data = length 29, hash 4746B5D9

View File

@ -17,6 +17,11 @@ track 0:
width = 1080
height = 720
frameRate = 29.970028
colorInfo:
colorSpace = -1
colorRange = -1
colorTransfer = -1
hdrStaticInfo = length 0, hash 0
metadata = entries=[TSSE: description=null: values=[Lavf56.1.0], xyz: latitude=40.68, longitude=-74.5, Mp4Timestamp: creation time=3547558895, modification time=3547558895, timescale=1000]
initializationData:
data = length 29, hash 4746B5D9

View File

@ -17,6 +17,11 @@ track 0:
width = 1080
height = 720
frameRate = 29.970028
colorInfo:
colorSpace = -1
colorRange = -1
colorTransfer = -1
hdrStaticInfo = length 0, hash 0
metadata = entries=[TSSE: description=null: values=[Lavf56.1.0], xyz: latitude=40.68, longitude=-74.5, Mp4Timestamp: creation time=3547558895, modification time=3547558895, timescale=1000]
initializationData:
data = length 29, hash 4746B5D9

View File

@ -17,6 +17,11 @@ track 0:
width = 1080
height = 720
frameRate = 29.970028
colorInfo:
colorSpace = -1
colorRange = -1
colorTransfer = -1
hdrStaticInfo = length 0, hash 0
metadata = entries=[TSSE: description=null: values=[Lavf56.1.0], Mp4Timestamp: creation time=3547558895, modification time=3547558895, timescale=1000]
initializationData:
data = length 29, hash 4746B5D9

View File

@ -17,6 +17,11 @@ track 0:
width = 1080
height = 720
frameRate = 29.970028
colorInfo:
colorSpace = -1
colorRange = -1
colorTransfer = -1
hdrStaticInfo = length 0, hash 0
metadata = entries=[TSSE: description=null: values=[Lavf56.1.0], Mp4Timestamp: creation time=3547558895, modification time=3547558895, timescale=1000]
initializationData:
data = length 29, hash 4746B5D9

View File

@ -17,6 +17,11 @@ track 0:
width = 1080
height = 720
frameRate = 29.970028
colorInfo:
colorSpace = -1
colorRange = -1
colorTransfer = -1
hdrStaticInfo = length 0, hash 0
metadata = entries=[TSSE: description=null: values=[Lavf56.1.0], Mp4Timestamp: creation time=3547558895, modification time=3547558895, timescale=1000]
initializationData:
data = length 29, hash 4746B5D9

View File

@ -17,6 +17,11 @@ track 0:
width = 1080
height = 720
frameRate = 29.970028
colorInfo:
colorSpace = -1
colorRange = -1
colorTransfer = -1
hdrStaticInfo = length 0, hash 0
metadata = entries=[TSSE: description=null: values=[Lavf56.1.0], Mp4Timestamp: creation time=3547558895, modification time=3547558895, timescale=1000]
initializationData:
data = length 29, hash 4746B5D9

View File

@ -17,6 +17,11 @@ track 0:
width = 1080
height = 720
frameRate = 29.970028
colorInfo:
colorSpace = -1
colorRange = -1
colorTransfer = -1
hdrStaticInfo = length 0, hash 0
metadata = entries=[TSSE: description=null: values=[Lavf56.1.0], Mp4Timestamp: creation time=3547558895, modification time=3547558895, timescale=1000]
initializationData:
data = length 29, hash 4746B5D9

View File

@ -15,6 +15,11 @@ track 256:
codecs = avc1.64001E
width = 640
height = 426
colorInfo:
colorSpace = -1
colorRange = -1
colorTransfer = -1
hdrStaticInfo = length 0, hash 0
initializationData:
data = length 29, hash 4C2CAE9C
data = length 9, hash D971CD89

View File

@ -12,6 +12,11 @@ track 256:
codecs = avc1.64001E
width = 640
height = 426
colorInfo:
colorSpace = -1
colorRange = -1
colorTransfer = -1
hdrStaticInfo = length 0, hash 0
initializationData:
data = length 29, hash 4C2CAE9C
data = length 9, hash D971CD89

View File

@ -15,6 +15,11 @@ track 256:
codecs = avc1.64001E
width = 640
height = 426
colorInfo:
colorSpace = -1
colorRange = -1
colorTransfer = -1
hdrStaticInfo = length 0, hash 0
initializationData:
data = length 29, hash 4C2CAE9C
data = length 9, hash D971CD89

View File

@ -15,6 +15,11 @@ track 256:
codecs = avc1.64001E
width = 640
height = 426
colorInfo:
colorSpace = -1
colorRange = -1
colorTransfer = -1
hdrStaticInfo = length 0, hash 0
initializationData:
data = length 29, hash 4C2CAE9C
data = length 9, hash D971CD89

View File

@ -15,6 +15,11 @@ track 256:
codecs = avc1.64001E
width = 640
height = 426
colorInfo:
colorSpace = -1
colorRange = -1
colorTransfer = -1
hdrStaticInfo = length 0, hash 0
initializationData:
data = length 29, hash 4C2CAE9C
data = length 9, hash D971CD89

View File

@ -15,6 +15,11 @@ track 256:
codecs = avc1.64001E
width = 640
height = 426
colorInfo:
colorSpace = -1
colorRange = -1
colorTransfer = -1
hdrStaticInfo = length 0, hash 0
initializationData:
data = length 29, hash 4C2CAE9C
data = length 9, hash D971CD89

View File

@ -12,6 +12,11 @@ track 256:
codecs = avc1.64001E
width = 640
height = 426
colorInfo:
colorSpace = -1
colorRange = -1
colorTransfer = -1
hdrStaticInfo = length 0, hash 0
initializationData:
data = length 29, hash 4C2CAE9C
data = length 9, hash D971CD89

View File

@ -15,6 +15,11 @@ track 256:
codecs = avc1.64001E
width = 640
height = 426
colorInfo:
colorSpace = -1
colorRange = -1
colorTransfer = -1
hdrStaticInfo = length 0, hash 0
initializationData:
data = length 29, hash 4C2CAE9C
data = length 9, hash D971CD89

View File

@ -15,6 +15,11 @@ track 256:
codecs = avc1.64001E
width = 640
height = 426
colorInfo:
colorSpace = -1
colorRange = -1
colorTransfer = -1
hdrStaticInfo = length 0, hash 0
initializationData:
data = length 29, hash 4C2CAE9C
data = length 9, hash D971CD89

View File

@ -15,6 +15,11 @@ track 256:
codecs = avc1.64001E
width = 640
height = 426
colorInfo:
colorSpace = -1
colorRange = -1
colorTransfer = -1
hdrStaticInfo = length 0, hash 0
initializationData:
data = length 29, hash 4C2CAE9C
data = length 9, hash D971CD89

View File

@ -15,6 +15,11 @@ track 256:
codecs = avc1.64001E
width = 640
height = 426
colorInfo:
colorSpace = -1
colorRange = -1
colorTransfer = -1
hdrStaticInfo = length 0, hash 0
initializationData:
data = length 29, hash 4C2CAE9C
data = length 9, hash D971CD89

View File

@ -12,6 +12,11 @@ track 256:
codecs = avc1.64001E
width = 640
height = 426
colorInfo:
colorSpace = -1
colorRange = -1
colorTransfer = -1
hdrStaticInfo = length 0, hash 0
initializationData:
data = length 29, hash 4C2CAE9C
data = length 9, hash D971CD89

View File

@ -15,6 +15,11 @@ track 256:
codecs = hvc1.1.6.L90.90
width = 854
height = 480
colorInfo:
colorSpace = -1
colorRange = 2
colorTransfer = -1
hdrStaticInfo = length 0, hash 0
initializationData:
data = length 83, hash 7F428
sample 0:

View File

@ -15,6 +15,11 @@ track 256:
codecs = hvc1.1.6.L90.90
width = 854
height = 480
colorInfo:
colorSpace = -1
colorRange = 2
colorTransfer = -1
hdrStaticInfo = length 0, hash 0
initializationData:
data = length 83, hash 7F428
sample 0:

View File

@ -15,6 +15,11 @@ track 256:
codecs = hvc1.1.6.L90.90
width = 854
height = 480
colorInfo:
colorSpace = -1
colorRange = 2
colorTransfer = -1
hdrStaticInfo = length 0, hash 0
initializationData:
data = length 83, hash 7F428
sample 0:

View File

@ -15,6 +15,11 @@ track 256:
codecs = hvc1.1.6.L90.90
width = 854
height = 480
colorInfo:
colorSpace = -1
colorRange = 2
colorTransfer = -1
hdrStaticInfo = length 0, hash 0
initializationData:
data = length 83, hash 7F428
sample 0:

View File

@ -12,6 +12,11 @@ track 256:
codecs = hvc1.1.6.L90.90
width = 854
height = 480
colorInfo:
colorSpace = -1
colorRange = 2
colorTransfer = -1
hdrStaticInfo = length 0, hash 0
initializationData:
data = length 83, hash 7F428
sample 0:

View File

@ -16,6 +16,11 @@ track 256:
width = 914
height = 686
pixelWidthHeightRatio = 1.0003651
colorInfo:
colorSpace = -1
colorRange = -1
colorTransfer = -1
hdrStaticInfo = length 0, hash 0
initializationData:
data = length 146, hash 61554FEF
sample 0:

View File

@ -16,6 +16,11 @@ track 256:
width = 914
height = 686
pixelWidthHeightRatio = 1.0003651
colorInfo:
colorSpace = -1
colorRange = -1
colorTransfer = -1
hdrStaticInfo = length 0, hash 0
initializationData:
data = length 146, hash 61554FEF
sample 0:

View File

@ -16,6 +16,11 @@ track 256:
width = 914
height = 686
pixelWidthHeightRatio = 1.0003651
colorInfo:
colorSpace = -1
colorRange = -1
colorTransfer = -1
hdrStaticInfo = length 0, hash 0
initializationData:
data = length 146, hash 61554FEF
sample 0:

View File

@ -16,6 +16,11 @@ track 256:
width = 914
height = 686
pixelWidthHeightRatio = 1.0003651
colorInfo:
colorSpace = -1
colorRange = -1
colorTransfer = -1
hdrStaticInfo = length 0, hash 0
initializationData:
data = length 146, hash 61554FEF
sample 0:

View File

@ -13,6 +13,11 @@ track 256:
width = 914
height = 686
pixelWidthHeightRatio = 1.0003651
colorInfo:
colorSpace = -1
colorRange = -1
colorTransfer = -1
hdrStaticInfo = length 0, hash 0
initializationData:
data = length 146, hash 61554FEF
sample 0:

View File

@ -6,6 +6,11 @@ format video:
width = 1080
height = 720
frameRate = 29.970028
colorInfo:
colorSpace = -1
colorRange = -1
colorTransfer = -1
hdrStaticInfo = length 0, hash 0
metadata = entries=[TSSE: description=null: values=[Lavf56.1.0], xyz: latitude=40.68, longitude=-74.5, Mp4Timestamp: creation time=3547558895, modification time=3547558895, timescale=1000]
initializationData:
data = length 29, hash 4746B5D9

View File

@ -18,6 +18,11 @@ format video:
width = 1080
height = 720
frameRate = 29.970028
colorInfo:
colorSpace = -1
colorRange = -1
colorTransfer = -1
hdrStaticInfo = length 0, hash 0
metadata = entries=[TSSE: description=null: values=[Lavf56.1.0], xyz: latitude=40.68, longitude=-74.5, Mp4Timestamp: creation time=3547558895, modification time=3547558895, timescale=1000]
initializationData:
data = length 29, hash 4746B5D9

View File

@ -18,6 +18,11 @@ format video:
width = 1080
height = 720
frameRate = 29.970028
colorInfo:
colorSpace = -1
colorRange = -1
colorTransfer = -1
hdrStaticInfo = length 0, hash 0
metadata = entries=[TSSE: description=null: values=[Lavf56.1.0], xyz: latitude=40.68, longitude=-74.5, Mp4Timestamp: creation time=3547558895, modification time=3547558895, timescale=1000]
initializationData:
data = length 29, hash 4746B5D9

View File

@ -19,6 +19,11 @@ format video:
height = 720
frameRate = 29.970028
rotationDegrees = 90
colorInfo:
colorSpace = -1
colorRange = -1
colorTransfer = -1
hdrStaticInfo = length 0, hash 0
metadata = entries=[TSSE: description=null: values=[Lavf56.1.0], xyz: latitude=40.68, longitude=-74.5, Mp4Timestamp: creation time=3547558895, modification time=3547558895, timescale=1000]
initializationData:
data = length 29, hash 4746B5D9

View File

@ -12,6 +12,11 @@ format video:
width = 1080
height = 720
frameRate = 29.970028
colorInfo:
colorSpace = -1
colorRange = -1
colorTransfer = -1
hdrStaticInfo = length 0, hash 0
metadata = entries=[TSSE: description=null: values=[Lavf56.1.0], xyz: latitude=40.68, longitude=-74.5, Mp4Timestamp: creation time=3547558895, modification time=3547558895, timescale=1000]
initializationData:
data = length 29, hash 4746B5D9

View File

@ -12,6 +12,11 @@ format video:
width = 1080
height = 720
frameRate = 29.970028
colorInfo:
colorSpace = -1
colorRange = -1
colorTransfer = -1
hdrStaticInfo = length 0, hash 0
metadata = entries=[TSSE: description=null: values=[Lavf56.1.0], xyz: latitude=40.68, longitude=-74.5, Mp4Timestamp: creation time=3547558895, modification time=3547558895, timescale=1000]
initializationData:
data = length 29, hash 4746B5D9

View File

@ -17,6 +17,11 @@ track 0:
width = 1080
height = 720
frameRate = 32.113037
colorInfo:
colorSpace = -1
colorRange = 2
colorTransfer = -1
hdrStaticInfo = length 0, hash 0
metadata = entries=[mdta: key=com.android.capture.fps, value=60.0, xyz: latitude=40.68, longitude=-74.5, Mp4Timestamp: creation time=3547558895, modification time=3547558895, timescale=10000]
initializationData:
data = length 29, hash 4746B5D9

View File

@ -17,6 +17,11 @@ track 0:
width = 1080
height = 720
frameRate = 32.113037
colorInfo:
colorSpace = -1
colorRange = 2
colorTransfer = -1
hdrStaticInfo = length 0, hash 0
metadata = entries=[xyz: latitude=40.68, longitude=-74.5, Mp4Timestamp: creation time=2000000000, modification time=2000000000, timescale=10000]
initializationData:
data = length 29, hash 4746B5D9

View File

@ -17,6 +17,11 @@ track 0:
width = 1080
height = 720
frameRate = 32.113037
colorInfo:
colorSpace = -1
colorRange = 2
colorTransfer = -1
hdrStaticInfo = length 0, hash 0
metadata = entries=[mdta: key=StringKey, value=StringValue, mdta: key=FloatKey, value=600.0, xyz: latitude=40.68, longitude=-74.5, Mp4Timestamp: creation time=3547558895, modification time=3547558895, timescale=10000]
initializationData:
data = length 29, hash 4746B5D9

View File

@ -17,6 +17,11 @@ track 0:
width = 1080
height = 720
frameRate = 32.113037
colorInfo:
colorSpace = -1
colorRange = 2
colorTransfer = -1
hdrStaticInfo = length 0, hash 0
metadata = entries=[xyz: latitude=45.0, longitude=-90.0, Mp4Timestamp: creation time=3547558895, modification time=3547558895, timescale=10000]
initializationData:
data = length 29, hash 4746B5D9

View File

@ -6,6 +6,11 @@ format video:
width = 320
height = 240
frameRate = 29.523811
colorInfo:
colorSpace = -1
colorRange = -1
colorTransfer = -1
hdrStaticInfo = length 0, hash 0
metadata = entries=[mdta: key=com.android.version, value=10, mdta: key=com.android.video.temporal_layers_count, value=4, mdta: key=com.android.capture.fps, value=240.0, SlowMotion: segments=[Segment: startTimeMs=88, endTimeMs=879, speedDivisor=2, Segment: startTimeMs=1255, endTimeMs=1970, speedDivisor=8], smta: captureFrameRate=240.0, svcTemporalLayerCount=4, Mp4Timestamp: creation time=3686904890, modification time=3686904890, timescale=1000]
initializationData:
data = length 33, hash D3FB879D