matrice-streaming 0.1.71__tar.gz → 0.1.72__tar.gz

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.
Files changed (71) hide show
  1. {matrice_streaming-0.1.71 → matrice_streaming-0.1.72}/PKG-INFO +1 -1
  2. {matrice_streaming-0.1.71 → matrice_streaming-0.1.72}/matrice_streaming.egg-info/PKG-INFO +1 -1
  3. {matrice_streaming-0.1.71 → matrice_streaming-0.1.72}/src/matrice_streaming/streaming_gateway/camera_streamer/async_camera_worker.py +4 -4
  4. {matrice_streaming-0.1.71 → matrice_streaming-0.1.72}/src/matrice_streaming/streaming_gateway/camera_streamer/worker_manager.py +8 -7
  5. {matrice_streaming-0.1.71 → matrice_streaming-0.1.72}/LICENSE.txt +0 -0
  6. {matrice_streaming-0.1.71 → matrice_streaming-0.1.72}/README.md +0 -0
  7. {matrice_streaming-0.1.71 → matrice_streaming-0.1.72}/matrice_streaming.egg-info/SOURCES.txt +0 -0
  8. {matrice_streaming-0.1.71 → matrice_streaming-0.1.72}/matrice_streaming.egg-info/dependency_links.txt +0 -0
  9. {matrice_streaming-0.1.71 → matrice_streaming-0.1.72}/matrice_streaming.egg-info/not-zip-safe +0 -0
  10. {matrice_streaming-0.1.71 → matrice_streaming-0.1.72}/matrice_streaming.egg-info/top_level.txt +0 -0
  11. {matrice_streaming-0.1.71 → matrice_streaming-0.1.72}/pyproject.toml +0 -0
  12. {matrice_streaming-0.1.71 → matrice_streaming-0.1.72}/setup.cfg +0 -0
  13. {matrice_streaming-0.1.71 → matrice_streaming-0.1.72}/setup.py +0 -0
  14. {matrice_streaming-0.1.71 → matrice_streaming-0.1.72}/src/matrice_streaming/__init__.py +0 -0
  15. {matrice_streaming-0.1.71 → matrice_streaming-0.1.72}/src/matrice_streaming/client/__init__.py +0 -0
  16. {matrice_streaming-0.1.71 → matrice_streaming-0.1.72}/src/matrice_streaming/client/client.py +0 -0
  17. {matrice_streaming-0.1.71 → matrice_streaming-0.1.72}/src/matrice_streaming/client/client_utils.py +0 -0
  18. {matrice_streaming-0.1.71 → matrice_streaming-0.1.72}/src/matrice_streaming/deployment/__init__.py +0 -0
  19. {matrice_streaming-0.1.71 → matrice_streaming-0.1.72}/src/matrice_streaming/deployment/camera_manager.py +0 -0
  20. {matrice_streaming-0.1.71 → matrice_streaming-0.1.72}/src/matrice_streaming/deployment/deployment.py +0 -0
  21. {matrice_streaming-0.1.71 → matrice_streaming-0.1.72}/src/matrice_streaming/deployment/inference_pipeline.py +0 -0
  22. {matrice_streaming-0.1.71 → matrice_streaming-0.1.72}/src/matrice_streaming/deployment/streaming_gateway_manager.py +0 -0
  23. {matrice_streaming-0.1.71 → matrice_streaming-0.1.72}/src/matrice_streaming/deployment/todo.txt +0 -0
  24. {matrice_streaming-0.1.71 → matrice_streaming-0.1.72}/src/matrice_streaming/py.typed +0 -0
  25. {matrice_streaming-0.1.71 → matrice_streaming-0.1.72}/src/matrice_streaming/streaming_gateway/__init__.py +0 -0
  26. {matrice_streaming-0.1.71 → matrice_streaming-0.1.72}/src/matrice_streaming/streaming_gateway/camera_streamer/ARCHITECTURE.md +0 -0
  27. {matrice_streaming-0.1.71 → matrice_streaming-0.1.72}/src/matrice_streaming/streaming_gateway/camera_streamer/__init__.py +0 -0
  28. {matrice_streaming-0.1.71 → matrice_streaming-0.1.72}/src/matrice_streaming/streaming_gateway/camera_streamer/async_ffmpeg_worker.py +0 -0
  29. {matrice_streaming-0.1.71 → matrice_streaming-0.1.72}/src/matrice_streaming/streaming_gateway/camera_streamer/camera_streamer.py +0 -0
  30. {matrice_streaming-0.1.71 → matrice_streaming-0.1.72}/src/matrice_streaming/streaming_gateway/camera_streamer/device_detection.py +0 -0
  31. {matrice_streaming-0.1.71 → matrice_streaming-0.1.72}/src/matrice_streaming/streaming_gateway/camera_streamer/encoder_manager.py +0 -0
  32. {matrice_streaming-0.1.71 → matrice_streaming-0.1.72}/src/matrice_streaming/streaming_gateway/camera_streamer/encoding_pool_manager.py +0 -0
  33. {matrice_streaming-0.1.71 → matrice_streaming-0.1.72}/src/matrice_streaming/streaming_gateway/camera_streamer/ffmpeg_camera_streamer.py +0 -0
  34. {matrice_streaming-0.1.71 → matrice_streaming-0.1.72}/src/matrice_streaming/streaming_gateway/camera_streamer/ffmpeg_config.py +0 -0
  35. {matrice_streaming-0.1.71 → matrice_streaming-0.1.72}/src/matrice_streaming/streaming_gateway/camera_streamer/ffmpeg_worker_manager.py +0 -0
  36. {matrice_streaming-0.1.71 → matrice_streaming-0.1.72}/src/matrice_streaming/streaming_gateway/camera_streamer/frame_processor.py +0 -0
  37. {matrice_streaming-0.1.71 → matrice_streaming-0.1.72}/src/matrice_streaming/streaming_gateway/camera_streamer/gstreamer_camera_streamer.py +0 -0
  38. {matrice_streaming-0.1.71 → matrice_streaming-0.1.72}/src/matrice_streaming/streaming_gateway/camera_streamer/gstreamer_worker.py +0 -0
  39. {matrice_streaming-0.1.71 → matrice_streaming-0.1.72}/src/matrice_streaming/streaming_gateway/camera_streamer/gstreamer_worker_manager.py +0 -0
  40. {matrice_streaming-0.1.71 → matrice_streaming-0.1.72}/src/matrice_streaming/streaming_gateway/camera_streamer/message_builder.py +0 -0
  41. {matrice_streaming-0.1.71 → matrice_streaming-0.1.72}/src/matrice_streaming/streaming_gateway/camera_streamer/nvdec.py +0 -0
  42. {matrice_streaming-0.1.71 → matrice_streaming-0.1.72}/src/matrice_streaming/streaming_gateway/camera_streamer/nvdec_worker_manager.py +0 -0
  43. {matrice_streaming-0.1.71 → matrice_streaming-0.1.72}/src/matrice_streaming/streaming_gateway/camera_streamer/platform_pipelines.py +0 -0
  44. {matrice_streaming-0.1.71 → matrice_streaming-0.1.72}/src/matrice_streaming/streaming_gateway/camera_streamer/retry_manager.py +0 -0
  45. {matrice_streaming-0.1.71 → matrice_streaming-0.1.72}/src/matrice_streaming/streaming_gateway/camera_streamer/stream_statistics.py +0 -0
  46. {matrice_streaming-0.1.71 → matrice_streaming-0.1.72}/src/matrice_streaming/streaming_gateway/camera_streamer/video_capture_manager.py +0 -0
  47. {matrice_streaming-0.1.71 → matrice_streaming-0.1.72}/src/matrice_streaming/streaming_gateway/debug/README.md +0 -0
  48. {matrice_streaming-0.1.71 → matrice_streaming-0.1.72}/src/matrice_streaming/streaming_gateway/debug/__init__.py +0 -0
  49. {matrice_streaming-0.1.71 → matrice_streaming-0.1.72}/src/matrice_streaming/streaming_gateway/debug/benchmark.py +0 -0
  50. {matrice_streaming-0.1.71 → matrice_streaming-0.1.72}/src/matrice_streaming/streaming_gateway/debug/debug_gstreamer_gateway.py +0 -0
  51. {matrice_streaming-0.1.71 → matrice_streaming-0.1.72}/src/matrice_streaming/streaming_gateway/debug/debug_stream_backend.py +0 -0
  52. {matrice_streaming-0.1.71 → matrice_streaming-0.1.72}/src/matrice_streaming/streaming_gateway/debug/debug_streaming_gateway.py +0 -0
  53. {matrice_streaming-0.1.71 → matrice_streaming-0.1.72}/src/matrice_streaming/streaming_gateway/debug/debug_utils.py +0 -0
  54. {matrice_streaming-0.1.71 → matrice_streaming-0.1.72}/src/matrice_streaming/streaming_gateway/debug/example_debug_streaming.py +0 -0
  55. {matrice_streaming-0.1.71 → matrice_streaming-0.1.72}/src/matrice_streaming/streaming_gateway/debug/test_videoplayback.py +0 -0
  56. {matrice_streaming-0.1.71 → matrice_streaming-0.1.72}/src/matrice_streaming/streaming_gateway/dynamic_camera_manager.py +0 -0
  57. {matrice_streaming-0.1.71 → matrice_streaming-0.1.72}/src/matrice_streaming/streaming_gateway/event_listener.py +0 -0
  58. {matrice_streaming-0.1.71 → matrice_streaming-0.1.72}/src/matrice_streaming/streaming_gateway/metrics_reporter.py +0 -0
  59. {matrice_streaming-0.1.71 → matrice_streaming-0.1.72}/src/matrice_streaming/streaming_gateway/streaming_action.py +0 -0
  60. {matrice_streaming-0.1.71 → matrice_streaming-0.1.72}/src/matrice_streaming/streaming_gateway/streaming_gateway.py +0 -0
  61. {matrice_streaming-0.1.71 → matrice_streaming-0.1.72}/src/matrice_streaming/streaming_gateway/streaming_gateway_utils.py +0 -0
  62. {matrice_streaming-0.1.71 → matrice_streaming-0.1.72}/src/matrice_streaming/streaming_gateway/streaming_status_listener.py +0 -0
  63. {matrice_streaming-0.1.71 → matrice_streaming-0.1.72}/tests/test_async_infrastructure.py +0 -0
  64. {matrice_streaming-0.1.71 → matrice_streaming-0.1.72}/tests/test_batch_auto_calculation.py +0 -0
  65. {matrice_streaming-0.1.71 → matrice_streaming-0.1.72}/tests/test_batching_verification.py +0 -0
  66. {matrice_streaming-0.1.71 → matrice_streaming-0.1.72}/tests/test_e2e_production.py +0 -0
  67. {matrice_streaming-0.1.71 → matrice_streaming-0.1.72}/tests/test_flatten_binary.py +0 -0
  68. {matrice_streaming-0.1.71 → matrice_streaming-0.1.72}/tests/test_gstreamer_integration.py +0 -0
  69. {matrice_streaming-0.1.71 → matrice_streaming-0.1.72}/tests/test_msgpack_fix.py +0 -0
  70. {matrice_streaming-0.1.71 → matrice_streaming-0.1.72}/tests/test_phase1_unit.py +0 -0
  71. {matrice_streaming-0.1.71 → matrice_streaming-0.1.72}/tests/test_phase2_scaling.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: matrice_streaming
