Commit Graph

56 Commits

Author SHA1 Message Date
zarazaex69
80cc3bafe4 chore(lint): satisfy golangci-lint after big refactor
Address 25 issues reported by golangci-lint following the structural
refactor:

- cyclop: split common.Reassembler.Push into upsert/storeChunk/deliver
  helpers (12→5). Move seichannel option-default fill into Options.
  withDefaults so New stays under the limit.
- exhaustive: enumerate ResultPartial / ResultIgnore explicitly in
  seichannel and videochannel switches over common.Result.
- gosec G115: annotate the test-fixture int→uint16/uint32 conversions
  in common_test.go with //nolint:gosec.
- lll: break up the 130+ character one-liners in transport
  unit/integration tests and the videochannel track-ID construction.
- nolintlint: drop the stale //nolint:cyclop in mobile_test.go where
  the underlying complexity already cleared the limit.
- wrapcheck: wrap errors returned from internal/framing and
  internal/runtime in their public callers (handshake, control,
  server.setupCipher, client.setupCipher) so they carry the layer name.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-16 14:38:03 +03:00
zarazaex69
4639e0b3b7 refactor: extract shared transport framing helpers into internal/transport/common
videochannel, seichannel and vp8channel each carried independent copies of
randomID(), fragmentPayload(), inboundMessage + upsertInbound +
assembleMessage + ackWaiters/ackMu. The reassembly logic was almost
byte-identical across videochannel and seichannel; vp8channel only needed
randomID. Three copies of the same idea.

Add internal/transport/common with:
- RandomID(): 8-char hex per-peer ID (Jitsi msid uniqueness requirement).
- FragmentPayload(): split bytes into max-size chunks.
- Reassembler: stores in-flight messages keyed by Seq, validates CRC, and
  reports Partial / Delivered / Duplicate / Ignore via a Result enum.
- AckRegistry: Register/Unregister/Resolve for ack waiters.

videochannel and seichannel now hold *common.AckRegistry and
*common.Reassembler instead of raw maps + mutexes. Their Send paths route
through acks.Register/Unregister; their handleInboundFrame is a 20-line
switch over reassembler.Push. vp8channel keeps its KCP framing but reuses
common.RandomID.

Tests that constructed raw streamTransport with inbound/delivered/ackWaiters
maps are updated to instantiate the new common types instead. Two now-
redundant low-level tests (upsertInbound out-of-range, assembleMessage)
collapse into the new TestInboundRejectsBadCRC.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-16 14:16:43 +03:00
zarazaex69
a083dfc5f3 refactor: collapse carrier layer into engine
internal/carrier and internal/carrier/builtin sat between transports and
engines, wrapping every engine.Session in carrier.Session +
engineByteStream/engineVideoTrack adapters that mechanically proxied every
method. That layer existed solely to translate Capabilities/AddTrack names;
no behaviour lived above engine.

Replace with internal/engine/builtin: a name-keyed registry that calls
auth.Issue and engine.New directly. Transports look up engine.Session via
enginebuiltin.Open, then type-assert engine.VideoTrackCapable for video
transports. A small per-transport engineVideoSession adapter unifies the
reconnect callback signature (engine uses func(*webrtc.DataChannel); the
transports want func()).

Updates:
- internal/engine/builtin/builtin.go: new Register/Open registry + auth
  pass-through ("none") + auth-driven factories for jazz/telemost/wbstream/jitsi.
- internal/transport/datachannel/transport.go: uses engine.Session directly
  via Capabilities().ByteStream check.
- internal/transport/{seichannel,videochannel,vp8channel}: each gains an
  engineVideoSession adapter and routes Connect/Send/Close/AddTrack through
  the engine session.
- internal/app/session: imports enginebuiltin; carrier.Available() →
  enginebuiltin.Available().
- pkg/olcrtc/olcrtc.go: switches to enginebuiltin.RegisterDefaults.
- internal/carrier and internal/carrier/builtin: deleted.
- Tests rewritten to register a fakeEngineSession (implements engine.Session
  + engine.VideoTrackCapable) through enginebuiltin.Register. The e2e
  memoryStream gains the same dual interface so memorySession is gone.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-16 14:07:44 +03:00
