mirror of
https://github.com/samsonjs/media.git
synced 2026-04-11 12:15:47 +00:00
Partial revert of 3a7d31a599
The original change did not set the color info in the codec
for standard SDR infos. This was meant to help with consistency
to avoid a situation where the information is partially set and
later the bitstream provides slightly different values (all in
standard SDR though).
We can revert this part because the bitstream may change anyway
and the decoder needs to handle this internally. And more
importantly, it also avoids removing this information when encoding
the format again in Transformer.
PiperOrigin-RevId: 617582066
(cherry picked from commit ed505df2ca)
This commit is contained in:
parent
b0adf2fe43
commit
5fc9ddab0b
2 changed files with 1 additions and 13 deletions
|
|
@ -252,7 +252,7 @@ public final class MediaFormatUtil {
|
|||
*/
|
||||
@SuppressWarnings("InlinedApi")
|
||||
public static void maybeSetColorInfo(MediaFormat format, @Nullable ColorInfo colorInfo) {
|
||||
if (!ColorInfo.isEquivalentToAssumedSdrDefault(colorInfo)) {
|
||||
if (colorInfo != null) {
|
||||
maybeSetInteger(format, MediaFormat.KEY_COLOR_TRANSFER, colorInfo.colorTransfer);
|
||||
maybeSetInteger(format, MediaFormat.KEY_COLOR_STANDARD, colorInfo.colorSpace);
|
||||
maybeSetInteger(format, MediaFormat.KEY_COLOR_RANGE, colorInfo.colorRange);
|
||||
|
|
|
|||
|
|
@ -240,16 +240,4 @@ public class MediaFormatUtilTest {
|
|||
.isEqualTo(C.ENCODING_PCM_16BIT_BIG_ENDIAN);
|
||||
assertThat(mediaFormat.containsKey(MediaFormat.KEY_PCM_ENCODING)).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void createMediaFormatFromFormat_withSdrColorInfo_omitsMediaFormatColorInfoKeys() {
|
||||
Format format = new Format.Builder().setColorInfo(ColorInfo.SDR_BT709_LIMITED).build();
|
||||
|
||||
MediaFormat mediaFormat = MediaFormatUtil.createMediaFormatFromFormat(format);
|
||||
|
||||
assertThat(mediaFormat.containsKey(MediaFormat.KEY_COLOR_TRANSFER)).isFalse();
|
||||
assertThat(mediaFormat.containsKey(MediaFormat.KEY_COLOR_RANGE)).isFalse();
|
||||
assertThat(mediaFormat.containsKey(MediaFormat.KEY_COLOR_STANDARD)).isFalse();
|
||||
assertThat(mediaFormat.containsKey(MediaFormat.KEY_HDR_STATIC_INFO)).isFalse();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue