mirror of
https://github.com/openlibrecommunity/olcrtc.git
synced 2026-05-26 07:08:11 +00:00
refactor: split flat session.Config tunables into typed sections
session.Config used to spread 16 per-transport tuning fields across its top level (VideoWidth/Height/.../VP8FPS/.../SEIAckTimeoutMS). The flat layout meant every caller had to know which fields belong to which transport, and the YAML→session bridge in internal/config repeated the same name 32 times across Apply/ApplyProfile. Group them under VideoConfig/VP8Config/SEIConfig structs hung off session.Config. internal/config now does e.g. dst.Video.Width = pickInt(dst.Video.Width, f.Video.Width) instead of touching dst.VideoWidth. session.ApplyTransportDefaults, validateVideoChannel/VP8Channel/SEIChannel and buildTransportOptions read through cfg.Video.*/cfg.VP8.*/cfg.SEI.* in the same way. The YAML schema itself was already grouped (Video / VP8 / SEI sections); this commit lines session.Config up with it so the Apply functions can mirror the YAML structure 1:1 instead of unpacking it into 32 flat assignments. All session/config/e2e/cmd/main tests that referenced cfg.VideoX directly are updated to cfg.Video.X. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -161,8 +161,8 @@ func TestRunWithArgsAppliesTransportDefaults(t *testing.T) {
|
||||
oldRunSession := runSession
|
||||
t.Cleanup(func() { runSession = oldRunSession })
|
||||
runSession = func(_ context.Context, cfg session.Config) error {
|
||||
if cfg.VP8FPS != 25 || cfg.VP8BatchSize != 1 {
|
||||
t.Fatalf("VP8 defaults = fps %d batch %d, want 25/1", cfg.VP8FPS, cfg.VP8BatchSize)
|
||||
if cfg.VP8.FPS != 25 || cfg.VP8.BatchSize != 1 {
|
||||
t.Fatalf("VP8 defaults = fps %d batch %d, want 25/1", cfg.VP8.FPS, cfg.VP8.BatchSize)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -201,8 +201,8 @@ func TestRunWithArgsFailoverProfiles(t *testing.T) {
|
||||
var seen []string
|
||||
runSession = func(_ context.Context, cfg session.Config) error {
|
||||
seen = append(seen, cfg.Auth+"/"+cfg.Transport)
|
||||
if cfg.Auth == "wbstream" && (cfg.VP8FPS != 25 || cfg.VP8BatchSize != 1) {
|
||||
t.Fatalf("VP8 defaults = fps %d batch %d, want 25/1", cfg.VP8FPS, cfg.VP8BatchSize)
|
||||
if cfg.Auth == "wbstream" && (cfg.VP8.FPS != 25 || cfg.VP8.BatchSize != 1) {
|
||||
t.Fatalf("VP8 defaults = fps %d batch %d, want 25/1", cfg.VP8.FPS, cfg.VP8.BatchSize)
|
||||
}
|
||||
return errBoom
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user