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 @@ public static String toMethodString(@RtspRequest.Method int method) { case "TEARDOWN": return METHOD_TEARDOWN; default: - throw new IllegalArgumentException(); + // Return METHOD_UNSET for unknown Rtsp Request method. + return METHOD_UNSET; } } @@ -388,7 +389,10 @@ public static ImmutableList parsePublicHeader(@Nullable String publicHe 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(); }