3
- Version: 0.1.71
3
+ Version: 0.1.72
4
4
  Summary: Common server utilities for Matrice.ai services
5
5
  Author-email: "Matrice.ai" <dipendra@matrice.ai>
6
6
  License-Expression: MIT
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: matrice_streaming
3
- Version: 0.1.71
3
+ Version: 0.1.72
4
4
  Summary: Common server utilities for Matrice.ai services
5
5
  Author-email: "Matrice.ai" <dipendra@matrice.ai>
6
6
  License-Expression: MIT
@@ -101,7 +101,7 @@ class AsyncCameraWorker:
101
101
  # ================================================================
102
102
  drop_stale_frames: bool = False, # Disabled for ML quality
103
103
  use_simple_read: bool = True, # Use cap.read() directly instead of grab/retrieve
104
- pin_cpu_affinity: bool = True, # Pin worker to specific CPU cores
104
+ pin_cpu_affinity: bool = False, # Let OS distribute threads (avoids cache contention)
105
105
  total_workers: int = 1, # Total worker count for CPU affinity calculation
106
106
  buffer_size: int = 1, # Minimal buffer for low latency (cv2_bench uses 1)
107
107
  ):
@@ -240,8 +240,8 @@ class AsyncCameraWorker:
240
240
  # - But TOO many threads causes burst frame arrivals → Redis write queue backup
