mirror of
https://github.com/samsonjs/media.git
synced 2026-03-25 09:25:53 +00:00
Merge pull request #1117 from loliball:dev_wav_align_fix
PiperOrigin-RevId: 615820438
(cherry picked from commit e9a28beb44)
This commit is contained in:
parent
6f0b70ea78
commit
8a169d104f
4 changed files with 19 additions and 1 deletions
|
|
@ -19,7 +19,10 @@
|
|||
the player selects the 'real' video track in MP4s extracted from motion
|
||||
photos that can contain two HEVC tracks where one has a higher
|
||||
resolution but a very small number of frames
|
||||
([#1051](https://github.com/androidx/media/issues/1051)).
|
||||
([#1051](https://github.com/androidx/media/issues/1051)).
|
||||
* Extractors:
|
||||
* Fix issue where padding was not skipped when reading odd-sized chunks
|
||||
from WAV files ([#1117](https://github.com/androidx/media/pull/1117)).
|
||||
* Audio:
|
||||
* Allow renderer recovery by disabling offload if audio track fails to
|
||||
initialize in offload mode.
|
||||
|
|
|
|||
|
|
@ -172,6 +172,12 @@ import java.io.IOException;
|
|||
while (chunkHeader.id != chunkId) {
|
||||
Log.w(TAG, "Ignoring unknown WAV chunk: " + chunkHeader.id);
|
||||
long bytesToSkip = ChunkHeader.SIZE_IN_BYTES + chunkHeader.size;
|
||||
// According to the RIFF specification, if a chunk's body size is odd, it's followed by a
|
||||
// padding byte of value 0. This ensures each chunk occupies an even number of bytes in the
|
||||
// file. The padding byte isn't included in the size field.
|
||||
if (chunkHeader.size % 2 != 0) {
|
||||
bytesToSkip++; // padding present if size is odd, skip it.
|
||||
}
|
||||
if (bytesToSkip > Integer.MAX_VALUE) {
|
||||
throw ParserException.createForUnsupportedContainerFeature(
|
||||
"Chunk is too large (~2GB+) to skip; id: " + chunkHeader.id);
|
||||
|
|
|
|||
|
|
@ -48,6 +48,15 @@ public final class WavExtractorTest {
|
|||
simulationConfig);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void sample_withOddMetadataChunkSize_extractsSameData() throws Exception {
|
||||
ExtractorAsserts.assertBehavior(
|
||||
WavExtractor::new,
|
||||
"media/wav/sample_with_odd_metadata_chunk_size.wav",
|
||||
new AssertionConfig.Builder().setDumpFilesPrefix("extractordumps/wav/sample.wav").build(),
|
||||
simulationConfig);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void sample_imaAdpcm() throws Exception {
|
||||
ExtractorAsserts.assertBehavior(
|
||||
|
|
|
|||
Binary file not shown.
Loading…
Reference in a new issue