ffmpeg: use one command to stream video/audio

This commit is contained in:
Artem
2024-11-05 18:49:21 +01:00
parent f10e2da534
commit 1f5a56cc5d
8 changed files with 100 additions and 258 deletions

View File

@@ -21,7 +21,6 @@ func Api(e *gin.Engine) {
api := e.Group("/api").Use(middleware.CheckToken())
api.GET("/stream/mjpeg", stream.MjpegHandler)
api.GET("/stream/audio", stream.AudioHandler)
api.GET("/ws", ws.ConnHandler)
api.POST("/stream/webrtc", stream.WebRTCPeerConnect)

View File

@@ -5,6 +5,7 @@ import (
"rkkvm/http/hw/stream"
"rkkvm/http/middleware"
"rkkvm/http/reqrsp"
"time"
"github.com/gin-gonic/gin"
log "github.com/sirupsen/logrus"
@@ -70,7 +71,12 @@ func SetScreen(c *gin.Context) {
})
return
}
log.Debug("Stopping ffmpeg SetScreen")
ffmpeg.Stop()
time.Sleep(100 * time.Millisecond)
ffmpeg.ApplyOptions()
log.Debug("Starting ffmpeg SetScreen")
ffmpeg.Start()
log.Debugf("update screen: %+v", req)