Skip to content

Commit c55d77c

Browse files
committed
Add support for input gone
1 parent 6ee3123 commit c55d77c

File tree

2 files changed

+26
-3
lines changed

2 files changed

+26
-3
lines changed

src/av/components/framing.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,11 @@ export class AVDeFramer extends BasicDeframer {
324324
this.reset()
325325

326326
this.inspectframe = null
327+
this.goneCallback = undefined
328+
}
329+
330+
setGoneCallback(cb) {
331+
this.goneCallback = cb
327332
}
328333

329334
setFrameInspector(inspector) {
@@ -434,8 +439,14 @@ export class AVDeFramer extends BasicDeframer {
434439
this.pendingDecoderConfig = obj.data
435440
this.decoderConfig = obj.data
436441
break
442+
case 'gone':
443+
console.log('AVDeFramer gone received')
444+
if (this.goneCallback) {
445+
this.goneCallback()
446+
}
447+
break
437448
default:
438-
throw new Error('Unknown bson task')
449+
console.log('AVDeFramer Unknown bson task', obj.task, obj)
439450
}
440451
}
441452

src/av/worker/processors.js

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1105,9 +1105,11 @@ export class AVOutputProcessor extends AVProcessor {
11051105
super(args)
11061106

11071107
this.qualityInspect = this.qualityInspect.bind(this)
1108+
this.inputGone = this.inputGone.bind(this)
11081109

11091110
this.deframer = new AVDeFramer(/* { type: 'video' } */)
11101111
this.deframer.setFrameInspector(this.qualityInspect)
1112+
this.deframer.setGoneCallback(this.inputGone)
11111113
this.inputctrlframer = new BsonFramer()
11121114
this.streamSrc = null
11131115
this.streamSrcRes = null
@@ -1371,9 +1373,19 @@ export class AVOutputProcessor extends AVProcessor {
13711373
}
13721374
}
13731375

1374-
async setSrcId(id) {
1376+
inputGone() {
1377+
console.log(
1378+
'Input gone, simulate a setSrcId to trigger new ticketing',
1379+
this.srcid
1380+
)
1381+
this.setSrcId(this.srcid, true).catch((error) => {
1382+
console.log('inputGone setSrcId problem', error)
1383+
})
1384+
}
1385+
1386+
async setSrcId(id, forceChange) {
13751387
// dest is our id
1376-
const changed = this.srcid !== id
1388+
const changed = this.srcid !== id || !!forceChange
13771389
this.srcid = id
13781390
console.log('srcId', id, this.datatype, changed)
13791391
if (changed) {

0 commit comments

Comments
 (0)