Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DSub can't play song when bitrate is set to "unlimited" #485

Closed
rholveck opened this issue Mar 20, 2024 · 4 comments
Closed

DSub can't play song when bitrate is set to "unlimited" #485

rholveck opened this issue Mar 20, 2024 · 4 comments
Labels

Comments

@rholveck
Copy link

gonic version: v0.16.3

Hi ! First of all : Great job with gonic, I've been using it since a few weeks and I love it :)

Playback isn't working anymore since 0.16.3 if one wants to play a raw file (=not transcoded) in DSub.

This issue has been introduced in This commit

To reproduce :

  • Do not enable any transcoding profile in gonic
  • Set bitrate to "unlimited" in DSub
  • Play any song in DSub

What happens :

When fetching a song while configured with unlimited bitrate, DSub sets the maxBitRate parameter to the original file actual bitrate. Example for a MP3 v0 file :

Mar 20 13:55:50 host.domain.tld gonic[3355641]: 2024/03/20 13:55:50 response 200 GET /stream?u=user&s=xxxxxxxxxxxxxx&v=1.2.0&c=DSub&id=tr-821&maxBitRate=275

This triggers the check made in the commit indicated above and results in this error :

subsonic error code 0: maxBitRate requested and no user transcode preferences found for user "user" and client "DSub"

I think the problem here is the order in which the checks are made in the section of code below : first "pref" is checked for a gonic transcoding profile and then the requested bitrate is compared to the actual file bitrate. In my understanding these check should be done the other way around so that the raw file is served as soon as the requested bitrate is higher than the raw file bitrate, no matter if a transcoding profile is configured or not in gonic.

	if pref == nil {
		if maxBitRate > 0 {
			return spec.NewError(0, "maxBitRate requested and no user transcode preferences found for user %q and client %q", user.Name, client)
		}
		log.Printf("serving raw file, no user transcode preferences found for user %q and client %q", user.Name, client)
		http.ServeFile(w, r, file.AbsPath())
		return nil
	}

	if maxBitRate >= audioFile.AudioBitrate() {
		log.Printf("serving raw file, requested max bitrate %d is greater or equal to %d", maxBitRate, audioFile.AudioBitrate())
		http.ServeFile(w, r, file.AbsPath())
		return nil
	}

Tell me what you think ! Have a great day :)

@khannurien
Copy link

khannurien commented Mar 20, 2024

Confirmed, I made the same observation. This is a problem since I have to disable transcoding totally in gonic's backend, otherwise tracks don't play back correctly in a web browser (cf. #452).

@sentriz
Copy link
Owner

sentriz commented Mar 20, 2024

ooops

@sentriz sentriz added the bug label Mar 20, 2024
sentriz added a commit that referenced this issue Mar 20, 2024
@sentriz
Copy link
Owner

sentriz commented Mar 20, 2024

thanks for reporting 👍

@rholveck
Copy link
Author

No problem, thanks for the quick fix :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants