Relax session timing requirement.

Some RTSP servers do not include the RANGE attribute for live contents.

#minor-release

PiperOrigin-RevId: 370662587
This commit is contained in:
claincly 2021-04-27 14:03:23 +01:00 committed by bachinger
parent bf04bb5bc0
commit 13a34b8b4a
2 changed files with 6 additions and 3 deletions

View File

@ -443,12 +443,15 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
}
public void onDescribeResponseReceived(RtspDescribeResponse response) {
@Nullable
String sessionRangeAttributeString =
checkNotNull(response.sessionDescription.attributes.get(SessionDescription.ATTR_RANGE));
response.sessionDescription.attributes.get(SessionDescription.ATTR_RANGE);
try {
sessionInfoListener.onSessionTimelineUpdated(
RtspSessionTiming.parseTiming(sessionRangeAttributeString),
sessionRangeAttributeString != null
? RtspSessionTiming.parseTiming(sessionRangeAttributeString)
: RtspSessionTiming.DEFAULT,
buildTrackList(response.sessionDescription, uri));
hasUpdatedTimelineAndTracks = true;
} catch (ParserException e) {

View File

@ -31,7 +31,7 @@ import java.util.regex.Pattern;
* <p>Currently only NPT is supported. See RFC2326 Section 3.6 for detail of NPT.
*/
public final class RtspSessionTiming {
/** The default session timing starting from 0.000 and indefinite length. */
/** The default session timing starting from 0.000 and indefinite length, effectively live. */
public static final RtspSessionTiming DEFAULT =
new RtspSessionTiming(/* startTimeMs= */ 0, /* stopTimeMs= */ C.TIME_UNSET);