mirror of
https://github.com/androidx/media.git
synced 2025-04-30 06:46:50 +08:00
Fix maxInputSize
for AMR-NB
The `maxInputSize` for AMR-NB should be 32, not 61. The `maxInputSize` for AMR-WB is 61. PiperOrigin-RevId: 650282516
This commit is contained in:
parent
06d61ffaaa
commit
007c258ceb
@ -139,9 +139,6 @@ public final class AmrExtractor implements Extractor {
|
|||||||
private static final byte[] amrSignatureNb = Util.getUtf8Bytes("#!AMR\n");
|
private static final byte[] amrSignatureNb = Util.getUtf8Bytes("#!AMR\n");
|
||||||
private static final byte[] amrSignatureWb = Util.getUtf8Bytes("#!AMR-WB\n");
|
private static final byte[] amrSignatureWb = Util.getUtf8Bytes("#!AMR-WB\n");
|
||||||
|
|
||||||
/** Theoretical maximum frame size for a AMR frame. */
|
|
||||||
private static final int MAX_FRAME_SIZE_BYTES = frameSizeBytesByTypeWb[8];
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The required number of samples in the stream with same sample size to classify the stream as a
|
* The required number of samples in the stream with same sample size to classify the stream as a
|
||||||
* constant-bitrate-stream.
|
* constant-bitrate-stream.
|
||||||
@ -284,10 +281,12 @@ public final class AmrExtractor implements Extractor {
|
|||||||
hasOutputFormat = true;
|
hasOutputFormat = true;
|
||||||
String mimeType = isWideBand ? MimeTypes.AUDIO_AMR_WB : MimeTypes.AUDIO_AMR_NB;
|
String mimeType = isWideBand ? MimeTypes.AUDIO_AMR_WB : MimeTypes.AUDIO_AMR_NB;
|
||||||
int sampleRate = isWideBand ? SAMPLE_RATE_WB : SAMPLE_RATE_NB;
|
int sampleRate = isWideBand ? SAMPLE_RATE_WB : SAMPLE_RATE_NB;
|
||||||
|
// Theoretical maximum frame size for a AMR frame.
|
||||||
|
int maxInputSize = isWideBand ? frameSizeBytesByTypeWb[8] : frameSizeBytesByTypeNb[7];
|
||||||
trackOutput.format(
|
trackOutput.format(
|
||||||
new Format.Builder()
|
new Format.Builder()
|
||||||
.setSampleMimeType(mimeType)
|
.setSampleMimeType(mimeType)
|
||||||
.setMaxInputSize(MAX_FRAME_SIZE_BYTES)
|
.setMaxInputSize(maxInputSize)
|
||||||
.setChannelCount(1)
|
.setChannelCount(1)
|
||||||
.setSampleRate(sampleRate)
|
.setSampleRate(sampleRate)
|
||||||
.build());
|
.build());
|
||||||
|
@ -8,7 +8,7 @@ track 0:
|
|||||||
sample count = 218
|
sample count = 218
|
||||||
format 0:
|
format 0:
|
||||||
sampleMimeType = audio/3gpp
|
sampleMimeType = audio/3gpp
|
||||||
maxInputSize = 61
|
maxInputSize = 32
|
||||||
channelCount = 1
|
channelCount = 1
|
||||||
sampleRate = 8000
|
sampleRate = 8000
|
||||||
sample 0:
|
sample 0:
|
||||||
|
@ -8,7 +8,7 @@ track 0:
|
|||||||
sample count = 218
|
sample count = 218
|
||||||
format 0:
|
format 0:
|
||||||
sampleMimeType = audio/3gpp
|
sampleMimeType = audio/3gpp
|
||||||
maxInputSize = 61
|
maxInputSize = 32
|
||||||
channelCount = 1
|
channelCount = 1
|
||||||
sampleRate = 8000
|
sampleRate = 8000
|
||||||
sample 0:
|
sample 0:
|
||||||
|
@ -11,7 +11,7 @@ track 0:
|
|||||||
sample count = 218
|
sample count = 218
|
||||||
format 0:
|
format 0:
|
||||||
sampleMimeType = audio/3gpp
|
sampleMimeType = audio/3gpp
|
||||||
maxInputSize = 61
|
maxInputSize = 32
|
||||||
channelCount = 1
|
channelCount = 1
|
||||||
sampleRate = 8000
|
sampleRate = 8000
|
||||||
sample 0:
|
sample 0:
|
||||||
|
@ -11,7 +11,7 @@ track 0:
|
|||||||
sample count = 146
|
sample count = 146
|
||||||
format 0:
|
format 0:
|
||||||
sampleMimeType = audio/3gpp
|
sampleMimeType = audio/3gpp
|
||||||
maxInputSize = 61
|
maxInputSize = 32
|
||||||
channelCount = 1
|
channelCount = 1
|
||||||
sampleRate = 8000
|
sampleRate = 8000
|
||||||
sample 0:
|
sample 0:
|
||||||
|
@ -11,7 +11,7 @@ track 0:
|
|||||||
sample count = 73
|
sample count = 73
|
||||||
format 0:
|
format 0:
|
||||||
sampleMimeType = audio/3gpp
|
sampleMimeType = audio/3gpp
|
||||||
maxInputSize = 61
|
maxInputSize = 32
|
||||||
channelCount = 1
|
channelCount = 1
|
||||||
sampleRate = 8000
|
sampleRate = 8000
|
||||||
sample 0:
|
sample 0:
|
||||||
|
@ -11,7 +11,7 @@ track 0:
|
|||||||
sample count = 1
|
sample count = 1
|
||||||
format 0:
|
format 0:
|
||||||
sampleMimeType = audio/3gpp
|
sampleMimeType = audio/3gpp
|
||||||
maxInputSize = 61
|
maxInputSize = 32
|
||||||
channelCount = 1
|
channelCount = 1
|
||||||
sampleRate = 8000
|
sampleRate = 8000
|
||||||
sample 0:
|
sample 0:
|
||||||
|
@ -8,7 +8,7 @@ track 0:
|
|||||||
sample count = 218
|
sample count = 218
|
||||||
format 0:
|
format 0:
|
||||||
sampleMimeType = audio/3gpp
|
sampleMimeType = audio/3gpp
|
||||||
maxInputSize = 61
|
maxInputSize = 32
|
||||||
channelCount = 1
|
channelCount = 1
|
||||||
sampleRate = 8000
|
sampleRate = 8000
|
||||||
sample 0:
|
sample 0:
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
format audio:
|
format audio:
|
||||||
sampleMimeType = audio/3gpp
|
sampleMimeType = audio/3gpp
|
||||||
maxInputSize = 61
|
maxInputSize = 32
|
||||||
channelCount = 1
|
channelCount = 1
|
||||||
sampleRate = 8000
|
sampleRate = 8000
|
||||||
sample:
|
sample:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user