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