From 0e020f778cab07b9effffb190b4e121d8e8ada1a Mon Sep 17 00:00:00 2001 From: microkatz Date: Thu, 31 Oct 2024 12:20:50 +0000 Subject: [PATCH] Added release note --- RELEASENOTES.md | 2 ++ .../java/androidx/media3/exoplayer/rtsp/RtpPacket.java | 8 ++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/RELEASENOTES.md b/RELEASENOTES.md index 650b2001608..78fa5c9a718 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -62,6 +62,8 @@ * DASH Extension: * Smooth Streaming Extension: * RTSP Extension: + * Fix crashing when parsing of RTP packets with header extensions + ([#1225](https://github.com/androidx/media/pull/1225)). * Decoder Extensions (FFmpeg, VP9, AV1, etc.): * Add the MPEG-H decoder module which uses the native MPEG-H decoder module to decode MPEG-H audio diff --git a/libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/RtpPacket.java b/libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/RtpPacket.java index 766906c4e9b..fbf4b144b85 100644 --- a/libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/RtpPacket.java +++ b/libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/RtpPacket.java @@ -205,7 +205,7 @@ public static RtpPacket parse(ParsableByteArray packetBuffer) { byte version = (byte) (firstByte >> 6); boolean padding = ((firstByte >> 5) & 0x1) == 1; byte csrcCount = (byte) (firstByte & 0xF); - boolean hasExtension = ((firstByte & 0x10) >> 4) == 1; + boolean hasExtension = ((firstByte >> 4) & 0x1) == 1; if (version != RTP_VERSION) { return null; @@ -236,11 +236,11 @@ public static RtpPacket parse(ParsableByteArray packetBuffer) { // Extension. if (hasExtension) { - int headerExtensionProfileData = packetBuffer.readShort(); + // Skip profile-defined data + packetBuffer.skipBytes(2); int headerExtensionPayloadLength = packetBuffer.readShort(); if (headerExtensionPayloadLength != 0) { - byte[] extensionPayload = new byte[headerExtensionPayloadLength * 4]; - packetBuffer.readBytes(extensionPayload, 0, headerExtensionPayloadLength * 4); + packetBuffer.skipBytes(headerExtensionPayloadLength * 4); } }