rebroadcast: publish

This commit is contained in:
Koushik Dutta
2023-05-03 12:39:50 -07:00
parent 0123a97e3c
commit debaedfd8c
5 changed files with 21 additions and 8 deletions

View File

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

View File

@@ -1,6 +1,6 @@
{
"name": "@scrypted/prebuffer-mixin",
"version": "0.9.82",
"version": "0.9.83",
"description": "Video Stream Rebroadcast, Prebuffer, and Management Plugin for Scrypted.",
"author": "Scrypted",
"license": "Apache-2.0",

View File

@@ -0,0 +1,12 @@
export function normalizeCodec(codec: string) {
codec = codec?.toLowerCase()?.replaceAll('.', '');
// todo: more codecs from sdps
switch (codec) {
case 'pcm_ulaw':
return 'pcm_mulaw';
case 'h265':
return 'hevc';
}
return codec;
}

View File

@@ -10,6 +10,7 @@ import { parse as spsParse } from "h264-sps-parser";
import net from 'net';
import { EventEmitter, Readable } from "stream";
import { getSpsResolution } from "./sps-resolution";
import { normalizeCodec } from "./normalize-codec";
export function negotiateMediaStream(sdp: string, mediaStreamOptions: MediaStreamOptions, inputVideoCodec: string, inputAudioCodec: string, requestMediaStream: MediaStreamOptions) {
const parsedSdp = parseSdp(sdp);
@@ -76,8 +77,8 @@ export function startRFC4571Parser(console: Console, socket: Readable, sdp: stri
const audioPt = audioSection?.payloadTypes?.[0];
const videoPt = videoSection?.payloadTypes?.[0];
const inputAudioCodec = audioSection?.codec;
const inputVideoCodec = videoSection.codec;
const inputAudioCodec = normalizeCodec(audioSection?.codec);
const inputVideoCodec = normalizeCodec(videoSection.codec);
let sessionKilled: any;
const killed = new Promise<void>(resolve => {

View File

@@ -9,6 +9,7 @@ import { parse as spsParse } from "h264-sps-parser";
import { EventEmitter } from "stream";
import { negotiateMediaStream } from "./rfc4571";
import { getSpsResolution } from "./sps-resolution";
import { normalizeCodec } from "./normalize-codec";
export type RtspChannelCodecMapping = { [key: number]: string };
@@ -209,9 +210,8 @@ export async function startRtspSession(console: Console, url: string, mediaStrea
if (!videoSection)
throw new Error('SDP does not contain a video section!');
const inputAudioCodec = audioSection?.codec;
const inputVideoCodec = videoSection.codec;
const inputAudioCodec = normalizeCodec(audioSection?.codec);
const inputVideoCodec = normalizeCodec(videoSection.codec);
let inputVideoResolution: {
width: number;