Compute format maxInputSize in FlacReader
Use the maximum frame size as the maximum sample size if provided. PiperOrigin-RevId: 279722820
This commit is contained in:
parent
2b1c2171e7
commit
a8b65ca8d6
@ -73,6 +73,8 @@ import java.util.List;
|
|||||||
byte[] data = packet.data;
|
byte[] data = packet.data;
|
||||||
if (streamMetadata == null) {
|
if (streamMetadata == null) {
|
||||||
streamMetadata = new FlacStreamMetadata(data, 17);
|
streamMetadata = new FlacStreamMetadata(data, 17);
|
||||||
|
int maxInputSize =
|
||||||
|
streamMetadata.maxFrameSize == 0 ? Format.NO_VALUE : streamMetadata.maxFrameSize;
|
||||||
byte[] metadata = Arrays.copyOfRange(data, 9, packet.limit());
|
byte[] metadata = Arrays.copyOfRange(data, 9, packet.limit());
|
||||||
metadata[4] = (byte) 0x80; // Set the last metadata block flag, ignore the other blocks
|
metadata[4] = (byte) 0x80; // Set the last metadata block flag, ignore the other blocks
|
||||||
List<byte[]> initializationData = Collections.singletonList(metadata);
|
List<byte[]> initializationData = Collections.singletonList(metadata);
|
||||||
@ -82,7 +84,7 @@ import java.util.List;
|
|||||||
MimeTypes.AUDIO_FLAC,
|
MimeTypes.AUDIO_FLAC,
|
||||||
/* codecs= */ null,
|
/* codecs= */ null,
|
||||||
streamMetadata.bitRate(),
|
streamMetadata.bitRate(),
|
||||||
/* maxInputSize= */ Format.NO_VALUE,
|
maxInputSize,
|
||||||
streamMetadata.channels,
|
streamMetadata.channels,
|
||||||
streamMetadata.sampleRate,
|
streamMetadata.sampleRate,
|
||||||
initializationData,
|
initializationData,
|
||||||
|
@ -9,7 +9,7 @@ track 0:
|
|||||||
id = null
|
id = null
|
||||||
containerMimeType = null
|
containerMimeType = null
|
||||||
sampleMimeType = audio/flac
|
sampleMimeType = audio/flac
|
||||||
maxInputSize = -1
|
maxInputSize = 5776
|
||||||
width = -1
|
width = -1
|
||||||
height = -1
|
height = -1
|
||||||
frameRate = -1.0
|
frameRate = -1.0
|
||||||
|
@ -9,7 +9,7 @@ track 0:
|
|||||||
id = null
|
id = null
|
||||||
containerMimeType = null
|
containerMimeType = null
|
||||||
sampleMimeType = audio/flac
|
sampleMimeType = audio/flac
|
||||||
maxInputSize = -1
|
maxInputSize = 5776
|
||||||
width = -1
|
width = -1
|
||||||
height = -1
|
height = -1
|
||||||
frameRate = -1.0
|
frameRate = -1.0
|
||||||
|
@ -9,7 +9,7 @@ track 0:
|
|||||||
id = null
|
id = null
|
||||||
containerMimeType = null
|
containerMimeType = null
|
||||||
sampleMimeType = audio/flac
|
sampleMimeType = audio/flac
|
||||||
maxInputSize = -1
|
maxInputSize = 5776
|
||||||
width = -1
|
width = -1
|
||||||
height = -1
|
height = -1
|
||||||
frameRate = -1.0
|
frameRate = -1.0
|
||||||
|
@ -9,7 +9,7 @@ track 0:
|
|||||||
id = null
|
id = null
|
||||||
containerMimeType = null
|
containerMimeType = null
|
||||||
sampleMimeType = audio/flac
|
sampleMimeType = audio/flac
|
||||||
maxInputSize = -1
|
maxInputSize = 5776
|
||||||
width = -1
|
width = -1
|
||||||
height = -1
|
height = -1
|
||||||
frameRate = -1.0
|
frameRate = -1.0
|
||||||
|
@ -9,7 +9,7 @@ track 0:
|
|||||||
id = null
|
id = null
|
||||||
containerMimeType = null
|
containerMimeType = null
|
||||||
sampleMimeType = audio/flac
|
sampleMimeType = audio/flac
|
||||||
maxInputSize = -1
|
maxInputSize = 5776
|
||||||
width = -1
|
width = -1
|
||||||
height = -1
|
height = -1
|
||||||
frameRate = -1.0
|
frameRate = -1.0
|
||||||
|
@ -9,7 +9,7 @@ track 0:
|
|||||||
id = null
|
id = null
|
||||||
containerMimeType = null
|
containerMimeType = null
|
||||||
sampleMimeType = audio/flac
|
sampleMimeType = audio/flac
|
||||||
maxInputSize = -1
|
maxInputSize = 5776
|
||||||
width = -1
|
width = -1
|
||||||
height = -1
|
height = -1
|
||||||
frameRate = -1.0
|
frameRate = -1.0
|
||||||
|
@ -9,7 +9,7 @@ track 0:
|
|||||||
id = null
|
id = null
|
||||||
containerMimeType = null
|
containerMimeType = null
|
||||||
sampleMimeType = audio/flac
|
sampleMimeType = audio/flac
|
||||||
maxInputSize = -1
|
maxInputSize = 5776
|
||||||
width = -1
|
width = -1
|
||||||
height = -1
|
height = -1
|
||||||
frameRate = -1.0
|
frameRate = -1.0
|
||||||
|
@ -9,7 +9,7 @@ track 0:
|
|||||||
id = null
|
id = null
|
||||||
containerMimeType = null
|
containerMimeType = null
|
||||||
sampleMimeType = audio/flac
|
sampleMimeType = audio/flac
|
||||||
maxInputSize = -1
|
maxInputSize = 5776
|
||||||
width = -1
|
width = -1
|
||||||
height = -1
|
height = -1
|
||||||
frameRate = -1.0
|
frameRate = -1.0
|
||||||
|
@ -9,7 +9,7 @@ track 0:
|
|||||||
id = null
|
id = null
|
||||||
containerMimeType = null
|
containerMimeType = null
|
||||||
sampleMimeType = audio/flac
|
sampleMimeType = audio/flac
|
||||||
maxInputSize = -1
|
maxInputSize = 5776
|
||||||
width = -1
|
width = -1
|
||||||
height = -1
|
height = -1
|
||||||
frameRate = -1.0
|
frameRate = -1.0
|
||||||
|
@ -9,7 +9,7 @@ track 0:
|
|||||||
id = null
|
id = null
|
||||||
containerMimeType = null
|
containerMimeType = null
|
||||||
sampleMimeType = audio/flac
|
sampleMimeType = audio/flac
|
||||||
maxInputSize = -1
|
maxInputSize = 5776
|
||||||
width = -1
|
width = -1
|
||||||
height = -1
|
height = -1
|
||||||
frameRate = -1.0
|
frameRate = -1.0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user