mirror of https://github.com/jetkvm/kvm.git
Fix: audio subprocess handling
This commit is contained in:
parent
aeb7a12c72
commit
62d4ec2f89
|
@ -11,6 +11,7 @@ import (
|
|||
func main() {
|
||||
versionPtr := flag.Bool("version", false, "print version and exit")
|
||||
versionJsonPtr := flag.Bool("version-json", false, "print version as json and exit")
|
||||
audioServerPtr := flag.Bool("audio-server", false, "Run as audio server subprocess")
|
||||
flag.Parse()
|
||||
|
||||
if *versionPtr || *versionJsonPtr {
|
||||
|
@ -23,5 +24,5 @@ func main() {
|
|||
return
|
||||
}
|
||||
|
||||
kvm.Main()
|
||||
kvm.Main(*audioServerPtr)
|
||||
}
|
||||
|
|
9
main.go
9
main.go
|
@ -2,7 +2,6 @@ package kvm
|
|||
|
||||
import (
|
||||
"context"
|
||||
"flag"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"os"
|
||||
|
@ -113,12 +112,10 @@ func startAudioSubprocess() error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func Main() {
|
||||
// Initialize flag and channel
|
||||
flag.BoolVar(&isAudioServer, "audio-server", false, "Run as audio server subprocess")
|
||||
func Main(audioServer bool) {
|
||||
// Initialize channel and set audio server flag
|
||||
isAudioServer = audioServer
|
||||
audioProcessDone = make(chan struct{})
|
||||
|
||||
flag.Parse()
|
||||
|
||||
// If running as audio server, only initialize audio processing
|
||||
if isAudioServer {
|
||||
|
|
6
web.go
6
web.go
|
@ -223,7 +223,7 @@ func setupRouter() *gin.Engine {
|
|||
"bytes_processed": metrics.BytesProcessed,
|
||||
"last_frame_time": metrics.LastFrameTime,
|
||||
"connection_drops": metrics.ConnectionDrops,
|
||||
"average_latency": metrics.AverageLatency.String(),
|
||||
"average_latency": fmt.Sprintf("%.1fms", float64(metrics.AverageLatency.Nanoseconds())/1e6),
|
||||
})
|
||||
})
|
||||
|
||||
|
@ -410,7 +410,7 @@ func setupRouter() *gin.Engine {
|
|||
"bytes_processed": 0,
|
||||
"last_frame_time": "",
|
||||
"connection_drops": 0,
|
||||
"average_latency": "0s",
|
||||
"average_latency": "0.0ms",
|
||||
})
|
||||
return
|
||||
}
|
||||
|
@ -422,7 +422,7 @@ func setupRouter() *gin.Engine {
|
|||
"bytes_processed": metrics.BytesProcessed,
|
||||
"last_frame_time": metrics.LastFrameTime.Format("2006-01-02T15:04:05.000Z"),
|
||||
"connection_drops": metrics.ConnectionDrops,
|
||||
"average_latency": metrics.AverageLatency.String(),
|
||||
"average_latency": fmt.Sprintf("%.1fms", float64(metrics.AverageLatency.Nanoseconds())/1e6),
|
||||
})
|
||||
})
|
||||
|
||||
|
|
Loading…
Reference in New Issue