From 02db70bdd0edce135a925477f2eda065142abf5a Mon Sep 17 00:00:00 2001 From: claincly Date: Mon, 28 Jun 2021 14:45:58 +0100 Subject: [PATCH] Amend RTSP dev guide to match the current code status. PiperOrigin-RevId: 381852972 --- .../_page_fragments/supported-formats-rtsp.md | 13 ++++++---- docs/rtsp.md | 25 ++++++++++++++++++- 2 files changed, 32 insertions(+), 6 deletions(-) diff --git a/docs/_page_fragments/supported-formats-rtsp.md b/docs/_page_fragments/supported-formats-rtsp.md index c87dd690ff..93deb9ce82 100644 --- a/docs/_page_fragments/supported-formats-rtsp.md +++ b/docs/_page_fragments/supported-formats-rtsp.md @@ -2,10 +2,13 @@ ExoPlayer supports both live and on demand RTSP. Supported formats and network types are listed below. **Supported formats** -* H264 -* AAC (with ADTS bitstream) -* AC3 +* H264. The SDP media description must include SPS/PPS data in the fmtp + attribute for decoder initialization. +* AAC (with ADTS bitstream). +* AC3. **Supported network types** -* RTP over UDP unicast (multicast is not supported) -* Interleaved RTSP, RTP over RTSP using TCP +* RTP over UDP unicast (multicast is not supported). +* Interleaved RTSP, RTP over RTSP using TCP. + +> Playback of RTP streams is not supported. diff --git a/docs/rtsp.md b/docs/rtsp.md index 17c11048d0..dab6c9cb51 100644 --- a/docs/rtsp.md +++ b/docs/rtsp.md @@ -26,6 +26,13 @@ player.prepare(); {: .language-java} +### Play authentication-enabled RTSP content ### + +ExoPlayer supports playback with RTSP BASIC and DIGEST authentication. To play +protected RTSP content, the `MediaItem`'s URI must be configured with the +authtication info. Specifically, the URI should follow the format +`rtsp://:@`. + ## Using RtspMediaSource ## For more customization options, you can create an `RtspMediaSource` and pass it @@ -45,7 +52,7 @@ player.prepare(); ~~~ {: .language-java} -## Using RTSP behind a NAT ## +## Using RTSP behind a NAT (RTP/TCP support) ## ExoPlayer uses UDP as the default protocol for RTP transport. @@ -55,3 +62,19 @@ necessary UDP port mapping. If ExoPlayer detects there have not been incoming RTP packets for a while and the playback has not started yet, ExoPlayer tears down the current RTSP playback session, and retries playback using RTP-over-RTSP (transmitting RTP packets using the TCP connection opened for RTSP). + +The timeout for retrying with TCP can be customized by calling the method +`RtspMediaSource.Factory.setTimeoutMs()`. For example, if the timeout is set to +four seconds, the player will retry with TCP after four seconds of UDP +inactivity. + +> Setting the timeout also affects the end-of-stream detection logic. That is, +ExoPlayer will report the playback has ended if nothing is received for the +duration of the set timeout. Setting this value too small may lead to pre-mature +stream ending under poor network conditions. + +### Force using RTP/TCP ### +ExoPlayer can also be configured to play with RTP/TCP by default. To do so, +use method `RtspMediaSource.Factory.setForceUseRtpTcp()`. + +