zarazaex69
74fb1d81b7 refactor: introduce typed per-transport options
transport.Config used to carry a flat union of video+vp8+sei tuning fields
that every transport ignored except its own. Replace with an opaque
transport.Options marker interface and per-transport Options structs
(videochannel.Options, vp8channel.Options, seichannel.Options). Datachannel
keeps an unset Options.

link.Config gains TransportOptions and drops the 16 transport-specific
fields. server.Config and client.Config follow suit. session.Config is
left untouched in this commit — buildTransportOptions packs its existing
flat fields into the typed Options bundle before calling server/client
(session.Config is rebuilt in a later commit when YAML config moves to
typed sections).

Tests that synthesized link/server/client/transport configs are updated
to pass typed Options bundles. The shared e2eTransportOptions helper
replaces three copies of the flat field bundle in e2e/tunnel_test.go.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-16 07:01:07 +03:00
zarazaex69
a636236523 refactor(videochannel): simplify frame decoding logic 2026-05-16 05:01:41 +03:00
zarazaex69
6633c1ef8a fix: isolate videochannel peers in shared rooms 2026-05-16 04:55:25 +03:00
zarazaex69
5e0a89a78d Revert "fix(transport): isolate peer frames by channel id"
This reverts commit 75e2674f48.
2026-05-15 23:09:24 +03:00
zarazaex69
a9512d2488 Revert "fix(transport): pin peer channel after validation"
This reverts commit 7f9351dad6.
2026-05-15 23:09:24 +03:00
zarazaex69
7f9351dad6 fix(transport): pin peer channel after validation 2026-05-15 22:53:58 +03:00
zarazaex69
75e2674f48 fix(transport): isolate peer frames by channel id 2026-05-15 22:47:32 +03:00
zarazaex69
6536249f72 feat: add randomID function to generate unique track and stream IDs 2026-05-15 22:00:45 +03:00
zarazaex69
dc1fe0f19c refactor: replace -carrier with -auth/-engine/-url/-token (stage E)
Break CLI backwards compatibility as planned for refactor/universal-carrier:

- Drop -carrier flag; add -auth (auth provider name), -engine (engine
  name for -auth none), -url and -token (SFU endpoint + access token for
  direct/none auth mode).
- session.Config.Carrier → Auth + Engine + URL + Token.
- session.Gen() is now generic: auth.Get(cfg.Auth).(auth.RoomCreator)
  replaces the hard-coded switch on carrier names.
- Register a "none" carrier in builtin (registerDirect) that bypasses
  auth and connects directly to any engine with caller-supplied URL+Token.
- auth/telemost.Provider.Issue now accepts a raw room-ID hash in addition
  to a full https://telemost.yandex.ru/j/<id> URL.
- Plumb Engine/URL/Token from session.Config through server.Run,
  client.Run/RunWithReady, bringUpLink, link.Config, transport.Config, and
  carrier.Config so the "none" carrier has access to them end-to-end.
