From cd076f7622b70b543cec97cefd2072e4997fff9f Mon Sep 17 00:00:00 2001 From: claincly Date: Fri, 21 Jan 2022 11:34:17 +0000 Subject: [PATCH] Ignore invalid RTP-Info header value. Issue: google/ExoPlayer#9619 (and a few other GH issues related to invalid RTP-Info header) PiperOrigin-RevId: 423283017 --- RELEASENOTES.md | 2 ++ .../exoplayer2/source/rtsp/RtspClient.java | 17 ++++++++++++----- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/RELEASENOTES.md b/RELEASENOTES.md index 13c13e8795..e6a6eff6cd 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -110,6 +110,8 @@ ([#9800](https://github.com/google/ExoPlayer/issues/9800)). * Handle when RTSP track timing is not available ([#9775](https://github.com/google/ExoPlayer/issues/9775)). + * Ignores invalid RTP-Info header values + ([#9619](https://github.com/google/ExoPlayer/issues/9619)). * Cast extension * Fix bug that prevented `CastPlayer` from calling `onIsPlayingChanged` correctly ([#9792](https://github.com/google/ExoPlayer/issues/9792)). diff --git a/library/rtsp/src/main/java/com/google/android/exoplayer2/source/rtsp/RtspClient.java b/library/rtsp/src/main/java/com/google/android/exoplayer2/source/rtsp/RtspClient.java index 5fd4823b95..5b30d5a039 100644 --- a/library/rtsp/src/main/java/com/google/android/exoplayer2/source/rtsp/RtspClient.java +++ b/library/rtsp/src/main/java/com/google/android/exoplayer2/source/rtsp/RtspClient.java @@ -619,11 +619,18 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull; startTimingString == null ? RtspSessionTiming.DEFAULT : RtspSessionTiming.parseTiming(startTimingString); - @Nullable String rtpInfoString = response.headers.get(RtspHeaders.RTP_INFO); - ImmutableList trackTimingList = - rtpInfoString == null - ? ImmutableList.of() - : RtspTrackTiming.parseTrackTiming(rtpInfoString, uri); + + ImmutableList trackTimingList; + try { + @Nullable String rtpInfoString = response.headers.get(RtspHeaders.RTP_INFO); + trackTimingList = + rtpInfoString == null + ? ImmutableList.of() + : RtspTrackTiming.parseTrackTiming(rtpInfoString, uri); + } catch (ParserException e) { + trackTimingList = ImmutableList.of(); + } + onPlayResponseReceived(new RtspPlayResponse(response.status, timing, trackTimingList)); break;