refactor(streaming): improve signal handling and remove unused components

This commit is contained in:
Deivid Soto 2026-05-08 12:39:07 +02:00
parent c5d4c4f3e3
commit 75df0e4308
9 changed files with 19 additions and 1056 deletions

View file

@ -455,11 +455,16 @@ func runDaemonStart() error {
// HLS registry and serve over HTTP; default ("" or "webrtc") runs
// the legacy DataChannel pipeline.
if strings.EqualFold(sess.Transport, "hls") {
if webrtcRegistry.has(sess.SessionID) {
return
}
tcRuntime := buildTranscodeRuntime(ctx, cfg)
if tcRuntime.FFmpegPath == "" || tcRuntime.FFprobePath == "" {
log.Printf("[hls %s] rejected: ffmpeg/ffprobe unavailable", agent.ShortID(sess.SessionID))
return
}
hlsCtx, hlsCancel := context.WithCancel(ctx)
webrtcRegistry.add(sess.SessionID, hlsCancel)
hlsCfg := engine.HLSSessionConfig{
SessionID: sess.SessionID,
SourcePath: filePath,
@ -468,8 +473,10 @@ func runDaemonStart() error {
AudioIndex: sess.AudioIndex,
Transcode: tcRuntime,
}
hsess, err := engine.StartHLSSession(ctx, hlsCfg)
hsess, err := engine.StartHLSSession(hlsCtx, hlsCfg)
if err != nil {
webrtcRegistry.remove(sess.SessionID)
hlsCancel()
log.Printf("[hls %s] start failed: %v", agent.ShortID(sess.SessionID), err)
return
}