rebroadcast: fix various bugs related to rtsp mode and soft mute

This commit is contained in:
Koushik Dutta
2022-03-05 09:47:06 -08:00
parent 63b5b7d489
commit ba64a6407e
5 changed files with 19 additions and 11 deletions

View File

@@ -1,12 +1,12 @@
{
"name": "@scrypted/prebuffer-mixin",
"version": "0.1.175",
"version": "0.1.176",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "@scrypted/prebuffer-mixin",
"version": "0.1.175",
"version": "0.1.176",
"license": "Apache-2.0",
"dependencies": {
"@scrypted/common": "file:../../common",

View File

@@ -1,6 +1,6 @@
{
"name": "@scrypted/prebuffer-mixin",
"version": "0.1.175",
"version": "0.1.176",
"description": "Rebroadcast and Prebuffer for VideoCameras.",
"author": "Scrypted",
"license": "Apache-2.0",

View File

@@ -403,7 +403,13 @@ class PrebufferSession {
});
}
else {
const parser = createRtspParser();
const parser = createRtspParser({
vcodec,
// the rtsp parser should always stream copy unless audio is soft muted.
acodec: audioSoftMuted
? ['-an']
: ['-acodec', 'copy'],
});
this.sdp = parser.sdp;
rbo.parsers.rtsp = parser;
}
@@ -453,7 +459,8 @@ class PrebufferSession {
this.sdp = Promise.resolve(sdp);
const { audio, video } = parseTrackIds(sdp);
// handle no audio?
await rtspClient.setup(0, audio);
if (!audioSoftMuted)
await rtspClient.setup(0, audio);
await rtspClient.setup(2, video);
const socket = await rtspClient.play();
session = await startRFC4571Parser(this.console, socket, sdp, ffmpegInput.mediaStreamOptions, true, rbo);

View File

@@ -98,8 +98,9 @@ export async function startRFC4571Parser(console: Console, socket: net.Socket, s
})()
.finally(kill);
let inputAudioCodec = mediaStreamOptions.audio.codec;
let inputVideoCodec = mediaStreamOptions.video.codec;
let inputAudioCodec: string;
let inputVideoCodec: string;
// todo: multiple codecs may be offered, default is the first one in the sdp.
const audio = findTrack(sdp, 'audio');
const video = findTrack(sdp, 'video');
if (audio) {