mirror of
https://github.com/koush/scrypted.git
synced 2026-05-11 16:10:32 +01:00
rebroadcast: publish
This commit is contained in:
4
plugins/prebuffer-mixin/package-lock.json
generated
4
plugins/prebuffer-mixin/package-lock.json
generated
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
12
plugins/prebuffer-mixin/src/normalize-codec.ts
Normal file
12
plugins/prebuffer-mixin/src/normalize-codec.ts
Normal 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;
|
||||
}
|
||||
@@ -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 => {
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user