Skip to content

Commit

Permalink
Allow custom methods in Rtsp Options response public header
Browse files Browse the repository at this point in the history
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
  • Loading branch information
microkatz authored and Copybara-Service committed Sep 25, 2023
1 parent 8dfb40e commit a096a0f
Showing 1 changed file with 6 additions and 2 deletions.
Expand Up @@ -291,7 +291,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;
}
}

Expand Down Expand Up @@ -394,7 +395,10 @@ public static ImmutableList<Integer> parsePublicHeader(@Nullable String publicHe

ImmutableList.Builder<Integer> 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();
}
Expand Down

0 comments on commit a096a0f

Please sign in to comment.