refactored config and room setup

This commit is contained in:
David Zhao
2020-10-15 00:04:16 -07:00
parent 32af882b99
commit 40c7d902d8
10 changed files with 386 additions and 71 deletions
+31 -12
View File
@@ -6,28 +6,47 @@ import (
)
type Config struct {
APIPort uint32 `yaml:"api_port"`
RTCPort uint32 `yaml:"rtc_port"`
UDPRangeStart uint32 `yaml:"udp_range_start"`
UDPRangeEnd uint32 `yaml:"udp_range_end"`
APIPort uint32 `yaml:"api_port"`
RTCPort uint32 `yaml:"rtc_port"`
RTC RTCConfig `yaml:"rtc"`
// multi-node configuration,
MultiNode bool `yaml:"multi_node"`
Development bool `yaml:"development"`
}
// STUN
StunServers []string `yaml:"stun_servers"`
type RTCConfig struct {
ICEPortRangeStart uint32 `yaml:"port_range_start"`
ICEPortRangeEnd uint32 `yaml:"port_range_end"`
StunServers []string `yaml:"stun_servers"`
MaxBandwidth uint64 `yaml:"max_bandwidth"`
MaxNackTime int64 `yaml:"max_nack_time"`
Video WebRTCVideoConfig `yaml:"video"`
}
type WebRTCVideoConfig struct {
REMBFeedback bool `yaml:"remb_feedback"`
REMBCycle int `yaml:"remb_cycle"`
PLICycle int `yaml:"pli_cycle"`
TCCCycle int `yaml:"tcc_cycle"`
MaxBufferTime int `yaml:"max_buffer_time"`
}
func NewConfig(confString string) (*Config, error) {
// start with defaults
conf := &Config{
APIPort: 7880,
RTCPort: 7881,
UDPRangeStart: 10000,
UDPRangeEnd: 11000,
StunServers: []string{
"stun.l.google.com:19302",
APIPort: 7880,
RTCPort: 7881,
RTC: RTCConfig{
ICEPortRangeStart: 8000,
ICEPortRangeEnd: 10000,
StunServers: []string{
"stun.l.google.com:19302",
},
Video: WebRTCVideoConfig{
REMBFeedback: true,
},
},
}
if confString != "" {