diff --git a/plugins/prebuffer-mixin/package-lock.json b/plugins/prebuffer-mixin/package-lock.json index 4a6d63db3..e3919b402 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.1.259", + "version": "0.1.262", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@scrypted/prebuffer-mixin", - "version": "0.1.259", + "version": "0.1.262", "license": "Apache-2.0", "dependencies": { "@scrypted/common": "file:../../common", diff --git a/plugins/prebuffer-mixin/package.json b/plugins/prebuffer-mixin/package.json index 4cdf462b0..506e0b37b 100644 --- a/plugins/prebuffer-mixin/package.json +++ b/plugins/prebuffer-mixin/package.json @@ -1,6 +1,6 @@ { "name": "@scrypted/prebuffer-mixin", - "version": "0.1.259", + "version": "0.1.262", "description": "Rebroadcast and Prebuffer for VideoCameras.", "author": "Scrypted", "license": "Apache-2.0", diff --git a/plugins/prebuffer-mixin/src/main.ts b/plugins/prebuffer-mixin/src/main.ts index f4b63dc37..50e27974e 100644 --- a/plugins/prebuffer-mixin/src/main.ts +++ b/plugins/prebuffer-mixin/src/main.ts @@ -664,6 +664,7 @@ class PrebufferSession { // an erroneous cached codec could cause ffmpeg to fail to start. this.storage.removeItem(this.lastDetectedAudioCodecKey); let usingScryptedParser = false; + let restartOnSei = false; if (rtspMode && isRfc4571) { usingScryptedParser = true; @@ -681,10 +682,20 @@ class PrebufferSession { let { parser, isDefault } = this.getParser(rtspMode, sessionMso); usingScryptedParser = parser === SCRYPTED_PARSER_TCP || parser === SCRYPTED_PARSER_UDP; - if (isDefault && (parser === SCRYPTED_PARSER_TCP || parser === SCRYPTED_PARSER_UDP) && this.getLastH264Probe().seiDetected) { - this.console.warn('SEI packet detected was in video stream, the Default Scrypted RTSP Parser will not be used. Falling back to FFmpeg. This can be overriden by setting the RTSP Parser to Scrypted.'); - usingScryptedParser = false; - parser = FFMPEG_PARSER_TCP; + + // if the stream is not marked as scrypted parser compatible by the plugin, + // play it safe and restart the stream when an sei packet is detected. + restartOnSei = usingScryptedParser && isDefault && sessionMso.tool !== 'scrypted'; + + if (isDefault && usingScryptedParser && this.getLastH264Probe().seiDetected) { + if (sessionMso.tool === 'scrypted') { + this.console.warn('SEI packet detected was in video stream, but stream is marked safe by Scrypted. The Default Scrypted RTSP Parser will be used. This can be overriden by setting the RTSP Parser to Scrypted.'); + } + else { + this.console.warn('SEI packet detected was in video stream, the Default Scrypted RTSP Parser will not be used. Falling back to FFmpeg. This can be overriden by setting the RTSP Parser to Scrypted.'); + usingScryptedParser = false; + parser = FFMPEG_PARSER_TCP; + } } if (usingScryptedParser) { @@ -725,7 +736,7 @@ class PrebufferSession { return; let { isDefault } = this.getParser(rtspMode, sessionMso); - if (!isDefault) { + if (!isDefault || sessionMso.tool === 'scrypted') { this.console.warn('SEI packet detected while operating with Scrypted Parser. If there are issues streaming, consider using the Default parser.'); return; }