fix: forcing transcoding when client does not specify transcoding options (#3455)

* fix: wip

Signed-off-by: Deluan <deluan@navidrome.org>

* fix: revert #3227

It is not respecting the server configured transcoding for the player

Signed-off-by: Deluan <deluan@navidrome.org>

---------

Signed-off-by: Deluan <deluan@navidrome.org>
This commit is contained in:
Deluan Quintão 2024-11-05 20:39:05 -05:00 committed by GitHub
parent 6ff7ab52f4
commit 6c6223f2f9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 49 additions and 57 deletions

View file

@ -122,10 +122,11 @@ var _ = Describe("MediaStreamer", func() {
Expect(bitRate).To(Equal(0))
})
})
Context("player has maxBitRate configured", func() {
BeforeEach(func() {
t := model.Transcoding{ID: "oga1", TargetFormat: "oga", DefaultBitRate: 96}
p := model.Player{ID: "player1", TranscodingId: t.ID, MaxBitRate: 80}
p := model.Player{ID: "player1", TranscodingId: t.ID, MaxBitRate: 192}
ctx = request.WithTranscoding(ctx, t)
ctx = request.WithPlayer(ctx, p)
})
@ -140,7 +141,7 @@ var _ = Describe("MediaStreamer", func() {
mf.BitRate = 1000
format, bitRate := selectTranscodingOptions(ctx, ds, mf, "", 0)
Expect(format).To(Equal("oga"))
Expect(bitRate).To(Equal(80))
Expect(bitRate).To(Equal(192))
})
It("returns requested format", func() {
mf.Suffix = "flac"
@ -152,9 +153,9 @@ var _ = Describe("MediaStreamer", func() {
It("returns requested bitrate", func() {
mf.Suffix = "flac"
mf.BitRate = 1000
format, bitRate := selectTranscodingOptions(ctx, ds, mf, "", 80)
format, bitRate := selectTranscodingOptions(ctx, ds, mf, "", 160)
Expect(format).To(Equal("oga"))
Expect(bitRate).To(Equal(80))
Expect(bitRate).To(Equal(160))
})
})
})