rebroadcast: reduce inactivity timeout to 10 seconds. watch for invalid server_port values in rtsp session.

This commit is contained in:
Koushik Dutta
2023-02-02 20:06:44 -08:00
parent 09eafbd936
commit 8cc8fbfd54
2 changed files with 7 additions and 4 deletions

View File

@@ -929,7 +929,7 @@ class PrebufferSession {
}
this.console.log(this.streamName, 'terminating rebroadcast due to inactivity');
session.kill(new Error('stream inactivity'));
}, 30000);
}, 10000);
}
async handleRebroadcasterClient(options: {

View File

@@ -127,9 +127,12 @@ export async function startRtspSession(console: Console, url: string, mediaStrea
const transport = setupResult.headers['transport'];
const match = transport.match(/.*?server_port=([0-9]+)-([0-9]+)/);
const [_, rtp, rtcp] = match;
const { hostname } = new URL(rtspClient.url);
udp.send(punch, parseInt(rtp), hostname)
const rtpPort = parseInt(rtp);
// have seen some servers return a server_port 0. should watch for bad data in any case.
if (rtpPort) {
const { hostname } = new URL(rtspClient.url);
udp.send(punch, rtpPort, hostname)
}
mapping[channel] = codec;
}
else {