fca07bf669
Тесты:
- libcuframes/tests/test_packet_ring.c — 2 scenarios:
1) normal flow: 1 pub × 1 sub × 2000 packets, varied sizes, GOP=30,
payload integrity check (seq в первых 8 байтах + pattern). PTS
monotonicity, first KEY seq, нет data errors.
2) slow consumer (10ms delay): publisher 200 fps, subscriber должен
detect OVERRUN, library resync на keyframe — verify received >10
даже на сильно медленном консьюмере.
- libcuframes/tests/CMakeLists.txt: add_test packet_ring_basic.
Docs:
- CHANGELOG.md: новая [Unreleased] секция с full v0.2 highlights и
явно declared limitations (sub-stream, audio, codec change → v0.3).
- docs/integrations/frigate.md: новая секция "v0.2: dual-input (detect +
record через один RTSP)" с config example, requirements, trade-offs.
Связано: #2, PR #4. Step 6 (final) перед снятием draft.
5.1 KiB
5.1 KiB
Changelog
Все заметные изменения в этом проекте документируются в этом файле.
Формат основан на Keep a Changelog, проект следует Semantic Versioning.
[Unreleased] — v0.2 work in progress
См. PR #4.
Added
- Encoded packet ring — параллельный ring для H.264/H.265 NAL units
(отдельный SHM
/dev/shm/cuframes-<key>-packets, variable-length byte buffer + slot index, seqlock-style read для защиты от overrun). - Wire protocol v2 (
proto_version = 2в SHM header). Backward-compat: v2 publishers принимают v1 subscribers (frames-only). - Public C API (
include/cuframes/cuframes.h):cuframes_publisher_enable_packets(opts)— активирует ringcuframes_publisher_set_codec_extradata(data, size)— SPS/PPScuframes_publisher_publish_packet(data, size, pts, dts, flags)cuframes_subscriber_enable_packets()+_next_packet()+ accessorscuframes_subscriber_get_codec_params(codec_id, extradata, size)
cuframes::Publisher(C++ RAII):enable_packets,set_codec_extradata,publish_packetметоды.cuframes-rtsp-source: новый CLI flag--enable-packet-ring. ДублируетAVPacketв encoded ring до передачи декодеру.- FFmpeg demuxer
cuframes_packets://<key>(отдельная ветка gx/ffmpeg-patched PR #1). Companion кcuframes://. Use case: Frigaterecordrole без второго RTSP к камере. - 4 новых error codes:
PACKET_OVERSIZED,NO_PACKET_RING,NO_CODEC_PARAMS,PACKET_OVERRUN. - Stress test
libcuframes/tests/test_packet_ring.c: 2 scenarios — normal flow (1 pub × 1 sub × 2000 packets, integrity check) + slow consumer (must hit OVERRUN + library auto-resync на keyframe). - Protocol spec §10 в
docs/protocol.md(397 строк): byte-exact layout, seqlock semantics, late-subscriber GOP-aligned start.
Limitations (документировано)
- Sub-stream selection отложено в v0.3 (
<key>-substream-<N>naming). - Audio packets — v0.3 (тот же ring layout, codec_id = audio).
- Codec change mid-stream — требует publisher destroy+recreate.
[0.1.0] — 2026-05-17
Первый функциональный release с production deployment.
Added
libcuframes.so— main shared library:- Producer/consumer ring buffer в CUDA-памяти (через
cudaIpcGetMemHandle) - Cross-process sync через
cudaIpcEventHandle_t(NVIDIA Programming Guide §3.2.8) - Handshake protocol по Unix domain socket (
/run/cuframes/<key>.sock) - Shared metadata в POSIX SHM (
/dev/shm/cuframes-<key>) - Поддержка
EXTERNALownership (publisher передаёт свои pre-allocated CUDA pointers) - 32 одновременных subscriber'а на publisher (configurable bit-mask)
- Producer/consumer ring buffer в CUDA-памяти (через
cuframes.hpp— header-only C++17 RAII обёртка над C APIcuframes-rtsp-source— standalone tool: RTSP → libavformat decode (hwaccel CUDA) → cuframes IPC- FFmpeg input demuxer
cuframes://(out-of-tree patch для n7.1):--enable-libcuframesconfigure option- URL form
cuframes://<key>, опция-cuda_deviceи-connect_timeout - NV12 frame output через
cudaMemcpy2DAsyncGPU→host (v1 path, zero-copy в v2)
- CMake install rules для downstream проектов
- Docker runtime image (
gx/cuframes:0.1) — publisher + sub_count + libs - Integration guides:
docs/integration.md— общая интеграция с cctv-стeкомfilter/README.md— FFmpeg patch + smoke test
- Reference deployments:
- cctv-processor C++ через
CuframesSource(см. gx/cctv PR #19, #20) - Frigate 0.17.1 через patched FFmpeg (Frigate image rebuild — см.
gx/frigate:cuframes)
- cctv-processor C++ через
Tested
- Stress: 1 publisher × 4 consumer × 2000 frames @ 120 fps — 0 torn frames, 0 gaps
- E2E: реальная камера Dahua 192.168.88.98 (1920×1080 HEVC 25 fps) — 100/100 frames, 0 drops, avg_fps=25.03
- Production: 1 publisher обслуживает одновременно Frigate (detect) + cctv-backend (motion+grid+encode→RTSP→TV) на одном NVDEC, ~24h uptime
Limitations (документировано — см. docs/integration.md)
- Только NV12 frame format (v1)
- GPU→CPU copy в FFmpeg demuxer (zero-copy через
AVHWFramesContext— v0.2) - Cross-container CUDA IPC требует
ipc + pidnamespace share. Если consumer использует s6-overlay (как Frigate) — pid не shareable, нужны альтернативы. - Только Linux + NVIDIA GPU compute capability ≥ 7.5
[0.0.1] — 2026-05-14
Added
- Initial repository, LICENSE (LGPL-2.1+), README.md, CONTRIBUTING.md
- Design specification (docs/architecture.md)
- Prior art analysis