Skip to content

🎧 Your Personal Streaming Service

fix: add 'opus' to the container aliases for improved direct play detection

Deluan844dffa2f1f4
diff --git a/core/transcode/aliases.go b/core/transcode/aliases.go
index 67a641511..0c9bfcb44 100644
--- a/core/transcode/aliases.go
+++ b/core/transcode/aliases.go
@@ -10,7 +10,7 @@ var containerAliasGroups = func() map[string]string {
groups := [][]string{
{"aac", "adts", "m4a", "mp4", "m4b", "m4p"},
{"mpeg", "mp3", "mp2"},
- {"ogg", "oga"},
+ {"ogg", "oga", "opus"},
{"aif", "aiff"},
{"asf", "wma"},
{"mpc", "mpp"},
diff --git a/core/transcode/decider_test.go b/core/transcode/decider_test.go
index 280060fbf..cc9b5fb60 100644
--- a/core/transcode/decider_test.go
+++ b/core/transcode/decider_test.go
@@ -129,6 +129,18 @@ var _ = Describe("Decider", func() {
Expect(decision.CanDirectPlay).To(BeTrue())
})
+ It("handles container aliases (opus -> ogg)", func() {
+ mf := withProbe(&model.MediaFile{ID: "1", Suffix: "opus", Codec: "Opus", BitRate: 165, Channels: 2, SampleRate: 48000})
+ ci := &ClientInfo{
+ DirectPlayProfiles: []DirectPlayProfile{
+ {Containers: []string{"ogg"}, AudioCodecs: []string{"opus"}, Protocols: []string{ProtocolHTTP}},
+ },
+ }
+ decision, err := svc.MakeDecision(ctx, mf, ci, DecisionOptions{})
+ Expect(err).ToNot(HaveOccurred())
+ Expect(decision.CanDirectPlay).To(BeTrue())
+ })
+
It("handles codec aliases (adts -> aac)", func() {
mf := withProbe(&model.MediaFile{ID: "1", Suffix: "m4a", Codec: "AAC", BitRate: 256, Channels: 2})
ci := &ClientInfo{