From 916b4b0ad7f9635012571f2529e99b4e2a1da0ab Mon Sep 17 00:00:00 2001 From: michaelkatz Date: Mon, 25 Sep 2023 02:13:05 -0700 Subject: [PATCH] Allow custom methods in Rtsp Options response public header ExoPlayer will not fail playback if an RTSP server responds to the Options request with an unknown RTSP method request type. ExoPlayer will parse the response and just not call methods it does not know how to use. Issue: androidx/media#613 PiperOrigin-RevId: 568152076 --- RELEASENOTES.md | 2 ++ .../androidx/media3/exoplayer/rtsp/RtspMessageUtil.java | 8 ++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/RELEASENOTES.md b/RELEASENOTES.md index 4ec0650b4a..95cef53cd9 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -83,6 +83,8 @@ * Check state in RTSP setup when returning loading state of `RtspMediaPeriod` ([#577](https://github.com/androidx/media/issues/577)). + * Ignore custom Rtsp request methods in Options response public header + ([#613](https://github.com/androidx/media/issues/613)). * Decoder Extensions (FFmpeg, VP9, AV1, etc.): * MIDI extension: * Leanback extension: diff --git a/libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/RtspMessageUtil.java b/libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/RtspMessageUtil.java index ebdb61e91e..5942c824f7 100644 --- a/libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/RtspMessageUtil.java +++ b/libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/RtspMessageUtil.java @@ -285,7 +285,8 @@ import java.util.regex.Pattern; case "TEARDOWN": return METHOD_TEARDOWN; default: - throw new IllegalArgumentException(); + // Return METHOD_UNSET for unknown Rtsp Request method. + return METHOD_UNSET; } } @@ -388,7 +389,10 @@ import java.util.regex.Pattern; ImmutableList.Builder methodListBuilder = new ImmutableList.Builder<>(); for (String method : Util.split(publicHeader, ",\\s?")) { - methodListBuilder.add(parseMethodString(method)); + @RtspRequest.Method int rtspRequestMethod = parseMethodString(method); + if (rtspRequestMethod != METHOD_UNSET) { + methodListBuilder.add(rtspRequestMethod); + } } return methodListBuilder.build(); }