Skip to content

Commit 8b8cc81

Browse files
authored
Merge pull request #1 from josephnef/feat/multistream-tx
Multi-stream wfb_tx: per-stream FEC profiles, priority drain, waybeam SHM input (one process for all streams)
2 parents af6ba85 + 16da855 commit 8b8cc81

12 files changed

Lines changed: 2192 additions & 175 deletions

File tree

Changelog.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,23 @@
1+
fork: multi-stream wfb_tx (feat/multistream-tx)
2+
-----------------------------------------------
3+
- One `wfb_tx` process can now serve several streams via repeatable `-y` specs
4+
(`u=<udp_port>|shm=<ring>,p=<radio_port>[,k=][,n=][,T=][,F=][,mcs=][,bw=][,gi=][,stbc=][,ldpc=][,vht=][,nss=]`).
5+
Each stream gets its own FEC encoder, session key and radiotap header on the shared
6+
link_id, exactly as N separate processes would - but in one event loop. Without `-y`
7+
nothing changes.
8+
- Spec order is strict drain priority (first = highest): under radio saturation the
9+
socket buffers of later streams overflow first. Intended for layered video (e.g.
10+
SVC-T from OpenIPC waybeam_venc): the always-decodable base layer is stream 0 with
11+
strong FEC, droppable enhancement layers ride behind it with light FEC.
12+
- `shm=<ring_name>` stream input: attach to an OpenIPC waybeam_venc shared-memory
13+
packet ring (`/dev/shm/<ring_name>`, vendored `src/venc_ring.{h,c}`, MIT) for a
14+
syscall-free producer path. Survives producer respawn via epoch-based re-attach.
15+
- Per-stream runtime control: `wfb_tx_cmd <port> {set,get}_{fec,radio}_stream -r <radio_port> ...`
16+
(new control-port commands CMD_*_STREAM; legacy commands keep addressing the first
17+
stream). Unknown radio_port answers ENODEV.
18+
- Per-stream stdout stats: `PKT_S` / `TX_ANT_S` lines tagged with the radio_port, plus
19+
the legacy aggregate `PKT` / `TX_ANT` lines so existing stats parsers keep working.
20+
121
23.08 upcoming release
222
----------------------
323
- Mavlink parser speedup. Instead of using standard full-featured (and slow mavlink parser) now use fast packet splitter.

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ src/%.o: src/%.cpp src/*.hpp src/*.h
5151
wfb_rx: src/rx.o src/radiotap.o src/zfex.o src/wifibroadcast.o
5252
$(CXX) -o $@ $^ $(_LDFLAGS) -lpcap
5353

54-
wfb_tx: src/tx.o src/zfex.o src/wifibroadcast.o
55-
$(CXX) -o $@ $^ $(_LDFLAGS)
54+
wfb_tx: src/tx.o src/zfex.o src/wifibroadcast.o src/venc_ring.o
55+
$(CXX) -o $@ $^ $(_LDFLAGS) -pthread
5656

5757
fec_test: src/fec_test.cpp src/zfex.o
5858
$(CXX) $(_CFLAGS) -o $@ $^ $(LDFLAGS) $(shell pkg-config --libs catch2-with-main)

README.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,50 @@ Camera --[RTP stream (UDP)]--> wfb_ng --//--[ RADIO ]--//--> wfb_ng --[RTP strea
180180
! rtph264depay ! avdec_h264 ! clockoverlay valignment=bottom ! autovideosink fps-update-interval=1000 sync=false
181181
```
182182

183+
## Multi-stream wfb_tx (fork feature: per-stream FEC profiles in one process)
184+
185+
One `wfb_tx` can serve several streams, each with its own radio_port, FEC profile,
186+
session key and radiotap header — designed for unequal error protection of layered
187+
video (SVC-T from [OpenIPC waybeam_venc](https://github.com/OpenIPC/waybeam_venc)):
188+
the always-decodable base layer rides strong FEC, the droppable enhancement layer
189+
rides light FEC, and one process replaces N.
190+
191+
```
192+
wfb_tx -K drone.key -i 7669206 -C 7003 \
193+
-y "u=5600,p=0,k=8,n=12,T=15" \ # base video (priority 0 = drained first)
194+
-y "u=5605,p=1,k=8,n=9,T=15" \ # enhance video (sheds load first when saturated)
195+
wlan0
196+
```
197+
198+
Stream spec keys: `u=<udp_port>` or `shm=<waybeam venc_ring name>` (input, exactly one),
199+
`p=<radio_port>` (required, unique), `k`/`n`/`T`/`F` (FEC), `mcs`/`bw`/`gi`/`stbc`/`ldpc`/`vht`/`nss`
200+
(per-stream radiotap). Unset keys inherit the global options. Spec order is strict drain
201+
priority: ready inputs are serviced first-spec-first and drained fully, so under radio
202+
saturation the kernel socket buffers of later streams overflow first — by design. Note
203+
that a continuously saturating higher-priority stream can starve lower ones; order
204+
streams by importance (base > audio > enhance > telemetry).
205+
206+
`shm=<name>` attaches to a waybeam_venc shared-memory packet ring (`/dev/shm/<name>`,
207+
one complete RTP packet per slot — set waybeam's `outgoing.server` to `shm://<name>`
208+
and `outgoing.enhancePort` to get a second `<name>_enh` ring). The reader survives
209+
producer respawns (epoch-based re-attach). With debug mode (`-D port`), stream *i*
210+
emulates its wlans on ports `port + i*num_wlans + wlan_idx`.
211+
212+
Runtime per-stream control (e.g. closed-loop FEC adaptation of the enhancement layer):
213+
214+
```
215+
wfb_tx_cmd 7003 get_fec_stream -r 1
216+
wfb_tx_cmd 7003 set_fec_stream -r 1 -k 8 -n 10
217+
wfb_tx_cmd 7003 set_radio_stream -r 1 -M 2
218+
```
219+
220+
On the ground side run one `wfb_rx` per stream as usual (`-p 0`, `-p 1`, ...). For
221+
SVC-T both decoded outputs can feed the same decoder port — the streams share one
222+
RTP sequence space (see waybeam_venc `outgoing.enhancePort`). Stats: multi-stream
223+
mode emits per-stream `PKT_S`/`TX_ANT_S` stdout lines tagged with the radio_port in
224+
addition to the legacy aggregate `PKT`/`TX_ANT` lines, which existing parsers keep
225+
understanding unchanged. Without any `-y` option wfb_tx behaves exactly as upstream.
226+
183227
## HOWTO build:
184228

185229
For development (inline build)

fec_test

1.23 MB
Binary file not shown.

libsodium_test

1.23 MB
Binary file not shown.

0 commit comments

Comments
 (0)