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

YT: Highly compressed audio when using mobile data and in background #8148

Open
5 tasks done
Mounster-Chef opened this issue Apr 4, 2022 · 4 comments
Open
5 tasks done
Labels
bug Issue is related to a bug player Issues related to any player (main, popup and background)

Comments

@Mounster-Chef
Copy link

Mounster-Chef commented Apr 4, 2022

Checklist

  • I am able to reproduce the bug with the latest version.
  • I made sure that there are no existing issues - open or closed - which I could contribute my information to.
  • I have taken the time to fill in all the required details. I understand that the bug report will be dismissed otherwise.
  • This issue contains only one bug.
  • I have read and understood the contribution guidelines.

Affected version

0.22.1

Steps to reproduce the bug

  1. Use mobile data (whether WiFi is enabled or not).
  2. Play any Youtube video in the background.

Expected behavior

The audio is the same when playing the video in the "foreground".

Actual behavior

The audio is compressed and has notable artefacts.

Screenshots/Screen recordings

No response

Logs

No response

Affected Android/Custom ROM version

Android 11 / Lineage 18.1

Affected device model

Sony Xperia XA2 Ultra

Additional information

This only happens when using data AND in background mode. If I play a video with mobile data the audio is fine. When using WiFi the audio is fine in both cases.
It happens regardless of the preferred audio format in the settings.
I have no data usage restrictions on this app.
It seems the audio is 48 kbps M4A or 50 kbps Opus, since I tried downloading something with those settings and it sounded just like that.
I've only observed this behaviour on Youtube videos.

@Mounster-Chef Mounster-Chef added the bug Issue is related to a bug label Apr 4, 2022
@opusforlife2 opusforlife2 added the player Issues related to any player (main, popup and background) label Apr 8, 2022
@opusforlife2
Copy link
Collaborator

Related: #1583

@n-ce

This comment was marked as spam.

@Mounster-Chef
Copy link
Author

After taking a look at the code, I now understand that if the resolution when on mobile data is limited at all, the most compact audio stream will be chosen. IMO this is a bad choice since, even if you set the limit to 1080p60, you will get the worst audio. Also, audio-only playback shouldn't be tied to the resolution limit, or at least not like how it is now.

Maybe ListHelper.getDefaultAudioFormat could be adapted to account for a new settings item for bitrate (that would change according to the default format)?
A simpler option is making it so getDefaultAudioFormat gets the most compact audio if the resolution limit is set at a certain resolution or lower, 480p would work well IMO, given that 720p is "HD".

I think I could do the first one, although I've never participated in such a big project and it's my first time seeing Android code 😅

@opusforlife2
Copy link
Collaborator

@Mounster-Chef Feel free to experiment with the code. If you happen to arrive at a proper implementation, this issue can be assigned to you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue is related to a bug player Issues related to any player (main, popup and background)
Projects
None yet
Development

No branches or pull requests

3 participants