mirror of
https://github.com/openlibrecommunity/olcrtc.git
synced 2026-05-30 17:09:43 +00:00
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>
36 lines
791 B
Go
36 lines
791 B
Go
package videochannel
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/openlibrecommunity/olcrtc/internal/transport"
|
|
)
|
|
|
|
// Options tunes the videochannel transport. Zero values fall back to documented defaults.
|
|
type Options struct {
|
|
Width int
|
|
Height int
|
|
FPS int
|
|
Bitrate string
|
|
HW string
|
|
QRSize int
|
|
QRRecovery string
|
|
Codec string
|
|
TileModule int
|
|
TileRS int
|
|
}
|
|
|
|
// TransportOptions marks Options as belonging to the transport options family.
|
|
func (Options) TransportOptions() {}
|
|
|
|
func optionsFrom(cfg transport.Config) (Options, error) {
|
|
if cfg.Options == nil {
|
|
return Options{}, nil
|
|
}
|
|
opts, ok := cfg.Options.(Options)
|
|
if !ok {
|
|
return Options{}, fmt.Errorf("%w: videochannel: got %T", transport.ErrOptionsTypeMismatch, cfg.Options)
|
|
}
|
|
return opts, nil
|
|
}
|