Add HomeKit stream testing via HAP snapshot
- Add worker_homekit.go with direct hap.Dial + GetImage flow - Bypass SRTP/Producer pipeline for homekit:// URLs - Route homekit:// streams to dedicated handler in worker.go
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"os/exec"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/AlexxIT/go2rtc/pkg/core"
|
||||
@@ -50,6 +51,11 @@ func RunWorkers(s *Session, urls []string) {
|
||||
func testURL(s *Session, rawURL string) {
|
||||
defer s.AddTested()
|
||||
|
||||
if strings.HasPrefix(rawURL, "homekit://") {
|
||||
testHomeKit(s, rawURL)
|
||||
return
|
||||
}
|
||||
|
||||
handler := GetHandler(rawURL)
|
||||
if handler == nil {
|
||||
return
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
package tester
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/AlexxIT/go2rtc/pkg/hap"
|
||||
)
|
||||
|
||||
// testHomeKit -- snapshot via HAP GetImage, bypasses SRTP/Producer flow
|
||||
func testHomeKit(s *Session, rawURL string) {
|
||||
start := time.Now()
|
||||
|
||||
conn, err := hap.Dial(rawURL)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
defer conn.Close()
|
||||
|
||||
jpeg, err := conn.GetImage(1920, 1080)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
latency := time.Since(start).Milliseconds()
|
||||
|
||||
r := &Result{
|
||||
Source: rawURL,
|
||||
Codecs: []string{"JPEG"},
|
||||
LatencyMs: latency,
|
||||
}
|
||||
|
||||
if len(jpeg) > 0 {
|
||||
idx := s.AddScreenshot(jpeg)
|
||||
r.Screenshot = fmt.Sprintf("api/test/screenshot?id=%s&i=%d", s.ID, idx)
|
||||
r.Width, r.Height = jpegSize(jpeg)
|
||||
}
|
||||
|
||||
s.AddResult(r)
|
||||
}
|
||||
Reference in New Issue
Block a user