Skip to content

Commit

Permalink
rebroadcast: delete legacy code
Browse files Browse the repository at this point in the history
  • Loading branch information
koush committed Jun 25, 2024
1 parent 76efef3 commit 8b303e0
Showing 1 changed file with 9 additions and 38 deletions.
47 changes: 9 additions & 38 deletions plugins/prebuffer-mixin/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1765,45 +1765,16 @@ export class RebroadcastPlugin extends AutoenableMixinProvider implements MixinP
async getMixin(mixinDevice: any, mixinDeviceInterfaces: ScryptedInterface[], mixinDeviceState: WritableDeviceState) {
this.setHasEnabledMixin(mixinDeviceState.id);

// 8-11-2022
// old scrypted had a bug where mixin device state was not exposing properties like id correctly
// across rpc boundaries.
let fork = false;
try {
const info = await systemManager.getComponent('info');
const version = await info.getVersion();
fork = semver.gte(version, '0.2.5');
}
catch (e) {
}

const { id } = mixinDeviceState;

if (fork && sdk.fork && typeof mixinDeviceState.id === 'string') {
const forked = sdk.fork<RebroadcastPluginFork>();
const { worker } = forked;

try {
const result = await forked.result;
const mixin = await result.newPrebufferMixin(async () => this.transcodeStorageSettings.values, mixinDevice, mixinDeviceInterfaces, mixinDeviceState);
this.currentMixins.set(mixin, {
worker,
id,
});
return mixin;
}
catch (e) {
throw e;
}
}
else {
const ret = await newPrebufferMixin(async () => this.transcodeStorageSettings.values, mixinDevice, mixinDeviceInterfaces, mixinDeviceState);
this.currentMixins.set(ret, {
worker: undefined,
id,
});
return ret;
}
const forked = sdk.fork<RebroadcastPluginFork>();
const { worker } = forked;
const result = await forked.result;
const mixin = await result.newPrebufferMixin(async () => this.transcodeStorageSettings.values, mixinDevice, mixinDeviceInterfaces, mixinDeviceState);
this.currentMixins.set(mixin, {
worker,
id,
});
return mixin;
}

async releaseMixin(id: string, mixinDevice: PrebufferMixin) {
Expand Down

0 comments on commit 8b303e0

Please sign in to comment.