- Update all tests and mobile.go call sites.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-11 13:31:07 +03:00
zarazaex69
e25eed39a9 Merge remote-tracking branch 'origin/master' into pr-47-merge
# Conflicts:
#	cmd/olcrtc/main.go
#	internal/transport/videochannel/ffmpeg.go
2026-05-11 02:30:16 +03:00
zarazaex69
0723ddf2f5 fix: golangci errors 2026-05-11 02:21:41 +03:00
spkprsnts
b7e758c283 perf(ffmpeg): reduce VPx encoding latency 2026-05-11 03:49:57 +05:00
spkprsnts
ba3d622233 feat(ffmpeg): Add -ffmpeg flag for custom path
- Add -ffmpeg flag for custom path
- Allow FFMPEG_BIN env var to set path
- Update ffmpeg
2026-05-11 03:31:14 +05:00
zarazaex69
bdc13024f4 feat: update gr 2026-05-10 23:02:33 +03:00
zarazaex69
f6b82da099 feat: remove nolint 2026-05-10 23:02:00 +03:00
zarazaex69
66b3d21592 upd: submodule 2026-05-10 21:30:22 +03:00
zarazaex69
8637f076f5 feat: use compact render 2026-05-10 20:13:03 +03:00
zarazaex69
7271f0532f fear(gr): update submodule 2026-05-10 20:13:03 +03:00
zarazaex69
f8d8bf326e chore: update videochannel submodule to latest revision 2026-05-07 18:20:11 +03:00
zarazaex69
87a546605c fix: golangci 2026-05-07 16:36:30 +03:00
zarazaex69
9c992d6fe4 refactor: remove legacy code 2026-05-07 14:28:32 +03:00
zarazaex69
9d8f063ce3 feat(test): up test coverage 2026-05-07 00:06:28 +03:00
zarazaex69
aa49808e68 feat(test): init base test 2026-05-06 22:33:29 +03:00
zarazaex69
a4e6079148 fix: golangci 2026-05-03 10:24:18 +03:00
zarazaex69
dd606ddfb2 fix: fix all golangci errors 2026-05-03 06:10:48 +03:00
zarazaex69
21d46e478b refactor: remove debug logging and unused queue monitor 2026-05-02 14:56:33 +03:00
zarazaex69
86b92d4fc5 feat(videochannel): cache idle frame to avoid re-encoding 2026-04-30 12:24:00 +03:00
zarazaex69
2c8edeeef0 feat(thread): make 1 ffmpg tread 2026-04-30 08:29:54 +03:00
zarazaex69
bf454145ba feat(lcm): implement strict lifecycle management for both encoders and
decoders
2026-04-30 08:14:05 +03:00
zarazaex69
b4408715bb upd 2026-04-30 07:36:35 +03:00
zarazaex69
92462878d7 chore: update gr submodule (add reedsolomon for tile) 2026-04-30 07:02:07 +03:00
zarazaex69
ad7c9a5c3e feat: add tile as videochannel visual codec via -video-codec tile 2026-04-30 06:55:34 +03:00
zarazaex69
f11cf6baef refactor: remove "b" codec support 2026-04-30 05:09:07 +03:00
zarazaex69
8ee1855ba3 chore: update videochannel/gr submodule 2026-04-30 05:01:40 +03:00
zarazaex69
e742a789b9 chore: update gr submodule and replace qr dependencies 2026-04-30 04:56:45 +03:00
zarazaex69
5f66d764b5 refactor(videochannel): replace qr libs with grqr codec 2026-04-30 04:56:33 +03:00
zarazaex69
d4de7a1d1c chore: add gr submodule for videochannel transport 2026-04-30 04:50:29 +03:00
zarazaex69
9c7b4e316f refactor(videochannel): remove b codec 2026-04-30 01:55:17 +03:00
zarazaex69
e848bde8de fix(videochannel): reduce QR code quiet zone from 10 to 2 2026-04-30 01:26:51 +03:00
zarazaex69
689441a7f4 Add configurable QR error correction level for video transpor 2026-04-27 18:53:39 +03:00
zarazaex69
98ad27bec5 Add configurable B codec parameters 2026-04-27 06:11:25 +03:00
zarazaex69
f1f5a584f5 Remove debug logging from handleFrame 2026-04-27 04:01:54 +03:00
zarazaex69
e4aeb3ac28 Add white frame detection and debug frame capture 2026-04-27 03:59:39 +03:00
zarazaex69
12d22770b4 feat(log): Log frame length and codec in handleFrame, and B codec decode
failures in visual_b.go
2026-04-26 22:53:49 +03:00
zarazaex69
fe13ba28e3 feat(b): Add support for RGBA frame format in B visual codec 2026-04-25 21:22:13 +03:00
zarazaex69
a2d1b95ffa feat: add support for 'b' visual codec in videochannel 2026-04-22 21:26:50 +03:00
zarazaex69
af34cdbd8e feat: add video-qr-size configuration for videochannel transport 2026-04-21 22:32:01 +03:00