From 301213fc5fa43ad72e6f7b9070c9e4f7efe461b9 Mon Sep 17 00:00:00 2001 From: Koushik Dutta Date: Mon, 31 Mar 2025 11:07:28 -0700 Subject: [PATCH] rebroadcast: remove dead code --- plugins/prebuffer-mixin/package-lock.json | 4 +-- plugins/prebuffer-mixin/package.json | 2 +- plugins/prebuffer-mixin/src/main.ts | 40 +++-------------------- 3 files changed, 7 insertions(+), 39 deletions(-) diff --git a/plugins/prebuffer-mixin/package-lock.json b/plugins/prebuffer-mixin/package-lock.json index acf7e19b5..37b5eba52 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.52", + "version": "0.10.53", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@scrypted/prebuffer-mixin", - "version": "0.10.52", + "version": "0.10.53", "license": "Apache-2.0", "dependencies": { "@scrypted/common": "file:../../common", diff --git a/plugins/prebuffer-mixin/package.json b/plugins/prebuffer-mixin/package.json index 806564584..a61685198 100644 --- a/plugins/prebuffer-mixin/package.json +++ b/plugins/prebuffer-mixin/package.json @@ -1,6 +1,6 @@ { "name": "@scrypted/prebuffer-mixin", - "version": "0.10.52", + "version": "0.10.53", "description": "Video Stream Rebroadcast, Prebuffer, and Management Plugin for Scrypted.", "author": "Scrypted", "license": "Apache-2.0", diff --git a/plugins/prebuffer-mixin/src/main.ts b/plugins/prebuffer-mixin/src/main.ts index f6a6a8db6..234e155e1 100644 --- a/plugins/prebuffer-mixin/src/main.ts +++ b/plugins/prebuffer-mixin/src/main.ts @@ -1183,7 +1183,7 @@ class PrebufferMixin extends SettingsMixinDeviceBase implements Vid settingsListener: EventListenerRegister; videoCameraListener: EventListenerRegister; - constructor(public getTranscodeStorageSettings: () => Promise, options: SettingsMixinDeviceOptions) { + constructor(options: SettingsMixinDeviceOptions) { super(options); const rebroadcast = systemManager.getDeviceById('@scrypted/prebuffer-mixin').id; @@ -1324,8 +1324,6 @@ class PrebufferMixin extends SettingsMixinDeviceBase implements Vid let id = options?.id; if (!this.sessions.has(id)) id = undefined; - let h264EncoderArguments: string[]; - let destinationVideoBitrate: number; const msos = await this.mixinDevice.getVideoStreamOptions(); let result: { @@ -1334,31 +1332,23 @@ class PrebufferMixin extends SettingsMixinDeviceBase implements Vid title: string; }; - const transcodeStorageSettings = await this.getTranscodeStorageSettings(); - const defaultLocalBitrate = 2000000; - const defaultLowResolutionBitrate = 512000; if (!id) { switch (options?.destination) { case 'medium-resolution': case 'remote': result = this.streamSettings.getRemoteStream(msos); - destinationVideoBitrate = transcodeStorageSettings.remoteStreamingBitrate; break; case 'low-resolution': result = this.streamSettings.getLowResolutionStream(msos); - destinationVideoBitrate = defaultLowResolutionBitrate; break; case 'local-recorder': result = this.streamSettings.getRecordingStream(msos); - destinationVideoBitrate = defaultLocalBitrate; break; case 'remote-recorder': result = this.streamSettings.getRemoteRecordingStream(msos); - destinationVideoBitrate = defaultLocalBitrate; break; case 'local': result = this.streamSettings.getDefaultStream(msos); - destinationVideoBitrate = defaultLocalBitrate; break; default: const width = options?.video?.width; @@ -1367,20 +1357,16 @@ class PrebufferMixin extends SettingsMixinDeviceBase implements Vid if (max) { if (max > 1280) { result = this.streamSettings.getDefaultStream(msos); - destinationVideoBitrate = defaultLocalBitrate; } else if (max > 720) { result = this.streamSettings.getRemoteStream(msos); - destinationVideoBitrate = transcodeStorageSettings.remoteStreamingBitrate; } else { result = this.streamSettings.getLowResolutionStream(msos); - destinationVideoBitrate = defaultLowResolutionBitrate; } } else { result = this.streamSettings.getDefaultStream(msos); - destinationVideoBitrate = defaultLocalBitrate; } break; } @@ -1395,9 +1381,6 @@ class PrebufferMixin extends SettingsMixinDeviceBase implements Vid ffmpegInput = await session.getVideoStream(true, options); - ffmpegInput.h264EncoderArguments = h264EncoderArguments; - - return mediaManager.createFFmpegMediaObject(ffmpegInput, { sourceId: this.id, }); @@ -1646,18 +1629,6 @@ export class RebroadcastPlugin extends AutoenableMixinProvider implements MixinP } }); - transcodeStorageSettings = new StorageSettings(this, { - remoteStreamingBitrate: { - group: 'Advanced', - title: 'Remote Streaming Bitrate', - type: 'number', - defaultValue: 500000, - description: 'The bitrate to use when remote streaming. This setting will only be used when transcoding or adaptive bitrate is enabled on a camera.', - onPut() { - sdk.deviceManager.onDeviceEvent('transcode', ScryptedInterface.Settings, undefined); - }, - }, - }); currentMixins = new Map { return [ ...await this.storageSettings.getSettings(), - ...await this.transcodeStorageSettings.getSettings(), ]; } putSetting(key: string, value: SettingValue): Promise { - if (this.transcodeStorageSettings.keys[key]) - return this.transcodeStorageSettings.putSetting(key, value); return this.storageSettings.putSetting(key, value); } @@ -1788,7 +1756,7 @@ export class RebroadcastPlugin extends AutoenableMixinProvider implements MixinP const forked = sdk.fork(); const { worker } = forked; const result = await forked.result; - const mixin = await result.newPrebufferMixin(async () => this.transcodeStorageSettings.values, mixinDevice, mixinDeviceInterfaces, mixinDeviceState); + const mixin = await result.newPrebufferMixin(mixinDevice, mixinDeviceInterfaces, mixinDeviceState); this.currentMixins.set(mixin, { worker, id, @@ -1805,8 +1773,8 @@ export class RebroadcastPlugin extends AutoenableMixinProvider implements MixinP } } -async function newPrebufferMixin(getTranscodeStorageSettings: () => Promise, mixinDevice: any, mixinDeviceInterfaces: ScryptedInterface[], mixinDeviceState: WritableDeviceState) { - return new PrebufferMixin(getTranscodeStorageSettings, { +async function newPrebufferMixin(mixinDevice: any, mixinDeviceInterfaces: ScryptedInterface[], mixinDeviceState: WritableDeviceState) { + return new PrebufferMixin({ mixinDevice, mixinDeviceState, mixinProviderNativeId: undefined,