Skip to content

Commit

Permalink
python-codecs: fix zygote pop usage. implement firstFrameOnly pipelin…
Browse files Browse the repository at this point in the history
…e blocking.
  • Loading branch information
koush committed Jul 28, 2023
1 parent 02238f9 commit 220c010
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
12 changes: 8 additions & 4 deletions plugins/python-codecs/src/gstreamer.py
Original file line number Diff line number Diff line change
Expand Up @@ -366,16 +366,20 @@ def setDecoderClearDefault(value: str):
if fps:
videorate = f"! videorate max-rate={fps}"

queue = "! queue leaky=downstream max-size-buffers=0"
if options and options.get('firstFrameOnly'):
queue = ""

if postProcessPipeline == "VAAPI":
pipeline += (
f" ! {decoder} {videorate} ! queue leaky=downstream max-size-buffers=0"
f" ! {decoder} {videorate} {queue}"
)
elif postProcessPipeline == "OpenGL (GPU memory)":
pipeline += f" ! {decoder} {videorate} ! queue leaky=downstream max-size-buffers=0 ! glupload"
pipeline += f" ! {decoder} {videorate} {queue} ! glupload"
elif postProcessPipeline == "OpenGL (system memory)":
pipeline += f" ! {decoder} {videorate} ! queue leaky=downstream max-size-buffers=0 ! video/x-raw ! glupload"
pipeline += f" ! {decoder} {videorate} {queue} ! video/x-raw ! glupload"
else:
pipeline += f" ! {decoder} ! video/x-raw {videorate} ! queue leaky=downstream max-size-buffers=0"
pipeline += f" ! {decoder} ! video/x-raw {videorate} {queue}"
# disable the gstreamer post process because videocrop spams the log
postProcessPipeline = "Default"
# postProcessPipeline = None
Expand Down
2 changes: 1 addition & 1 deletion plugins/python-codecs/src/zygote.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def createZygote():

def next():
while True:
cur = queue.pop()
cur = queue.pop(0)
queue.append(scrypted_sdk.fork())
yield cur

Expand Down

0 comments on commit 220c010

Please sign in to comment.