Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions RELEASENOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@
* DASH extension:
* Smooth Streaming extension:
* RTSP extension:
* Fix `ParserException` (`Malformed SDP line: s=`) when the session
description has `s= ` (a single space) as the session name, which some
servers such as MediaMTX send for streams without a name.
* Decoder extensions (FFmpeg, VP9, AV1, etc.):
* AV1 extension: Fix a native memory leak of one decoded frame each time
`Libdav1dVideoRenderer` releases its decoder in surface output mode.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,24 @@ public void parse_sdpStringWithTrailingWhitespace_succeeds() throws Exception {
assertThat(sessionDescription.mediaDescriptionList.get(0).mediaTitle).isNull();
}

@Test
public void parse_sdpStringWithSingleSpaceSessionName_succeeds() throws Exception {
String testMediaSdpInfo =
"v=0\r\n"
+ "o=- 0 0 IN IP4 127.0.0.1\r\n"
+ "s= \r\n"
+ "c=IN IP4 0.0.0.0\r\n"
+ "t=0 0\r\n"
+ "m=video 0 RTP/AVP 96\r\n"
+ "a=control:trackID=0\r\n"
+ "a=rtpmap:96 H264/90000\r\n";

SessionDescription sessionDescription = SessionDescriptionParser.parse(testMediaSdpInfo);

assertThat(sessionDescription.sessionName).isEqualTo(" ");
assertThat(sessionDescription.mediaDescriptionList).hasSize(1);
}

@Test
public void parse_sdpStringWithEmptySessionAttribute_throwsParserException() {
String testMediaSdpInfo =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ public static SessionDescription parse(String sdpString) throws ParserException
boolean isSkippingMediaDescription = false;

// Lines are separated by an CRLF.
for (String line : RtspMessageUtil.splitRtspMessageBody(sdpString)) {
line = line.trim();
for (String untrimmedLine : RtspMessageUtil.splitRtspMessageBody(sdpString)) {
String line = untrimmedLine.trim();

if (line.isEmpty()) {
continue;
Expand All @@ -96,6 +96,11 @@ public static SessionDescription parse(String sdpString) throws ParserException
// Allow and skip empty Session Information (tag 'i') attributes
continue;
}
if (line.equals("s=") && untrimmedLine.startsWith("s= ")) {
// RFC 4566 section 5.3 recommends "s= " (a single space) for a session with no name
sessionDescriptionBuilder.setSessionName(" ");
continue;
}
throw ParserException.createForMalformedManifest(
"Malformed SDP line: " + line, /* cause= */ null);
}
Expand Down