diff --git a/RELEASENOTES.md b/RELEASENOTES.md index dcae95e28f..5b3228c0d6 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -4,8 +4,10 @@ * Fix distorted playback of floating point audio when samples exceed the `[-1, 1]` nominal range. -* MP4: Add support for `piff` and `isml` brands - ([#7584](https://github.com/google/ExoPlayer/issues/7584)). +* MP4: + * Add support for `piff` and `isml` brands + ([#7584](https://github.com/google/ExoPlayer/issues/7584)). + * Fix playback of very short MP4 files. * FMP4: Fix `saiz` and `senc` sample count checks, resolving a "length mismatch" `ParserException` when playing certain protected FMP4 streams ([#7592](https://github.com/google/ExoPlayer/issues/7592)). diff --git a/library/core/src/main/java/com/google/android/exoplayer2/extractor/mp4/Sniffer.java b/library/core/src/main/java/com/google/android/exoplayer2/extractor/mp4/Sniffer.java index 40e516aefd..1e1c5450be 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/extractor/mp4/Sniffer.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/extractor/mp4/Sniffer.java @@ -103,7 +103,12 @@ import java.io.IOException; // Read an atom header. int headerSize = Atom.HEADER_SIZE; buffer.reset(headerSize); - input.peekFully(buffer.data, 0, headerSize); + boolean success = + input.peekFully(buffer.data, 0, headerSize, /* allowEndOfInput= */ true); + if (!success) { + // We've reached the end of the file. + break; + } long atomSize = buffer.readUnsignedInt(); int atomType = buffer.readInt(); if (atomSize == Atom.DEFINES_LARGE_SIZE) {