src.nth.io/

summaryrefslogtreecommitdiff
path: root/main/stream_server.h
diff options
context:
space:
mode:
Diffstat (limited to 'main/stream_server.h')
-rw-r--r--main/stream_server.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/main/stream_server.h b/main/stream_server.h
new file mode 100644
index 0000000..ef8a334
--- /dev/null
+++ b/main/stream_server.h
@@ -0,0 +1,18 @@
+#pragma once
+
+#include <stdint.h>
+#include "esp_err.h"
+
+// Raw-TCP frame ingestion server. Replaces the per-frame HTTP /frame
+// POST loop with a single long-lived TCP connection that streams
+// length+seq prefixed JPEGs back-to-back. Eliminates per-frame TCP
+// setup, HTTP parsing, and the 200ms Nagle/delayed-ACK deadlocks
+// that intermittently spiked the HTTP path to ~250ms wall.
+//
+// Wire protocol (one connection, repeating; all integers big-endian):
+// [4 bytes: jpeg_len ][4 bytes: seq][jpeg_len bytes: JPEG body]
+//
+// One client at a time. New client = previous client's seq counter
+// is reset (so each stream session starts fresh, and stale frames
+// from a previous reconnect can't paint over current ones).
+esp_err_t stream_server_start(uint16_t port);