Skip to content

Commit

Permalink
fix: Quantel: call clearAllWaitWithPort prior to sending any play com…
Browse files Browse the repository at this point in the history
…mands
  • Loading branch information
nytamin committed Sep 30, 2024
1 parent 5c35956 commit 0e88e9e
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
24 changes: 24 additions & 0 deletions packages/timeline-state-resolver/src/integrations/quantel/diff.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,30 @@ export function diffStates(
if (a.command.type !== QuantelCommandType.RELEASEPORT && b.command.type === QuantelCommandType.RELEASEPORT) return 1
return 0
})

const portIdsToClear: Set<string> = new Set()
for (const cmd of allCommands) {
if (
(cmd.command.type === QuantelCommandType.PLAYCLIP || cmd.command.type === QuantelCommandType.PAUSECLIP) &&
!cmd.command.fromLookahead
) {
// We should clear any delayed out-transitions for this port
portIdsToClear.add(cmd.command.portId)
}
}

for (const portId of portIdsToClear.values()) {
allCommands.unshift({
command: {
type: QuantelCommandType.CANCELWAITING,
portId: portId,
timelineObjId: '',
},
timelineObjId: '',
context: 'Clear all delayed out-transitions',
})
}

return allCommands
}
interface LookaheadPreloadClip {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,8 @@ export class QuantelDevice extends Device<QuantelOptions, QuantelState, QuantelC
await this._quantelManager.pauseClip(command)
} else if (command.type === QuantelCommandType.CLEARCLIP) {
await this._quantelManager.clearClip(command)
} else if (command.type === QuantelCommandType.CANCELWAITING) {
this._quantelManager.clearAllWaitWithPort(command.portId)
} else {
throw new Error(`Unsupported command type "${cmdType}"`)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ export enum QuantelCommandType {
PAUSECLIP = 'pauseClip',
CLEARCLIP = 'clearClip',
RELEASEPORT = 'releasePort',

CANCELWAITING = 'cancelWaiting',
}
export interface QuantelCommandSetupPort extends QuantelCommandBase {
type: QuantelCommandType.SETUPPORT
Expand Down Expand Up @@ -84,6 +86,9 @@ export interface QuantelCommandClearClip extends QuantelCommandBase {
export interface QuantelCommandReleasePort extends QuantelCommandBase {
type: QuantelCommandType.RELEASEPORT
}
export interface QuantelCommandCancelWaiting extends QuantelCommandBase {
type: QuantelCommandType.CANCELWAITING
}

export type QuantelCommand =
| QuantelCommandSetupPort
Expand All @@ -92,6 +97,7 @@ export type QuantelCommand =
| QuantelCommandPauseClip
| QuantelCommandClearClip
| QuantelCommandReleasePort
| QuantelCommandCancelWaiting

/** Tracked state of an ISA-Zone-Server entity */
export interface QuantelTrackedState {
Expand Down

0 comments on commit 0e88e9e

Please sign in to comment.