diff --git a/docs/releases/console-3.1.22.md b/docs/releases/console-3.1.22.md new file mode 100644 index 0000000..7484f41 --- /dev/null +++ b/docs/releases/console-3.1.22.md @@ -0,0 +1,6 @@ +# Edge Console 3.1.22 + +- Report a stopped IP Camera Streaming service explicitly when its local control socket is unavailable instead of exposing the operating-system `No such file or directory` error. +- Keep the Console and IP Camera Streaming diagnostics aligned so operators can distinguish an installed FFmpeg binary from an inactive streaming service. + +Validation: audited `g-box-c453df5f` through its authenticated Console and Cockpit tunnel. Console 3.1.21 and streaming 1.0.7 were current, FFmpeg was installed, but the streaming service had exited successfully during the MQTT stage update and was not restarted. The service was restored and its control socket and gateway FFmpeg spawn path were verified. diff --git a/docs/releases/ip-stream-1.0.8.md b/docs/releases/ip-stream-1.0.8.md new file mode 100644 index 0000000..c9fb1fd --- /dev/null +++ b/docs/releases/ip-stream-1.0.8.md @@ -0,0 +1,9 @@ +# IP Camera Streaming 1.0.8 + +Release date: 2026-10-08. + +- Keep IP Camera Streaming running across MQTT stage updates. Mosquitto is now a soft startup dependency, so the MQTT installer's separate stop/start cycle cannot leave streaming stopped; the persistent service restarts after any subscriber exit and reconnects when the broker returns. +- Require executable FFmpeg and FFprobe binaries before systemd starts the service, and use their canonical system paths at runtime. +- Report a stopped streaming service explicitly when its local control socket is unavailable instead of exposing the operating-system `No such file or directory` error. + +Validation: reproduced on `g-box-c453df5f`. The MQTT 1.0.2 update restarted Mosquitto, the streaming subscriber exited successfully, and `Restart=on-failure` left the service inactive. After a controlled restart, the service, control socket and gateway FFmpeg spawn check are healthy. Unit and Console regression tests cover the corrected lifecycle and error mapping. diff --git a/stage-releases.json b/stage-releases.json index 0edddef..454bc14 100644 --- a/stage-releases.json +++ b/stage-releases.json @@ -14,7 +14,7 @@ "version": "1.0.1" }, "stage_ui": { - "version": "3.1.21" + "version": "3.1.22" }, "stage_avahi": { "version": "1.0.0" @@ -31,7 +31,7 @@ }, "optional_stages": { "stage_ip_stream": { - "version": "1.0.7" + "version": "1.0.8" } } } diff --git a/stage_ip_stream/iomatex-ip-stream.service b/stage_ip_stream/iomatex-ip-stream.service index 81d1883..8a7c4de 100644 --- a/stage_ip_stream/iomatex-ip-stream.service +++ b/stage_ip_stream/iomatex-ip-stream.service @@ -1,13 +1,14 @@ [Unit] Description=IOMATEX IP camera streaming service After=network-online.target mosquitto.service -Wants=network-online.target -Requires=mosquitto.service +Wants=network-online.target mosquitto.service [Service] Type=simple +ExecStartPre=/usr/bin/test -x /usr/bin/ffmpeg +ExecStartPre=/usr/bin/test -x /usr/bin/ffprobe ExecStart=/usr/local/lib/iomatex/ip-stream.py -Restart=on-failure +Restart=always RestartSec=5 User=iomatex-stream Group=iomatex-stream diff --git a/stage_ip_stream/ip-stream.py b/stage_ip_stream/ip-stream.py index e356b19..c00d969 100644 --- a/stage_ip_stream/ip-stream.py +++ b/stage_ip_stream/ip-stream.py @@ -22,6 +22,8 @@ SUPPORTED_INPUT_SCHEMES = {"rtsp"} SUPPORTED_OUTPUT_SCHEMES = {"rtsp", "rtmp", "srt", "udp"} MAX_STREAMS = 8 PREVIEW_TTL_SEC = 10 * 60 +FFMPEG_BINARY = "/usr/bin/ffmpeg" +FFPROBE_BINARY = "/usr/bin/ffprobe" def edge_id(): @@ -168,7 +170,7 @@ class StreamManager: if len(self.processes) >= MAX_STREAMS: raise RuntimeError("stream limit reached") command = [ - "ffmpeg", "-nostdin", "-hide_banner", "-loglevel", "warning", + FFMPEG_BINARY, "-nostdin", "-hide_banner", "-loglevel", "warning", "-rtsp_transport", "tcp", "-i", input_url, "-map", "0:v:0", "-map", "0:a?", *video_arguments(payload), "-c:a", "libopus", "-b:a", "64k", "-ar", "48000", "-ac", "1", @@ -222,7 +224,7 @@ class StreamManager: manifest_path = preview_dir / "index.m3u8" segment_pattern = preview_dir / "segment-%06d.m4s" command = [ - "ffmpeg", "-nostdin", "-hide_banner", "-loglevel", "warning", + FFMPEG_BINARY, "-nostdin", "-hide_banner", "-loglevel", "warning", "-rtsp_transport", "tcp", "-i", input_url, "-map", "0:v:0", "-map", "0:a?", "-c:v", "copy", "-c:a", "aac", "-b:a", "64k", "-ar", "48000", "-ac", "1", @@ -253,7 +255,7 @@ class StreamManager: snapshot_path = preview_dir / "snapshot.jpg" temporary_path = preview_dir / "snapshot.tmp.jpg" command = [ - "ffmpeg", "-nostdin", "-hide_banner", "-loglevel", "error", "-y", + FFMPEG_BINARY, "-nostdin", "-hide_banner", "-loglevel", "error", "-y", "-rtsp_transport", "tcp", "-i", input_url, "-map", "0:v:0", "-frames:v", "1", "-q:v", "2", str(temporary_path), ] @@ -283,7 +285,7 @@ class StreamManager: def validate(self, payload): input_url = validate_url(payload.get("input_url"), SUPPORTED_INPUT_SCHEMES) command = [ - "ffprobe", "-v", "error", "-rtsp_transport", "tcp", + FFPROBE_BINARY, "-v", "error", "-rtsp_transport", "tcp", "-show_streams", "-show_format", "-of", "json", input_url, ] try: diff --git a/stage_ip_stream/test_ip_stream.py b/stage_ip_stream/test_ip_stream.py index 696221f..1a8c34d 100644 --- a/stage_ip_stream/test_ip_stream.py +++ b/stage_ip_stream/test_ip_stream.py @@ -15,7 +15,13 @@ SPEC.loader.exec_module(stream) class IpStreamTest(unittest.TestCase): def test_installer_restarts_an_existing_service(self): installer = MODULE_PATH.with_name("stage_ip_stream_install.sh").read_text(encoding="utf-8") + service = MODULE_PATH.with_name("iomatex-ip-stream.service").read_text(encoding="utf-8") self.assertIn("systemctl restart iomatex-ip-stream.service", installer) + self.assertIn("ExecStartPre=/usr/bin/test -x /usr/bin/ffmpeg", service) + self.assertIn("ExecStartPre=/usr/bin/test -x /usr/bin/ffprobe", service) + self.assertIn("Wants=network-online.target mosquitto.service", service) + self.assertNotIn("Requires=mosquitto.service", service) + self.assertIn("Restart=always", service) self.assertIn("ffprobe -version", installer) self.assertNotIn("enable --now iomatex-ip-stream.service", installer) @@ -192,7 +198,7 @@ class IpStreamTest(unittest.TestCase): self.assertTrue(result["reachable"]) self.assertEqual(result["video_codec"], "h264") self.assertEqual(result["audio_codec"], "aac") - self.assertIn("ffprobe", command.call_args.args[0]) + self.assertIn(stream.FFPROBE_BINARY, command.call_args.args[0]) if __name__ == "__main__": diff --git a/stage_ip_stream/version.json b/stage_ip_stream/version.json index bcf6b6e..0852922 100644 --- a/stage_ip_stream/version.json +++ b/stage_ip_stream/version.json @@ -1,3 +1,3 @@ { - "version": "1.0.7" + "version": "1.0.8" } diff --git a/stage_ui/console_core/backend/app.py b/stage_ui/console_core/backend/app.py index 8d2331e..2531f23 100644 --- a/stage_ui/console_core/backend/app.py +++ b/stage_ui/console_core/backend/app.py @@ -56,7 +56,7 @@ APP_DIR = "/opt/iomatex-console" PUBLIC_DIR = os.path.join(APP_DIR, "public") PROVIDERS_DIR = os.path.join(APP_DIR, "providers.d") CONFIG_PATH = "/etc/iomatex/console.json" -UI_VERSION = "V 3.1.21" +UI_VERSION = "V 3.1.22" STORAGE_HEALTH_COMMAND = "/usr/local/sbin/iomatex-storage-health" ZONEINFO_ROOT = "/usr/share/zoneinfo" @@ -219,7 +219,10 @@ def publish_camera_preview(payload): body = json.dumps(payload, separators=(",", ":")).encode("utf-8") with socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) as client: client.settimeout(20) - client.connect(IOMATEX_IP_STREAM_SOCKET_PATH) + try: + client.connect(IOMATEX_IP_STREAM_SOCKET_PATH) + except (FileNotFoundError, ConnectionRefusedError) as exc: + raise RuntimeError("IP camera streaming service is not running") from exc client.sendall(body) client.shutdown(socket.SHUT_WR) response = bytearray() diff --git a/stage_ui/console_core/backend/test_camera_preview_contract.py b/stage_ui/console_core/backend/test_camera_preview_contract.py index a503cb6..5aef709 100644 --- a/stage_ui/console_core/backend/test_camera_preview_contract.py +++ b/stage_ui/console_core/backend/test_camera_preview_contract.py @@ -16,6 +16,7 @@ class CameraPreviewContractTest(unittest.TestCase): self.assertIn('"action": "preview_start"', source) self.assertIn('"action": "snapshot"', source) self.assertIn('IOMATEX_IP_STREAM_SOCKET_PATH', source) + self.assertIn('IP camera streaming service is not running', source) self.assertIn('wait_camera_snapshot(stream_id, previous_mtime_ns)', source) self.assertIn('content_type = "image/jpeg"', source) self.assertIn('"Access-Control-Allow-Origin": "*"', source) diff --git a/stage_ui/console_core/frontend/index.html b/stage_ui/console_core/frontend/index.html index 479bff9..b6cb95a 100644 --- a/stage_ui/console_core/frontend/index.html +++ b/stage_ui/console_core/frontend/index.html @@ -23,7 +23,7 @@ } catch (error) {} })(); - +
@@ -109,7 +109,7 @@
- - + + diff --git a/stage_ui/version.json b/stage_ui/version.json index 8ec8d80..a027a91 100644 --- a/stage_ui/version.json +++ b/stage_ui/version.json @@ -1,3 +1,3 @@ { - "version": "3.1.21" + "version": "3.1.22" }