Commit e15e6212 by olly Committed by Oliver Woodman

Fix playback of badly clipped MP3 streams

Issue: #5772
PiperOrigin-RevId: 243987497
parent 721e1dbf
...@@ -32,14 +32,16 @@ ...@@ -32,14 +32,16 @@
replaced with an opt out flag replaced with an opt out flag
(`DataSpec.FLAG_DONT_CACHE_IF_LENGTH_UNKNOWN`). (`DataSpec.FLAG_DONT_CACHE_IF_LENGTH_UNKNOWN`).
* Extractors: * Extractors:
* MP3: Add support for SHOUTcast ICY metadata
([#3735](https://github.com/google/ExoPlayer/issues/3735)).
* MP4/FMP4: Add support for Dolby Vision. * MP4/FMP4: Add support for Dolby Vision.
* MP4: Fix issue handling meta atoms in some streams * MP4: Fix issue handling meta atoms in some streams
([#5698](https://github.com/google/ExoPlayer/issues/5698), ([#5698](https://github.com/google/ExoPlayer/issues/5698),
[#5694](https://github.com/google/ExoPlayer/issues/5694)). [#5694](https://github.com/google/ExoPlayer/issues/5694)).
* MP3: Add support for SHOUTcast ICY metadata
([#3735](https://github.com/google/ExoPlayer/issues/3735)).
* MP3: Fix ID3 frame unsychronization * MP3: Fix ID3 frame unsychronization
([#5673](https://github.com/google/ExoPlayer/issues/5673)). ([#5673](https://github.com/google/ExoPlayer/issues/5673)).
* MP3: Fix playback of badly clipped files
([#5772](https://github.com/google/ExoPlayer/issues/5772)).
* MPEG-TS: Enable HDMV DTS stream detection only if a flag is set. By default * MPEG-TS: Enable HDMV DTS stream detection only if a flag is set. By default
(i.e. if the flag is not set), the 0x82 elementary stream type is now (i.e. if the flag is not set), the 0x82 elementary stream type is now
treated as an SCTE subtitle track treated as an SCTE subtitle track
......
...@@ -341,9 +341,19 @@ public final class Mp3Extractor implements Extractor { ...@@ -341,9 +341,19 @@ public final class Mp3Extractor implements Extractor {
*/ */
private boolean peekEndOfStreamOrHeader(ExtractorInput extractorInput) private boolean peekEndOfStreamOrHeader(ExtractorInput extractorInput)
throws IOException, InterruptedException { throws IOException, InterruptedException {
return (seeker != null && extractorInput.getPeekPosition() == seeker.getDataEndPosition()) if (seeker != null) {
|| !extractorInput.peekFully( long dataEndPosition = seeker.getDataEndPosition();
scratch.data, /* offset= */ 0, /* length= */ 4, /* allowEndOfInput= */ true); if (dataEndPosition != C.POSITION_UNSET
&& extractorInput.getPeekPosition() > dataEndPosition - 4) {
return true;
}
}
try {
return !extractorInput.peekFully(
scratch.data, /* offset= */ 0, /* length= */ 4, /* allowEndOfInput= */ true);
} catch (EOFException e) {
return true;
}
} }
/** /**
......
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