From 3bbb13c82faef48fa35ded0dbc79515cb296697b Mon Sep 17 00:00:00 2001 From: Koushik Dutta Date: Sat, 10 Dec 2022 17:40:04 -0800 Subject: [PATCH] tensorflow-lite: use vtdec_hw by default for decoding on mac --- plugins/tensorflow-lite/package-lock.json | 4 ++-- plugins/tensorflow-lite/package.json | 2 +- plugins/tensorflow-lite/src/detect/__init__.py | 8 +++++++- plugins/tensorflow-lite/src/tflite/__init__.py | 5 +++-- 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/plugins/tensorflow-lite/package-lock.json b/plugins/tensorflow-lite/package-lock.json index dc673dadb..6d68eb521 100644 --- a/plugins/tensorflow-lite/package-lock.json +++ b/plugins/tensorflow-lite/package-lock.json @@ -1,12 +1,12 @@ { "name": "@scrypted/tensorflow-lite", - "version": "0.0.66", + "version": "0.0.68", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@scrypted/tensorflow-lite", - "version": "0.0.66", + "version": "0.0.68", "hasInstallScript": true, "devDependencies": { "@scrypted/sdk": "file:../../sdk" diff --git a/plugins/tensorflow-lite/package.json b/plugins/tensorflow-lite/package.json index ab47baa6e..088a9a766 100644 --- a/plugins/tensorflow-lite/package.json +++ b/plugins/tensorflow-lite/package.json @@ -44,5 +44,5 @@ "devDependencies": { "@scrypted/sdk": "file:../../sdk" }, - "version": "0.0.66" + "version": "0.0.68" } diff --git a/plugins/tensorflow-lite/src/detect/__init__.py b/plugins/tensorflow-lite/src/detect/__init__.py index 5fb5b0a70..645258660 100644 --- a/plugins/tensorflow-lite/src/detect/__init__.py +++ b/plugins/tensorflow-lite/src/detect/__init__.py @@ -16,6 +16,7 @@ import binascii from urllib.parse import urlparse import threading from pipeline import run_pipeline +import platform from gi.repository import Gst @@ -309,7 +310,12 @@ class DetectPlugin(scrypted_sdk.ScryptedDeviceBase, ObjectDetection): videosrc = 'rtspsrc buffer-mode=0 location=%s protocols=tcp latency=0 is-live=false ! rtph264depay ! h264parse' % videosrc decoder = settings and settings.get('decoder', 'decodebin') - decoder = decoder or 'decodebin' + decoder = decoder or 'Default' + if decoder == 'Default': + if platform.system() == 'Darwin': + decoder = 'vtdec_hw' + else: + decoder = 'decodebin' videosrc += " ! %s " % decoder width = optional_chain(j, 'mediaStreamOptions', diff --git a/plugins/tensorflow-lite/src/tflite/__init__.py b/plugins/tensorflow-lite/src/tflite/__init__.py index 94987891f..fbe2558d1 100644 --- a/plugins/tensorflow-lite/src/tflite/__init__.py +++ b/plugins/tensorflow-lite/src/tflite/__init__.py @@ -239,10 +239,11 @@ class TensorFlowLitePlugin(DetectPlugin, scrypted_sdk.BufferConverter, scrypted_ 'title': "Decoder", 'description': "The gstreamer element used to decode the stream", 'combobox': True, - 'value': 'decodebin', - 'placeholder': 'decodebin', + 'value': 'Default', + 'placeholder': 'Default', 'key': 'decoder', 'choices': [ + 'Default', 'decodebin', 'vtdec_hw', 'nvh264dec',