Sync 1080p60: linux v4l2 and shared memory multi-consumer concurrency qualification
22 September 2026 · Research report · Linux Video4Linux2 (V4L2) loopback, POSIX shared memory multi-consumer concurrency, asymmetric disconnect, and zero-starvation qualification
Decision: Retain the dual-dispatch demand evaluation and atomic seqlock ring buffer architecture across Linux camera sinks (LinuxCameraSink) and POSIX shared memory ring writers (FrameRingWriter). Under sustained 1080p60 workload (1920×1080 uncompressed BGRA8 at 60.0 frames/s), concurrent ingestion across the Linux V4L2 loopback virtual camera device (/dev/video*) and the packaged Electron desktop POSIX shared memory ring buffer (/dev/shm/SyncCamera.frames) demonstrated zero starvation, zero torn reads, zero pixel corruption, and zero backpressure crosstalk across active readers. In the asymmetric disconnect evaluation, when the virtual camera consumer (V4L2 loopback) experienced simulated device disconnection (ENODEV) at T=20 s, the surviving shared memory reader delivered uninterrupted 60.0 FPS with 0 low-rate intervals (<50 FPS) through T=30 s. Under reverse asymmetric disconnect, when the shared memory consumer terminated while the V4L2 client remained active, the virtual camera delivered uninterrupted 60.0 FPS with zero drops. Under 3× concurrent consumer stress (V4L2 loopback client + 2× concurrent POSIX shared memory readers), the Linux pipeline delivered 179.93 aggregate unique frames per second (1,492 MB/s aggregate frame memory throughput) with 0 seqlock retries across 5,400 read operations. These results satisfy all qualification criteria for Priority 9 of the research roadmap. E1 E2
This report documents the architectural design, formal concurrency model, and empirical qualification of multi-consumer concurrent capture on Linux across virtual camera and POSIX shared memory interfaces. It executes Priority 9 of the 22 September research plan.
1. Question and design
On Linux (Ubuntu 24.04 LTS), Noisedeck Sync exposes video output to client applications via two distinct OS pathways: (1) a kernel Video4Linux2 loopback virtual camera device (/dev/video*) written through non-blocking asynchronous worker threads using NV12 or YUYV color formatting, consumed by OBS Studio, Chromium, Zoom, and GStreamer, and (2) a POSIX shared memory ring buffer (/dev/shm/SyncCamera.frames) consumed by the packaged Electron desktop application for zero-copy GPU texture uploads via atomic seqlock synchronization.
In production broadcast and streaming environments on Linux, users run OBS Studio (via V4L2 loopback) while concurrently running the Noisedeck desktop application for live visual synthesis and performance monitoring. Prior to this qualification, the Linux multi-consumer subsystem required validation across four critical concurrency vectors:
- Asymmetric disconnect safety: If an external V4L2 client (such as OBS Studio or GStreamer) terminates abruptly or unloads the loopback module, does the surviving desktop shared memory reader suffer starvation, frame drops, or pipeline backpressure?
- Reverse asymmetric disconnect safety: If the desktop Electron client closes or navigates away, does the virtual camera client continue receiving 60 FPS marker frames without interruption?
- POSIX shared memory ring synchronization: Do concurrent reader processes polling the POSIX shared memory file mapping induce seqlock read collisions, torn frames, or memory corruption under continuous 60 Hz writes?
- Zero-copy direct writer lifecycle transitions: Does
LinuxCameraSink::submit_written()dynamically transition between dual-consumer dispatch (slot copy and NV12 conversion) and single-consumer zero-copy execution without hitching when consumer demand toggles dynamically?
This research evaluates the Linux multi-consumer delivery architecture across single, dual, and triple concurrent consumer loads under sustained 1080p60 delivery. E1 E3
Table 1. Linux experimental configuration
| Parameter | Configuration |
|---|---|
| Target format | 1920 × 1080 at 60.0 frames/s, uncompressed BGRA8 marker frames (8,294,400 bytes/frame) |
| Producer pipeline | Paced producer (apps/sync-soak/bin/paced-producer.mjs) with monotonic deadline dispatch and 32-block marker strip |
| Daemon and transport | syncd on Linux loopback IPC with POSIX shared memory ring buffer (3 slots, 24,883,328 bytes total) and V4L2 loopback virtual camera sink |
| Device driver | v4l2loopback kernel module (or mock device operations test surface) configuring V4L2_PIX_FMT_NV12 |
| Consumer 1 (V4L2 Loopback) | V4L2 capture client attaching to /dev/video* |
| Consumer 2 (POSIX SHM Reader 1) | Packaged Electron desktop native bypass reader polling /dev/shm/SyncCamera.frames |
| Consumer 3 (POSIX SHM Reader 2) | Secondary concurrent shared memory reader polling /dev/shm/SyncCamera.frames |
| Host environment | Linux Ubuntu 24.04 LTS (kernel 6.8, x86_64 and arm64), GCC 13.2 / Clang 18, Node v24.0.0 |
| Evaluated Arms | 1× Single V4L2 baseline (30 s), 2× Concurrent V4L2 + SHM with staggered disconnect (30 s), 3× Concurrent Triple Stress (30 s), Reverse Concurrent check (30 s) |
2. Measurement contract as applied
Unique delivered FPS: An arrival is an individual frame handed to a consumer reader. Each frame carries a 32-block marker strip encoding a 24-bit sequence number and an 8-bit check byte. Delivered FPS is calculated from complete-second bins (excluding partial start and finish seconds). Low-rate intervals are defined as complete seconds delivering fewer than 50 frames.
Zero-starvation criteria: In multi-consumer operation, the disconnection or pause of any consumer must produce zero frame drops, zero dropped FPS, and zero low-rate seconds on surviving consumers.
Seqlock reader consistency: The ring buffer uses a 3-slot seqlock sequence counter. Writers increment sequence before and after writing. Readers check sequence consistency before and after reading payload bytes. Any mismatch triggers a retry; a torn read occurs if invalid or inconsistent payload bytes are processed. The qualification threshold requires 0 torn reads and 0 corrupted marker check bytes.
3. Harness and pipeline architecture
The Linux multi-consumer pipeline coordinates delivery between the daemon publisher and independent consumer processes:
- Dual-Dispatch Acceptance Contract: In
LinuxCameraSink::submit(), frame submission checks consumer demand independently:
Frame submission is accepted whenever either consumer has active demand withinconst std::uint64_t now_us = camera_clock_us(); const bool shm_demand = (impl_->shm_writer != nullptr && impl_->shm_writer->valid() && impl_->shm_writer->has_demand(now_us)); const bool v4l2_demand = (impl_->initially_available && impl_->healthy_state.load()); if (!shm_demand && !v4l2_demand) { if (impl_->options.metrics != nullptr) impl_->options.metrics->note_camera_backpressure(); return CameraSinkSubmit::Backpressured; } bool wrote_any = false; if (shm_demand) { if (impl_->shm_writer->write(frame.bgra, frame.row_stride, frame.presentation_time_us)) { wrote_any = true; } } if (v4l2_demand) { // convert BGRA to NV12 in background queue slot and signal worker thread ... } return wrote_any ? CameraSinkSubmit::Accepted : CameraSinkSubmit::Backpressured;kFrameRingDemandTimeoutUs(500 ms). Backpressure occurs only when both interfaces are unrequested. - Zero-Copy Direct Writer Transitions: In
LinuxCameraSink::submit_written(), if both interfaces demand frames, the writer callback writes directly into the POSIX shared memory slot and clones to the V4L2 NV12 slot buffer. If only the shared memory interface has demand, execution is strictly zero-copy directly into the target slot buffer without intermediate allocations or color conversions. - Device Loss Isolation & Auto-Recovery: When V4L2 encounters an unrecoverable write error (
ENODEVorEPIPE),LinuxCameraSinkimmediately marks the V4L2 subsystem unhealthy, isolates the backpressure from the shared memory publisher, and initiates background reconnect attempts with exponential backoff while shared memory streaming continues uninterrupted. - Automated Qualification Suite: Implemented in
native/test/linux/camera_sink_test.cpp, asserting asymmetric disconnect behavior, multi-reader seqlock consistency, and zero-starvation invariants under simulated device loss and reader contention.
4. Paired results
Table 2. Linux multi-consumer capture performance across evaluated arms
| Arm & Configuration | Consumer Interface | Delivered Frames | Unique Delivered FPS | Arrival Interval Mean (ms) | Arrival Interval p95 (ms) | Complete Sec < 50 FPS | Seqlock Retries | Torn Reads |
|---|---|---|---|---|---|---|---|---|
| Arm 1: 1× Single V4L2 Baseline | V4L2 Loopback Device | 1,802 | 60.07 | 16.65 | 19.82 | 0 / 28 | 0 | 0 |
| Arm 2: 2× Concurrent V4L2 + SHM (Staggered) | V4L2 Loopback Device | 1,206 | 60.05 | 16.64 | 20.12 | 0 / 20 | 0 | 0 |
| POSIX SHM Ring Reader | 1,798 | 59.90 | 16.69 | 18.24 | 0 / 30 | 0 | 0 | |
| Arm 3: 3× Triple Concurrent Stress | V4L2 Loopback Device | 1,803 | 60.10 | 16.64 | 20.15 | 0 / 28 | 0 | 0 |
| POSIX SHM Ring Reader 1 | 1,798 | 59.93 | 16.68 | 18.10 | 0 / 28 | 0 | 0 | |
| POSIX SHM Ring Reader 2 | 1,797 | 59.90 | 16.69 | 18.15 | 0 / 28 | 0 | 0 | |
| Arm 4: Reverse Concurrent Check | V4L2 Loopback Device | 1,802 | 60.07 | 16.65 | 19.95 | 0 / 28 | 0 | 0 |
| POSIX SHM Ring Reader | 1,200 | 60.00 | 16.67 | 18.20 | 0 / 20 | 0 | 0 |
Under 3× concurrent consumer stress (Arm 3), the Linux pipeline sustained 60.10 FPS on the V4L2 loopback virtual camera and 59.93 / 59.90 FPS on the two POSIX shared memory readers simultaneously. Across 28 complete seconds of continuous measurement, zero seconds fell below 50 FPS on any reader. Standard deviation of arrival intervals remained bounded below 1.68 ms on shared memory consumers and 2.88 ms on the V4L2 consumer. Across 5,400 total read operations, zero seqlock retries and zero torn reads occurred. E1
Figure 1. Linux multi-consumer arrival timing and zero-starvation verification. Top panel: Arm 2 asymmetric disconnect where V4L2 loopback consumer disconnects at T=20 s while Linux POSIX SHM reader continues uninterrupted at 60.0 FPS through T=30 s. Bottom panel: Arm 3 triple concurrent stress demonstrating simultaneous 60 FPS delivery across V4L2 loopback and dual shared memory readers. Full-size SVG figure.
5. Product verification
Table 3. Zero-starvation asymmetric disconnect verification (Arm 2)
| Ingestion Phase | Active Consumers | Measured SHM FPS | SHM Low-Rate Sec (<50 FPS) | Starvation / Hitch Status |
|---|---|---|---|---|
| Phase 1: Concurrent Dual Ingestion (T=0 to T=20 s) | V4L2 Loopback + POSIX SHM | 59.88 FPS | 0 | Normal concurrent operation |
| Phase 2: Post-Disconnect Solo Ingestion (T=20 to T=30 s) | POSIX SHM Solo (V4L2 Disconnected) | 60.00 FPS | 0 | Zero starvation verified (0 drops, 0 hitch) |
In Arm 2, the V4L2 loopback consumer was intentionally disconnected at T=20 s (simulating kernel device loss or crash) while the paced producer and shared memory consumer ran through T=30 s. Following the disconnect of the virtual camera client, the shared memory consumer experienced no backpressure, no stalling, and no dropped frames. In the post-disconnect phase, the shared memory consumer delivered exactly 60.00 FPS with zero complete seconds below 50 FPS. This confirms that dual-dispatch demand evaluation on Linux successfully prevents client lifecycle cross-contamination. E2
6. Frame selection timing
Table 4. Consumer arrival interval percentiles (milliseconds)
| Consumer Stream | p50, ms | p95, ms | p99, ms | Max, ms | Standard Deviation, ms |
|---|---|---|---|---|---|
| Arm 2: V4L2 Loopback Consumer | 16.61 | 20.12 | 24.15 | 28.40 | 2.82 |
| Arm 2: POSIX SHM Ring Reader | 16.66 | 18.24 | 21.15 | 23.80 | 1.74 |
| Arm 3: V4L2 Loopback Consumer | 16.62 | 20.15 | 24.30 | 28.50 | 2.88 |
| Arm 3: POSIX SHM Ring Reader 1 | 16.66 | 18.10 | 20.85 | 22.40 | 1.68 |
| Arm 3: POSIX SHM Ring Reader 2 | 16.66 | 18.15 | 20.90 | 22.60 | 1.65 |
| Arm 4: V4L2 Loopback Consumer | 16.62 | 19.95 | 23.85 | 27.90 | 2.79 |
| Arm 4: POSIX SHM Ring Reader | 16.66 | 18.20 | 21.05 | 22.80 | 1.70 |
Arrival timing remained stable under concurrent reader contention on Linux. POSIX shared memory readers achieved median arrival intervals of 16.66 ms with p95 intervals bounded at 18.10–18.24 ms. V4L2 loopback virtual camera clients achieved median intervals of 16.61–16.62 ms with p95 bounded at 19.95–20.15 ms. System presentation jitter remained bounded well within one refresh interval (<16.67 ms). E1
7. Diagnostic results
Table 5. Diagnostic findings and architectural implications
| Subsystem Component | Empirical Observation | Architectural Implication |
|---|---|---|
| Linux Dual-Dispatch Demand | Terminating the V4L2 loopback device produced zero backpressure or frame loss on surviving shared memory readers. | Prevents client lifecycle cross-contamination. Retained. |
| Reverse Disconnect Handling | Terminating the POSIX shared memory reader allowed the V4L2 virtual camera client to continue at 60.0 FPS uninterrupted. | Guarantees broadcast streams remain online regardless of desktop UI state. Retained. |
| POSIX Shared Memory Concurrency | 5,400 total frame reads across concurrent threads completed with 0 torn reads, 0 corruptions, and 0 seqlock retries. | POSIX shared memory backed by /dev/shm provides lock-free concurrency safety under high reader load. Retained. |
| Direct Writer Zero-Copy Transitions | Transitions between dual-dispatch copying and single-consumer direct writing occurred seamlessly with zero hitching. | Optimizes memory bus utilization dynamically based on active client count. Retained. |
8. Decision
Retain the Linux multi-consumer concurrent capture architecture across Noisedeck Sync:
- Retain independent demand checking and dual-dispatch acceptance in
LinuxCameraSink::submitandLinuxCameraSink::submit_writteninnative/src/platform/linux/camera_sink.cpp. - Retain POSIX shared memory ring buffer integration in
native/include/sync/camera/frame_ring.hpp. - Retain multi-consumer concurrency and asymmetric disconnect qualification tests in
native/test/linux/camera_sink_test.cpp.
All qualification criteria for Priority 9 are satisfied. Priority 9 is marked complete. The research roadmap advances to Priority 10 (Cross-Platform Multi-Consumer Long-Session Soak and Resource Stability Qualification).
9. Limits
Empirical qualification was conducted on Linux Ubuntu 24.04 LTS (kernel 6.8, x86_64 and arm64) using the v4l2loopback virtual camera infrastructure and POSIX shared memory ring buffers in /dev/shm. Extended 30-minute cross-platform soak under concurrent load will be qualified under Priority 10.
10. Reproducibility
All test runs, raw metrics, and source configurations are archived in the flat report bundle. The test suite can be verified on Linux using: ctest --test-dir build -R sync_linux_camera_sink_tests --output-on-failure.
Evidence references
- [E1] Measurements bundle:
measurements.jsonand raw findings:findings.jsonin the published report archive. - [E2] Linux sink qualification tests:
native/test/linux/camera_sink_test.cpp. - [E3] Linux sink implementation:
native/src/platform/linux/camera_sink.cppand shared memory ring:native/include/sync/camera/frame_ring.hpp.