Skip to content
Closed
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
8 changes: 5 additions & 3 deletions src/model/codec-info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,11 @@ export class CodecInfo implements SdpBlock {
toLines(): Array<Line> {
const lines = [];
// First the RtpMap
lines.push(
new RtpMapLine(this.pt, this.name as string, this.clockRate as number, this.encodingParams)
);
if (this.name && this.clockRate) {
lines.push(
new RtpMapLine(this.pt, this.name as string, this.clockRate as number, this.encodingParams)
);
}
// Now all RtcpFb
this.feedback.forEach((fb) => {
lines.push(new RtcpFbLine(this.pt, fb));
Expand Down
9 changes: 9 additions & 0 deletions src/parser.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,4 +156,13 @@ describe('parsing', () => {
new ConnectionLine('IN', 'IP6', '2a02:c7f:60d6:2600:4157:2f9c:198b:80a3')
);
});

it('should handle media sections without any rtpmap lines', () => {
expect.hasAssertions();
const sdpWithoutRtpmapLines = fs.readFileSync('./src/sdp-corpus/without_rtpmap.sdp', 'utf-8');
const parsed = parse(sdpWithoutRtpmapLines);
const sdpAfterProcessing = parsed.toString();

compareSdps(sdpAfterProcessing, sdpWithoutRtpmapLines);
});
});
15 changes: 15 additions & 0 deletions src/sdp-corpus/without_rtpmap.sdp
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
v=0
o=BroadWorks 16647125 1678951083182 IN IP4 139.177.70.17
s=-
c=IN IP4 139.177.70.17
t=0 0
a=ice-lite
m=audio 42520 UDP/TLS/RTP/SAVPF 0
a=ice-ufrag:tuJU
a=ice-pwd:3yjQ1o6l7xjrFei8xCPx3N89
a=candidate:mse 1 UDP 2130706431 139.177.70.17 42520 typ host
a=candidate:mse 2 UDP 2130706430 139.177.70.17 42521 typ host
a=fingerprint:sha-256 2C:4C:94:3F:13:58:64:5C:57:3D:3B:88:3F:BB:D3:1D:20:1E:0F:49:D0:EA:8C:EF:EB:F6:E1:B4:21:46:8D:2A
a=setup:actpass
a=rtcp-mux
a=ssrc:2037740846 cname:Xp9fodVPUgfz1DLl