Support colon (:) in RTSP timing.
Some RTSP servers use `npt`: notation rather than `npt=` PiperOrigin-RevId: 439333319
This commit is contained in:
parent
5b258ef8ab
commit
e780a32de4
@ -38,8 +38,9 @@ import java.util.regex.Pattern;
|
||||
new RtspSessionTiming(/* startTimeMs= */ 0, /* stopTimeMs= */ C.TIME_UNSET);
|
||||
|
||||
// We only support npt=xxx-[xxx], but not npt=-xxx. See RFC2326 Section 3.6.
|
||||
// Supports both npt= and npt: identifier.
|
||||
private static final Pattern NPT_RANGE_PATTERN =
|
||||
Pattern.compile("npt=([.\\d]+|now)\\s?-\\s?([.\\d]+)?");
|
||||
Pattern.compile("npt[:=]([.\\d]+|now)\\s?-\\s?([.\\d]+)?");
|
||||
private static final String START_TIMING_NTP_FORMAT = "npt=%.3f-";
|
||||
|
||||
private static final long LIVE_START_TIME = 0;
|
||||
|
@ -54,6 +54,13 @@ public class RtspSessionTimingTest {
|
||||
assertThat(sessionTiming.isLive()).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void parseTiming_withRangeTimingAndColonSeparator() throws Exception {
|
||||
RtspSessionTiming sessionTiming = RtspSessionTiming.parseTiming("npt:0.000-32.054");
|
||||
assertThat(sessionTiming.getDurationMs()).isEqualTo(32054);
|
||||
assertThat(sessionTiming.isLive()).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void parseTiming_withInvalidRangeTiming_throwsIllegalArgumentException() {
|
||||
assertThrows(
|
||||
|
Loading…
x
Reference in New Issue
Block a user