fix: make vp8-fps and vp8-batch flags required for vp8channel transport

This commit is contained in:
zarazaex69
2026-04-22 17:21:14 +03:00
parent 6379fa527e
commit 89505b7754
2 changed files with 13 additions and 8 deletions

View File

@@ -49,6 +49,10 @@ var (
ErrVideoBitrateRequired = errors.New("video bitrate required for videochannel (use -video-bitrate)")
ErrVideoHWRequired = errors.New("video hardware acceleration required for videochannel (use -video-hw none/nvenc)")
// VP8channel errors
ErrVP8FPSRequired = errors.New("vp8 fps required for vp8channel (use -vp8-fps)")
ErrVP8BatchSizeRequired = errors.New("vp8 batch size required for vp8channel (use -vp8-batch)")
// CNC errors
ErrSOCKSHostRequired = errors.New("socks host required for cnc mode (use -socks-host)")
ErrSOCKSPortRequired = errors.New("socks port required for cnc mode (use -socks-port)")
@@ -174,6 +178,15 @@ func Validate(cfg Config) error {
}
}
if cfg.Transport == "vp8channel" {
if cfg.VP8FPS == 0 {
return ErrVP8FPSRequired
}
if cfg.VP8BatchSize == 0 {
return ErrVP8BatchSizeRequired
}
}
if cfg.Mode == "cnc" {
if cfg.SOCKSHost == "" {
return ErrSOCKSHostRequired

View File

@@ -19,8 +19,6 @@ import (
const (
defaultMaxPayloadSize = 60 * 1024
defaultFPS = 25
defaultBatchSize = 1
defaultConnectTimeout = 30 * time.Second
dataMarker = 0xFF
rtpBufSize = 65536
@@ -87,13 +85,7 @@ func New(ctx context.Context, cfg transport.Config) (transport.Transport, error)
}
fps := cfg.VP8FPS
if fps <= 0 {
fps = defaultFPS
}
batchSize := cfg.VP8BatchSize
if batchSize <= 0 {
batchSize = defaultBatchSize
}
tr := &streamTransport{
stream: stream,