From b43a002650ae68ab6eda6fc0ab72065d06d29080 Mon Sep 17 00:00:00 2001 From: Koushik Dutta Date: Sun, 11 Aug 2024 11:40:07 -0700 Subject: [PATCH] rebroadcast: fix content base handling when it is a relative path --- common/src/rtsp-server.ts | 5 ++++- plugins/prebuffer-mixin/package-lock.json | 4 ++-- plugins/prebuffer-mixin/package.json | 2 +- plugins/prebuffer-mixin/src/rtsp-session.ts | 4 +--- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/common/src/rtsp-server.ts b/common/src/rtsp-server.ts index 5f7cc02a4..0f64e4f66 100644 --- a/common/src/rtsp-server.ts +++ b/common/src/rtsp-server.ts @@ -726,7 +726,10 @@ export class RtspClient extends RtspBase { Accept: 'application/sdp', }); - this.contentBase = response.headers['content-base'] || response.headers['content-location'];; + this.contentBase = response.headers['content-base'] || response.headers['content-location']; + // content base may be a relative path? seems odd. + if (this.contentBase) + this.contentBase = new URL(this.contentBase, this.url).toString(); return response; } diff --git a/plugins/prebuffer-mixin/package-lock.json b/plugins/prebuffer-mixin/package-lock.json index d04914c9d..a694c8a5e 100644 --- a/plugins/prebuffer-mixin/package-lock.json +++ b/plugins/prebuffer-mixin/package-lock.json @@ -1,12 +1,12 @@ { "name": "@scrypted/prebuffer-mixin", - "version": "0.10.33", + "version": "0.10.34", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@scrypted/prebuffer-mixin", - "version": "0.10.33", + "version": "0.10.34", "license": "Apache-2.0", "dependencies": { "@scrypted/common": "file:../../common", diff --git a/plugins/prebuffer-mixin/package.json b/plugins/prebuffer-mixin/package.json index be8e365e3..eff88e2cc 100644 --- a/plugins/prebuffer-mixin/package.json +++ b/plugins/prebuffer-mixin/package.json @@ -1,6 +1,6 @@ { "name": "@scrypted/prebuffer-mixin", - "version": "0.10.33", + "version": "0.10.34", "description": "Video Stream Rebroadcast, Prebuffer, and Management Plugin for Scrypted.", "author": "Scrypted", "license": "Apache-2.0", diff --git a/plugins/prebuffer-mixin/src/rtsp-session.ts b/plugins/prebuffer-mixin/src/rtsp-session.ts index a0a3a89ab..2b7b79bec 100644 --- a/plugins/prebuffer-mixin/src/rtsp-session.ts +++ b/plugins/prebuffer-mixin/src/rtsp-session.ts @@ -1,14 +1,12 @@ import { closeQuiet } from "@scrypted/common/src/listen-cluster"; -import { H264_NAL_TYPE_SPS, RTSP_FRAME_MAGIC, RtspClient, RtspClientUdpSetupOptions, findH264NaluType, parseSemicolonDelimited } from "@scrypted/common/src/rtsp-server"; +import { RTSP_FRAME_MAGIC, RtspClient, RtspClientUdpSetupOptions, parseSemicolonDelimited } from "@scrypted/common/src/rtsp-server"; import { parseSdp } from "@scrypted/common/src/sdp-utils"; import { StreamChunk } from "@scrypted/common/src/stream-parser"; import { ResponseMediaStreamOptions } from "@scrypted/sdk"; import dgram from 'dgram'; -import { parse as spsParse } from "h264-sps-parser"; import { EventEmitter } from "stream"; import { ParserSession, setupActivityTimer } from "./ffmpeg-rebroadcast"; import { negotiateMediaStream } from "./rfc4571"; -import { getSpsResolution } from "./sps-resolution"; export type RtspChannelCodecMapping = { [key: number]: string };