Skip to content

Commit

Permalink
take byte offset into account when unsynchronizing an id3 frame
Browse files Browse the repository at this point in the history
Issue #5673

PiperOrigin-RevId: 241328598
  • Loading branch information
marcbaechinger authored and ojw28 committed Apr 1, 2019
1 parent 5fd4fdd commit e612511
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion RELEASENOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@
* Prevent seeking when ICY metadata is present to prevent playback problems
([#5658](https://github.com/google/ExoPlayer/issues/5658)).
* Use full BCP 47 language tags in `Format`.
* Select audio track based on system language if no preference is provided.
* Take byte offset into account when unsynchronizing an id3 frame
([#5673](https://github.com/google/ExoPlayer/issues/5673)).

### 2.9.6 ###

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -713,9 +713,11 @@ private static BinaryFrame decodeBinaryFrame(ParsableByteArray id3Data, int fram
*/
private static int removeUnsynchronization(ParsableByteArray data, int length) {
byte[] bytes = data.data;
for (int i = data.getPosition(); i + 1 < length; i++) {
int startPosition = data.getPosition();
for (int i = startPosition; i + 1 < startPosition + length; i++) {
if ((bytes[i] & 0xFF) == 0xFF && bytes[i + 1] == 0x00) {
System.arraycopy(bytes, i + 2, bytes, i + 1, length - i - 2);
int relativePosition = i - startPosition;
System.arraycopy(bytes, i + 2, bytes, i + 1, length - relativePosition - 2);
length--;
}
}
Expand Down

0 comments on commit e612511

Please sign in to comment.