Replaces the broken anacrolix WebTorrent path with a custom WebRTC peer that the browser drives directly. Architecture matches plan/clever- weaving-dove.md (Fase 2 + 3 + 6 of the streaming pivot). - engine/wire: shared 12-byte binary frame format (Hello / RangeReq / RangeData / RangeEnd / Cancel / Ping / Pong / SeekHint). Roundtrip + oversized-frame rejection tests. - agent/signal_client: SSE consumer + POST sender for SDP/ICE relay through /api/internal/stream/signal/<id>; auto-reconnects. - engine/webrtc_stream: pion v4 PeerConnection + DataChannel pump. Reads file via os.ReadAt, chunks RangeData at 16 KiB, honours app- level backpressure with SetBufferedAmountLowThreshold. - cmd/daemon dispatcher learns mode webrtc_stream + new webrtcSessionRegistry tracks per-session cancel funcs for clean shutdown. - engine/probe + hwaccel + transcoder: foundation for Fase 2.5 (codec detection, NVENC/QSV/VAAPI/VideoToolbox autodetection, ffmpeg pipe wrapper to fragmented MP4). Integration into webrtc_stream still pending. - pion/webrtc/v4 promoted from indirect to direct dep. End-to-end against unarr-dev confirms a 122 MB 1080p H.264 / AAC MP4 plays in Chrome with the new pipeline.
34 lines
960 B
Go
34 lines
960 B
Go
package engine
|
|
|
|
import "testing"
|
|
|
|
func TestHWAccelFFmpegVideoCodec(t *testing.T) {
|
|
cases := []struct {
|
|
hw HWAccel
|
|
target string
|
|
want string
|
|
}{
|
|
{HWAccelNone, "h264", "libx264"},
|
|
{HWAccelNone, "hevc", "libx264"},
|
|
{HWAccelNVENC, "h264", "h264_nvenc"},
|
|
{HWAccelNVENC, "hevc", "hevc_nvenc"},
|
|
{HWAccelQSV, "h264", "h264_qsv"},
|
|
{HWAccelQSV, "hevc", "hevc_qsv"},
|
|
{HWAccelVAAPI, "h264", "h264_vaapi"},
|
|
{HWAccelVAAPI, "hevc", "hevc_vaapi"},
|
|
{HWAccelVideoToolbox, "h264", "h264_videotoolbox"},
|
|
{HWAccelVideoToolbox, "hevc", "hevc_videotoolbox"},
|
|
}
|
|
for _, tc := range cases {
|
|
if got := tc.hw.FFmpegVideoCodec(tc.target); got != tc.want {
|
|
t.Errorf("%s.FFmpegVideoCodec(%q) = %q want %q", tc.hw, tc.target, got, tc.want)
|
|
}
|
|
}
|
|
}
|
|
|
|
func TestDetectHWAccelEmptyPathReturnsNone(t *testing.T) {
|
|
ResetHWAccelCache()
|
|
if got := detectHWAccelFresh(t.Context(), ""); got != HWAccelNone {
|
|
t.Errorf("got %s, want %s", got, HWAccelNone)
|
|
}
|
|
}
|