Skip to content

Commit 7bde5e1

Browse files
committed
Fix flickers when disabling censor mode
1 parent 6051d99 commit 7bde5e1

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

index.js

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -151,16 +151,16 @@ const pipelineMachine = Machine(
151151

152152
const pipeline = new gstreamer.Pipeline(`
153153
srtsrc name=src uri=${srtInUri} ! ${delayQueue} ! tsdemux name=demux
154-
demux. ! queue ! video/x-h264 ! h264parse ! video/x-h264 ! avdec_h264 ! output-selector name=vsel
155-
vsel. ! queue ! vf.
156-
vsel. ! queue
154+
demux. ! queue ! video/x-h264 ! h264parse ! video/x-h264 ! avdec_h264 ! output-selector name=osel
155+
osel. ! queue ! isel.
156+
osel. ! queue
157157
! videoscale
158158
! video/x-raw,width=${pixelizedWidth},height=${pixelizedHeight}
159159
! videoscale method=nearest-neighbour ! video/x-raw,width=${width},height=${height}
160160
! gdkpixbufoverlay location=${gstEscape(overlayImg)}
161-
! videoconvert
162-
! vf.
163-
funnel name=vf ! x264enc bitrate=${x264Bitrate} tune=zerolatency speed-preset=${x264Preset} byte-stream=true threads=0 key-int-max=60 ! queue ! mux.
161+
! queue
162+
! isel.
163+
input-selector name=isel ! queue ! x264enc bitrate=${x264Bitrate} tune=zerolatency speed-preset=${x264Preset} byte-stream=true threads=0 key-int-max=60 ! queue ! mux.
164164
demux. ! queue ! aacparse ! decodebin ! audioconvert ! volume name=vol volume=0 ! audioconvert ! voaacenc bitrate=96000 ! aacparse ! queue ! mux.
165165
${outStream}
166166
`)
@@ -178,10 +178,12 @@ const pipelineMachine = Machine(
178178

179179
onReceive((ev) => {
180180
if (ev.type === 'NORMAL') {
181-
pipeline.setPad('vsel', 'active-pad', 'src_0')
181+
pipeline.setPad('osel', 'active-pad', 'src_0')
182+
pipeline.setPad('isel', 'active-pad', 'sink_0')
182183
pipeline.findChild('vol').volume = 1
183184
} else if (ev.type === 'CENSOR') {
184-
pipeline.setPad('vsel', 'active-pad', 'src_1')
185+
pipeline.setPad('osel', 'active-pad', 'src_1')
186+
pipeline.setPad('isel', 'active-pad', 'sink_1')
185187
pipeline.findChild('vol').volume = 0
186188
} else {
187189
console.warn('unexpected event:', ev)

0 commit comments

Comments
 (0)