241
241
  # - Cap at 64 threads to balance I/O parallelism vs write contention
242
242
  num_cameras = len(camera_configs)
243
- # Use 1 thread per camera, capped at 64 to prevent write burst contention
244
- num_capture_threads = min(64, max(8, num_cameras))
243
+ # Use 1 thread per camera, max 64 for reduced contention
244
+ num_capture_threads = min(64, num_cameras)
245
245
  self.capture_executor = ThreadPoolExecutor(max_workers=num_capture_threads)
246
246
  self.num_capture_threads = num_capture_threads
247
247
 
@@ -1335,7 +1335,7 @@ def run_async_worker(
1335
1335
  # ================================================================
1336
1336
  drop_stale_frames: bool = False, # Disabled for ML quality
1337
1337
  use_simple_read: bool = True, # Use cap.read() directly instead of grab/retrieve
1338
- pin_cpu_affinity: bool = True,
1338
+ pin_cpu_affinity: bool = False, # Let OS distribute (avoids cache contention)
1339
1339
  total_workers: int = 1,
1340
1340
  buffer_size: int = 1,
1341
1341
  # ================================================================
@@ -45,7 +45,7 @@ class WorkerManager:
45
45
  # ================================================================
46
46
  drop_stale_frames: bool = False, # Use grab()/grab()/retrieve() for latest frame (disabled for ML quality)
47
47
  use_simple_read: bool = True, # Use cap.read() directly instead of grab/retrieve
48
- pin_cpu_affinity: bool = True, # Pin workers to specific CPU cores
48
+ pin_cpu_affinity: bool = False, # Let OS distribute (avoids cache contention)
49
49
  buffer_size: int = 1, # VideoCapture buffer size (1 = minimal latency)
50
50
  # ================================================================
51
51
  # FRAME OPTIMIZER: Control frame similarity detection
@@ -78,17 +78,18 @@ class WorkerManager:
78
78
  cpu_count = os.cpu_count() or 4 # Fallback to 4 if can't detect
79
79
  num_cameras = len(camera_configs)
80
80
 
81
- # For systems with 16+ cores OR large camera counts, use camera-based calculation
82
- # This applies to Docker containers with limited CPU allocation (e.g., 20 cores)
83
- # Too many workers = process overhead; too few = underutilization
84
- # Target: ~25 cameras per worker for better read parallelism with video files
85
- if cpu_count >= 16 or num_cameras >= 100:
81
+ # Small deployments: 1 worker per camera for maximum parallelism
82
+ # Each worker process has its own GIL, enabling true CPU parallelism
83
+ if num_cameras <= 10:
84
+ calculated_workers = max(1, num_cameras)
85
+ # Large deployments: use camera-based calculation
86
+ elif cpu_count >= 16 or num_cameras >= 100:
86
87
  # Use camera-based calculation for better distribution
87
88
  # 1000 cameras / 25 cameras per worker = 40 workers
88
89
  target_cameras_per_worker = 25
89
90
  calculated_workers = max(4, min(num_cameras // target_cameras_per_worker, 50))
90
91
  else:
91
- # Standard calculation for smaller systems
92
+ # Standard calculation for medium systems
92
93
  calculated_workers = max(4, int(cpu_count * cpu_percentage))
93
94
 
94
95
  # Cap at camera count (no point having more workers than cameras)