Commit 13cf2360 by kimvde Committed by Oliver Woodman

Compute format maxInputSize in FlacReader

Use the maximum frame size as the maximum sample size if provided.

PiperOrigin-RevId: 279722820
parent 03511776
......@@ -72,6 +72,8 @@ import java.util.List;
byte[] data = packet.data;
if (streamMetadata == null) {
streamMetadata = new FlacStreamMetadata(data, 17);
int maxInputSize =
streamMetadata.maxFrameSize == 0 ? Format.NO_VALUE : streamMetadata.maxFrameSize;
byte[] metadata = Arrays.copyOfRange(data, 9, packet.limit());
metadata[4] = (byte) 0x80; // Set the last metadata block flag, ignore the other blocks
List<byte[]> initializationData = Collections.singletonList(metadata);
......@@ -81,7 +83,7 @@ import java.util.List;
MimeTypes.AUDIO_FLAC,
/* codecs= */ null,
streamMetadata.bitRate(),
/* maxInputSize= */ Format.NO_VALUE,
maxInputSize,
streamMetadata.channels,
streamMetadata.sampleRate,
initializationData,
......
......@@ -9,7 +9,7 @@ track 0:
id = null
containerMimeType = null
sampleMimeType = audio/flac
maxInputSize = -1
maxInputSize = 5776
width = -1
height = -1
frameRate = -1.0
......
......@@ -9,7 +9,7 @@ track 0:
id = null
containerMimeType = null
sampleMimeType = audio/flac
maxInputSize = -1
maxInputSize = 5776
width = -1
height = -1
frameRate = -1.0
......
......@@ -9,7 +9,7 @@ track 0:
id = null
containerMimeType = null
sampleMimeType = audio/flac
maxInputSize = -1
maxInputSize = 5776
width = -1
height = -1
frameRate = -1.0
......
......@@ -9,7 +9,7 @@ track 0:
id = null
containerMimeType = null
sampleMimeType = audio/flac
maxInputSize = -1
maxInputSize = 5776
width = -1
height = -1
frameRate = -1.0
......
......@@ -9,7 +9,7 @@ track 0:
id = null
containerMimeType = null
sampleMimeType = audio/flac
maxInputSize = -1
maxInputSize = 5776
width = -1
height = -1
frameRate = -1.0
......
......@@ -9,7 +9,7 @@ track 0:
id = null
containerMimeType = null
sampleMimeType = audio/flac
maxInputSize = -1
maxInputSize = 5776
width = -1
height = -1
frameRate = -1.0
......
......@@ -9,7 +9,7 @@ track 0:
id = null
containerMimeType = null
sampleMimeType = audio/flac
maxInputSize = -1
maxInputSize = 5776
width = -1
height = -1
frameRate = -1.0
......
......@@ -9,7 +9,7 @@ track 0:
id = null
containerMimeType = null
sampleMimeType = audio/flac
maxInputSize = -1
maxInputSize = 5776
width = -1
height = -1
frameRate = -1.0
......
......@@ -9,7 +9,7 @@ track 0:
id = null
containerMimeType = null
sampleMimeType = audio/flac
maxInputSize = -1
maxInputSize = 5776
width = -1
height = -1
frameRate = -1.0
......
......@@ -9,7 +9,7 @@ track 0:
id = null
containerMimeType = null
sampleMimeType = audio/flac
maxInputSize = -1
maxInputSize = 5776
width = -1
height = -1
frameRate = -1.0
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment