matrice-streaming 0.1.14__py3-none-any.whl → 0.1.65__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- matrice_streaming/__init__.py +44 -32
- matrice_streaming/streaming_gateway/camera_streamer/__init__.py +68 -1
- matrice_streaming/streaming_gateway/camera_streamer/async_camera_worker.py +1388 -0
- matrice_streaming/streaming_gateway/camera_streamer/async_ffmpeg_worker.py +966 -0
- matrice_streaming/streaming_gateway/camera_streamer/camera_streamer.py +188 -24
- matrice_streaming/streaming_gateway/camera_streamer/device_detection.py +507 -0
- matrice_streaming/streaming_gateway/camera_streamer/encoding_pool_manager.py +136 -0
- matrice_streaming/streaming_gateway/camera_streamer/ffmpeg_camera_streamer.py +1048 -0
- matrice_streaming/streaming_gateway/camera_streamer/ffmpeg_config.py +192 -0
- matrice_streaming/streaming_gateway/camera_streamer/ffmpeg_worker_manager.py +470 -0
- matrice_streaming/streaming_gateway/camera_streamer/gstreamer_camera_streamer.py +1368 -0
- matrice_streaming/streaming_gateway/camera_streamer/gstreamer_worker.py +1063 -0
- matrice_streaming/streaming_gateway/camera_streamer/gstreamer_worker_manager.py +546 -0
- matrice_streaming/streaming_gateway/camera_streamer/message_builder.py +60 -15
- matrice_streaming/streaming_gateway/camera_streamer/nvdec.py +1330 -0
- matrice_streaming/streaming_gateway/camera_streamer/nvdec_worker_manager.py +412 -0
- matrice_streaming/streaming_gateway/camera_streamer/platform_pipelines.py +680 -0
- matrice_streaming/streaming_gateway/camera_streamer/stream_statistics.py +111 -4
- matrice_streaming/streaming_gateway/camera_streamer/video_capture_manager.py +223 -27
- matrice_streaming/streaming_gateway/camera_streamer/worker_manager.py +694 -0
- matrice_streaming/streaming_gateway/debug/__init__.py +27 -2
- matrice_streaming/streaming_gateway/debug/benchmark.py +727 -0
- matrice_streaming/streaming_gateway/debug/debug_gstreamer_gateway.py +599 -0
- matrice_streaming/streaming_gateway/debug/debug_streaming_gateway.py +245 -95
- matrice_streaming/streaming_gateway/debug/debug_utils.py +29 -0
- matrice_streaming/streaming_gateway/debug/test_videoplayback.py +318 -0
- matrice_streaming/streaming_gateway/dynamic_camera_manager.py +656 -39
- matrice_streaming/streaming_gateway/metrics_reporter.py +676 -139
- matrice_streaming/streaming_gateway/streaming_action.py +71 -20
- matrice_streaming/streaming_gateway/streaming_gateway.py +1026 -78
- matrice_streaming/streaming_gateway/streaming_gateway_utils.py +175 -20
- matrice_streaming/streaming_gateway/streaming_status_listener.py +89 -0
- {matrice_streaming-0.1.14.dist-info → matrice_streaming-0.1.65.dist-info}/METADATA +1 -1
- matrice_streaming-0.1.65.dist-info/RECORD +56 -0
- matrice_streaming-0.1.14.dist-info/RECORD +0 -38
- {matrice_streaming-0.1.14.dist-info → matrice_streaming-0.1.65.dist-info}/WHEEL +0 -0
- {matrice_streaming-0.1.14.dist-info → matrice_streaming-0.1.65.dist-info}/licenses/LICENSE.txt +0 -0
- {matrice_streaming-0.1.14.dist-info → matrice_streaming-0.1.65.dist-info}/top_level.txt +0 -0
matrice_streaming/__init__.py
CHANGED
|
@@ -1,37 +1,49 @@
|
|
|
1
1
|
"""Module providing __init__ functionality."""
|
|
2
|
-
|
|
2
|
+
import multiprocessing
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
"pillow",
|
|
9
|
-
"confluent_kafka[snappy]",
|
|
10
|
-
"aiokafka",
|
|
11
|
-
"aiohttp",
|
|
12
|
-
"filterpy",
|
|
13
|
-
"scipy",
|
|
14
|
-
"scikit-learn",
|
|
15
|
-
"matplotlib",
|
|
16
|
-
"scikit-image",
|
|
17
|
-
"python-snappy",
|
|
18
|
-
"pyyaml",
|
|
19
|
-
"imagehash",
|
|
20
|
-
]
|
|
4
|
+
# Only run dependency checks in the main process, NOT in spawned child processes
|
|
5
|
+
# (ProcessPoolExecutor workers). Child processes re-import modules which would
|
|
6
|
+
# trigger pip install commands, causing crashes with BrokenProcessPool errors.
|
|
7
|
+
_is_main_process = multiprocessing.parent_process() is None
|
|
21
8
|
|
|
22
|
-
|
|
23
|
-
dependencies_check
|
|
9
|
+
if _is_main_process:
|
|
10
|
+
from matrice_common.utils import dependencies_check
|
|
24
11
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
12
|
+
base = [
|
|
13
|
+
"httpx",
|
|
14
|
+
"fastapi",
|
|
15
|
+
"uvicorn",
|
|
16
|
+
"pillow",
|
|
17
|
+
"confluent_kafka[snappy]",
|
|
18
|
+
"aiokafka",
|
|
19
|
+
"aiohttp",
|
|
20
|
+
"filterpy",
|
|
21
|
+
"scipy",
|
|
22
|
+
"scikit-learn",
|
|
23
|
+
"matplotlib",
|
|
24
|
+
"scikit-image",
|
|
25
|
+
"python-snappy",
|
|
26
|
+
"pyyaml",
|
|
27
|
+
"imagehash",
|
|
28
|
+
"psutil"
|
|
29
|
+
]
|
|
35
30
|
|
|
36
|
-
|
|
37
|
-
dependencies_check(
|
|
31
|
+
# Install base dependencies first
|
|
32
|
+
dependencies_check(base)
|
|
33
|
+
|
|
34
|
+
# Helper to attempt installation and verify importability
|
|
35
|
+
def _install_and_verify(pkg: str, import_name: str):
|
|
36
|
+
"""Install a package expression and return True if the import succeeds."""
|
|
37
|
+
if dependencies_check([pkg]):
|
|
38
|
+
try:
|
|
39
|
+
__import__(import_name)
|
|
40
|
+
return True
|
|
41
|
+
except ImportError:
|
|
42
|
+
return False
|
|
43
|
+
return False
|
|
44
|
+
|
|
45
|
+
try:
|
|
46
|
+
import cv2
|
|
47
|
+
except ImportError:
|
|
48
|
+
if not dependencies_check(["opencv-python"]):
|
|
49
|
+
dependencies_check(["opencv-python-headless"])
|
|
@@ -1,3 +1,70 @@
|
|
|
1
1
|
from .camera_streamer import CameraStreamer
|
|
2
|
+
from .worker_manager import WorkerManager
|
|
3
|
+
from .async_camera_worker import AsyncCameraWorker
|
|
2
4
|
|
|
3
|
-
|
|
5
|
+
# GStreamer components (optional - graceful import)
|
|
6
|
+
try:
|
|
7
|
+
from .gstreamer_camera_streamer import (
|
|
8
|
+
GStreamerCameraStreamer,
|
|
9
|
+
GStreamerConfig,
|
|
10
|
+
GStreamerPipeline,
|
|
11
|
+
is_gstreamer_available,
|
|
12
|
+
)
|
|
13
|
+
from .gstreamer_worker import (
|
|
14
|
+
GStreamerAsyncWorker,
|
|
15
|
+
run_gstreamer_worker,
|
|
16
|
+
)
|
|
17
|
+
from .gstreamer_worker_manager import GStreamerWorkerManager
|
|
18
|
+
|
|
19
|
+
GSTREAMER_AVAILABLE = is_gstreamer_available()
|
|
20
|
+
except (ImportError, ValueError):
|
|
21
|
+
# ImportError: gi module not available
|
|
22
|
+
# ValueError: gi.require_version fails when GStreamer not installed
|
|
23
|
+
GSTREAMER_AVAILABLE = False
|
|
24
|
+
GStreamerCameraStreamer = None
|
|
25
|
+
GStreamerConfig = None
|
|
26
|
+
GStreamerPipeline = None
|
|
27
|
+
GStreamerAsyncWorker = None
|
|
28
|
+
GStreamerWorkerManager = None
|
|
29
|
+
|
|
30
|
+
def is_gstreamer_available():
|
|
31
|
+
return False
|
|
32
|
+
|
|
33
|
+
# NVDEC components (optional - graceful import)
|
|
34
|
+
try:
|
|
35
|
+
from .nvdec_worker_manager import (
|
|
36
|
+
NVDECWorkerManager,
|
|
37
|
+
is_nvdec_available,
|
|
38
|
+
get_available_gpu_count,
|
|
39
|
+
)
|
|
40
|
+
NVDEC_AVAILABLE = is_nvdec_available()
|
|
41
|
+
except ImportError:
|
|
42
|
+
# NVDEC not available (requires CuPy, PyNvVideoCodec)
|
|
43
|
+
NVDEC_AVAILABLE = False
|
|
44
|
+
NVDECWorkerManager = None
|
|
45
|
+
|
|
46
|
+
def is_nvdec_available():
|
|
47
|
+
return False
|
|
48
|
+
|
|
49
|
+
def get_available_gpu_count():
|
|
50
|
+
return 1
|
|
51
|
+
|
|
52
|
+
__all__ = [
|
|
53
|
+
# Original components
|
|
54
|
+
"CameraStreamer",
|
|
55
|
+
"WorkerManager",
|
|
56
|
+
"AsyncCameraWorker",
|
|
57
|
+
# GStreamer components
|
|
58
|
+
"GStreamerCameraStreamer",
|
|
59
|
+
"GStreamerConfig",
|
|
60
|
+
"GStreamerPipeline",
|
|
61
|
+
"GStreamerAsyncWorker",
|
|
62
|
+
"GStreamerWorkerManager",
|
|
63
|
+
"is_gstreamer_available",
|
|
64
|
+
"GSTREAMER_AVAILABLE",
|
|
65
|
+
# NVDEC components
|
|
66
|
+
"NVDECWorkerManager",
|
|
67
|
+
"is_nvdec_available",
|
|
68
|
+
"get_available_gpu_count",
|
|
69
|
+
"NVDEC_AVAILABLE",
|
|
70
|
+
]
|