mirror of
https://github.com/openlibrecommunity/olcrtc.git
synced 2026-05-26 07:08:11 +00:00
fix: make vp8-fps and vp8-batch flags required for vp8channel transport
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user