Merge pull request #369 from Tolriq:fix_invalid_frames
PiperOrigin-RevId: 595650068
This commit is contained in:
commit
8eda9f2ed2
@ -97,6 +97,9 @@
|
|||||||
* Fix bug where `MediaMetadata` was only populated from Vorbis comments
|
* Fix bug where `MediaMetadata` was only populated from Vorbis comments
|
||||||
with upper-case keys
|
with upper-case keys
|
||||||
([#876](https://github.com/androidx/media/issues/876)).
|
([#876](https://github.com/androidx/media/issues/876)).
|
||||||
|
* Catch `OutOfMemoryError` when parsing very large ID3 frames, meaning
|
||||||
|
playback can continue without the tag info instead of playback failing
|
||||||
|
completely.
|
||||||
* DRM:
|
* DRM:
|
||||||
* Extend workaround for spurious ClearKey `https://default.url` license
|
* Extend workaround for spurious ClearKey `https://default.url` license
|
||||||
URL to API 33+ (previously the workaround only applied on API 33
|
URL to API 33+ (previously the workaround only applied on API 33
|
||||||
|
@ -372,8 +372,9 @@ public final class Id3Decoder extends SimpleMetadataDecoder {
|
|||||||
frameSize = removeUnsynchronization(id3Data, frameSize);
|
frameSize = removeUnsynchronization(id3Data, frameSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Id3Frame frame = null;
|
||||||
|
Throwable error = null;
|
||||||
try {
|
try {
|
||||||
Id3Frame frame;
|
|
||||||
if (frameId0 == 'T'
|
if (frameId0 == 'T'
|
||||||
&& frameId1 == 'X'
|
&& frameId1 == 'X'
|
||||||
&& frameId2 == 'X'
|
&& frameId2 == 'X'
|
||||||
@ -430,18 +431,21 @@ public final class Id3Decoder extends SimpleMetadataDecoder {
|
|||||||
String id = getFrameId(majorVersion, frameId0, frameId1, frameId2, frameId3);
|
String id = getFrameId(majorVersion, frameId0, frameId1, frameId2, frameId3);
|
||||||
frame = decodeBinaryFrame(id3Data, frameSize, id);
|
frame = decodeBinaryFrame(id3Data, frameSize, id);
|
||||||
}
|
}
|
||||||
if (frame == null) {
|
} catch (OutOfMemoryError | Exception e) {
|
||||||
Log.w(
|
error = e;
|
||||||
TAG,
|
|
||||||
"Failed to decode frame: id="
|
|
||||||
+ getFrameId(majorVersion, frameId0, frameId1, frameId2, frameId3)
|
|
||||||
+ ", frameSize="
|
|
||||||
+ frameSize);
|
|
||||||
}
|
|
||||||
return frame;
|
|
||||||
} finally {
|
} finally {
|
||||||
id3Data.setPosition(nextFramePosition);
|
id3Data.setPosition(nextFramePosition);
|
||||||
}
|
}
|
||||||
|
if (frame == null) {
|
||||||
|
Log.w(
|
||||||
|
TAG,
|
||||||
|
"Failed to decode frame: id="
|
||||||
|
+ getFrameId(majorVersion, frameId0, frameId1, frameId2, frameId3)
|
||||||
|
+ ", frameSize="
|
||||||
|
+ frameSize,
|
||||||
|
error);
|
||||||
|
}
|
||||||
|
return frame;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
|
Loading…
x
Reference in New Issue
Block a user