feat(stream)!: retire WebRTC, HLS-only, bump 0.9.4
Drops the custom WebRTC DataChannel pipeline + pion deps + WSS signaling client + wire framing. Every in-browser playback now uses HLS over HTTP from the daemon (Tailscale/LAN/UPnP). Browser P2P never re-enabled. Wire renames (incompatible with web < 2026-05-26): agent.WebRTCSession => agent.StreamSession, SyncResponse.WebRTCSessions (JSON: webrtcSessions) => StreamSessions (JSON: streamSessions). MIN_AGENT_VERSION is bumped to 0.9.4 on the web side so older agents see an upgrade card. Also fixes the libx264 'VBV bitrate > level limit' abort by clamping the encoder bitrate to the effective output height instead of the requested label (carried over from the prior 0.9.3 unreleased work). The seed_file vertical (mode=seed_file handler + engine.SeedFile) was retired with the in-browser P2P player. [downloads.webrtc] config block deleted; existing TOML files with the section still parse fine.
This commit is contained in:
parent
9176e877eb
commit
ca7de23a56
33 changed files with 207 additions and 2854 deletions
|
|
@ -1,106 +0,0 @@
|
|||
package cmd
|
||||
|
||||
import (
|
||||
"context"
|
||||
"log"
|
||||
"sync"
|
||||
|
||||
"github.com/torrentclaw/unarr/internal/config"
|
||||
"github.com/torrentclaw/unarr/internal/engine"
|
||||
"github.com/torrentclaw/unarr/internal/library/mediainfo"
|
||||
)
|
||||
|
||||
// webrtcRegistry tracks per-session cancel funcs for active custom WebRTC
|
||||
// streams (engine.RunWebRTCStream goroutines). Each session lives only as
|
||||
// long as its DataChannel; the registry exists so duplicate sync responses
|
||||
// don't double-spawn the same session and so daemon shutdown can drain.
|
||||
var webrtcRegistry = &webrtcSessionRegistry{
|
||||
cancels: make(map[string]context.CancelFunc),
|
||||
}
|
||||
|
||||
type webrtcSessionRegistry struct {
|
||||
mu sync.Mutex
|
||||
cancels map[string]context.CancelFunc
|
||||
}
|
||||
|
||||
func (r *webrtcSessionRegistry) has(sessionID string) bool {
|
||||
r.mu.Lock()
|
||||
defer r.mu.Unlock()
|
||||
_, ok := r.cancels[sessionID]
|
||||
return ok
|
||||
}
|
||||
|
||||
func (r *webrtcSessionRegistry) add(sessionID string, cancel context.CancelFunc) {
|
||||
r.mu.Lock()
|
||||
defer r.mu.Unlock()
|
||||
r.cancels[sessionID] = cancel
|
||||
}
|
||||
|
||||
func (r *webrtcSessionRegistry) remove(sessionID string) {
|
||||
r.mu.Lock()
|
||||
defer r.mu.Unlock()
|
||||
delete(r.cancels, sessionID)
|
||||
}
|
||||
|
||||
// cancelAllWebRTCSessions cancels every running session. Called on daemon
|
||||
// shutdown so pion peers and SSE consumers exit cleanly.
|
||||
func cancelAllWebRTCSessions() {
|
||||
webrtcRegistry.mu.Lock()
|
||||
cancels := make([]context.CancelFunc, 0, len(webrtcRegistry.cancels))
|
||||
for _, c := range webrtcRegistry.cancels {
|
||||
cancels = append(cancels, c)
|
||||
}
|
||||
webrtcRegistry.cancels = make(map[string]context.CancelFunc)
|
||||
webrtcRegistry.mu.Unlock()
|
||||
for _, c := range cancels {
|
||||
c()
|
||||
}
|
||||
}
|
||||
|
||||
// stdLogger is a tiny adapter so engine.RunWebRTCStream can log through the
|
||||
// standard library logger without pulling in a logging dependency.
|
||||
type stdLogger struct{}
|
||||
|
||||
func (stdLogger) Infof(format string, args ...any) { log.Printf(format, args...) }
|
||||
func (stdLogger) Warnf(format string, args ...any) { log.Printf("WARN: "+format, args...) }
|
||||
func (stdLogger) Errorf(format string, args ...any) { log.Printf("ERROR: "+format, args...) }
|
||||
|
||||
// buildTranscodeRuntime resolves the ffmpeg/ffprobe binaries + config knobs
|
||||
// for the WebRTC streaming pipeline. Failure to resolve a binary returns a
|
||||
// runtime with empty paths so engine.RunWebRTCStream falls back to
|
||||
// passthrough — the user gets a clearer codec error from the browser than a
|
||||
// daemon-side abort.
|
||||
func buildTranscodeRuntime(ctx context.Context, cfg config.Config) engine.TranscodeRuntime {
|
||||
if !cfg.Download.Transcode.Enabled {
|
||||
return engine.TranscodeRuntime{Disabled: true}
|
||||
}
|
||||
ffmpegPath, errF := mediainfo.ResolveFFmpeg(cfg.Library.FFmpegPath)
|
||||
ffprobePath, errP := mediainfo.ResolveFFprobe(cfg.Library.FFprobePath)
|
||||
if errF != nil || errP != nil {
|
||||
return engine.TranscodeRuntime{Disabled: true}
|
||||
}
|
||||
hw := engine.HWAccelNone
|
||||
switch cfg.Download.Transcode.HWAccel {
|
||||
case "auto":
|
||||
hw = engine.DetectHWAccel(ctx, ffmpegPath)
|
||||
case "nvenc":
|
||||
hw = engine.HWAccelNVENC
|
||||
case "qsv":
|
||||
hw = engine.HWAccelQSV
|
||||
case "vaapi":
|
||||
hw = engine.HWAccelVAAPI
|
||||
case "videotoolbox":
|
||||
hw = engine.HWAccelVideoToolbox
|
||||
case "none", "":
|
||||
hw = engine.HWAccelNone
|
||||
}
|
||||
return engine.TranscodeRuntime{
|
||||
FFmpegPath: ffmpegPath,
|
||||
FFprobePath: ffprobePath,
|
||||
HWAccel: hw,
|
||||
Preset: cfg.Download.Transcode.Preset,
|
||||
VideoBitrate: cfg.Download.Transcode.VideoBitrate,
|
||||
AudioBitrate: cfg.Download.Transcode.AudioBitrate,
|
||||
MaxHeight: cfg.Download.Transcode.MaxHeight,
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue