streamd: preview quality picker, dashboard polish, C4 wrap keys
- Preview player can select FHD/HD/SD (or ABR master) from publish links - Embed dashboard screenshots in README; Linux streamd+agent setup guide - C4 Widevine wrap license mode + require --wvd; prefer Widevine PSSH - Channel 4 and My5 modules; streamd auth, variants, schedules, HLS gate
This commit is contained in:
parent
b3955bd81e
commit
066e018749
113 changed files with 19002 additions and 1541 deletions
57
apps/streamd/internal/db/settings_test.go
Normal file
57
apps/streamd/internal/db/settings_test.go
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
package db
|
||||
|
||||
import (
|
||||
"path/filepath"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestApplyCreateDefaultsFillsUnsetFields(t *testing.T) {
|
||||
s, err := Open(filepath.Join(t.TempDir(), "d"))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Cleanup(func() { _ = s.Close() })
|
||||
|
||||
if err := s.SetSettings(map[string]string{
|
||||
SettingOnDemand: "true",
|
||||
SettingIdleTimeoutS: "120",
|
||||
SettingDefaultOutputs: `[{"id":"hls","label":"HLS","format":"hls","enabled":true}]`,
|
||||
}); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
in := CreateStream{Name: "news"}
|
||||
s.ApplyCreateDefaults(&in)
|
||||
if in.OnDemand == nil || !*in.OnDemand {
|
||||
t.Fatalf("expected on_demand=true from settings, got %+v", in.OnDemand)
|
||||
}
|
||||
if in.IdleTimeoutS == nil || *in.IdleTimeoutS != 120 {
|
||||
t.Fatalf("expected idle_timeout_s=120, got %+v", in.IdleTimeoutS)
|
||||
}
|
||||
if in.OutputsJSON == "" {
|
||||
t.Fatal("expected default_outputs JSON to be copied")
|
||||
}
|
||||
}
|
||||
|
||||
func TestApplyCreateDefaultsDoesNotOverrideExplicit(t *testing.T) {
|
||||
s, err := Open(filepath.Join(t.TempDir(), "d"))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Cleanup(func() { _ = s.Close() })
|
||||
|
||||
_ = s.SetSettings(map[string]string{
|
||||
SettingOnDemand: "true",
|
||||
SettingIdleTimeoutS: "120",
|
||||
})
|
||||
off := false
|
||||
idle := 600
|
||||
in := CreateStream{Name: "news", OnDemand: &off, IdleTimeoutS: &idle}
|
||||
s.ApplyCreateDefaults(&in)
|
||||
if in.OnDemand == nil || *in.OnDemand {
|
||||
t.Fatal("explicit on_demand=false must win over settings")
|
||||
}
|
||||
if in.IdleTimeoutS == nil || *in.IdleTimeoutS != 600 {
|
||||
t.Fatal("explicit idle_timeout_s must win over settings")
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue