Skip to content

Commit

Permalink
Fix playback of badly clipped MP3 streams
Browse files Browse the repository at this point in the history
Issue: #5772
PiperOrigin-RevId: 243987497
  • Loading branch information
ojw28 committed Apr 18, 2019
1 parent 721e1db commit e15e621
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
6 changes: 4 additions & 2 deletions RELEASENOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,16 @@
replaced with an opt out flag
(`DataSpec.FLAG_DONT_CACHE_IF_LENGTH_UNKNOWN`).
* Extractors:
* MP3: Add support for SHOUTcast ICY metadata
([#3735](https://github.com/google/ExoPlayer/issues/3735)).
* MP4/FMP4: Add support for Dolby Vision.
* MP4: Fix issue handling meta atoms in some streams
([#5698](https://github.com/google/ExoPlayer/issues/5698),
[#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
([#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
(i.e. if the flag is not set), the 0x82 elementary stream type is now
treated as an SCTE subtitle track
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -341,9 +341,19 @@ private boolean synchronize(ExtractorInput input, boolean sniffing)
*/
private boolean peekEndOfStreamOrHeader(ExtractorInput extractorInput)
throws IOException, InterruptedException {
return (seeker != null && extractorInput.getPeekPosition() == seeker.getDataEndPosition())
|| !extractorInput.peekFully(
scratch.data, /* offset= */ 0, /* length= */ 4, /* allowEndOfInput= */ true);
if (seeker != null) {
long dataEndPosition = seeker.getDataEndPosition();
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;
}
}

/**
Expand Down

0 comments on commit e15e621

Please sign in to comment.