mirror of
https://github.com/hsnks100/liveflow.git
synced 2025-09-26 20:21:12 +08:00
@@ -4,5 +4,6 @@ port = 5555
|
||||
port = 1930
|
||||
[hls]
|
||||
port = 8044
|
||||
llhls = true
|
||||
[docker]
|
||||
mode = false
|
@@ -2,16 +2,25 @@ package config
|
||||
|
||||
// Struct to hold the configuration
|
||||
type Config struct {
|
||||
Whep ServerConfig `mapstructure:"whep"`
|
||||
RTMP ServerConfig `mapstructure:"rtmp"`
|
||||
HLS ServerConfig `mapstructure:"hls"`
|
||||
Whep Whep `mapstructure:"whep"`
|
||||
RTMP RTMP `mapstructure:"rtmp"`
|
||||
HLS HLS `mapstructure:"hls"`
|
||||
Docker DockerConfig `mapstructure:"docker"`
|
||||
}
|
||||
|
||||
type ServerConfig struct {
|
||||
type RTMP struct {
|
||||
Port int `mapstructure:"port"`
|
||||
}
|
||||
|
||||
type Whep struct {
|
||||
Port int `mapstructure:"port"`
|
||||
}
|
||||
|
||||
type HLS struct {
|
||||
Port int `mapstructure:"port"`
|
||||
LLHLS bool `mapstructure:"llhls"`
|
||||
}
|
||||
|
||||
type DockerConfig struct {
|
||||
Mode bool `mapstructure:"mode"`
|
||||
}
|
||||
|
1
main.go
1
main.go
@@ -73,6 +73,7 @@ func main() {
|
||||
Hub: hub,
|
||||
HLSHub: hlsHub,
|
||||
Port: conf.HLS.Port,
|
||||
LLHLS: conf.HLS.LLHLS,
|
||||
})
|
||||
err := hls.Start(ctx, source)
|
||||
if err != nil {
|
||||
|
@@ -36,12 +36,14 @@ type HLS struct {
|
||||
muxer *gohlslib.Muxer
|
||||
mpeg4AudioConfigBytes []byte
|
||||
mpeg4AudioConfig *aacparser.MPEG4AudioConfig
|
||||
llHLS bool
|
||||
}
|
||||
|
||||
type HLSArgs struct {
|
||||
Hub *hub.Hub
|
||||
HLSHub *hlshub.HLSHub
|
||||
Port int
|
||||
LLHLS bool
|
||||
}
|
||||
|
||||
func NewHLS(args HLSArgs) *HLS {
|
||||
@@ -49,6 +51,7 @@ func NewHLS(args HLSArgs) *HLS {
|
||||
hub: args.Hub,
|
||||
hlsHub: args.HLSHub,
|
||||
port: args.Port,
|
||||
llHLS: args.LLHLS,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -167,8 +170,7 @@ func (h *HLS) makeMuxer(extraData []byte) (*gohlslib.Muxer, error) {
|
||||
},
|
||||
AudioTrack: audioTrack,
|
||||
}
|
||||
llHLS := false
|
||||
if llHLS {
|
||||
if h.llHLS {
|
||||
muxer.Variant = gohlslib.MuxerVariantLowLatency
|
||||
muxer.PartDuration = 500 * time.Millisecond
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user