-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
NewPipe doesn't properly shut down audio streams when playback is finished/interrupted #2373
Comments
Very interesting that should for sure be resolved. |
ExoPlayer 2.10. mitigates this issue. Not by recycling, but by reusing. |
Could this also explain why my headset's play button doesn't operate my music player anymore after playing a video? It starts an empty 'unknown' stream instead until I force music playback from the music player. |
Very possible. If your headset doesn't actively check to see which of the active streams are actually playing stuff and instead just takes the first available stream, it would likely lock itself into NewPipe's dead stream until you tell it to change. |
I just want to remind people that this is still a major problem, even in the latest release. Watching around half an hour's worth of videos in NewPipe can easily eat up 300MB of RAM in my own testing. And due to mediaserver's inability to cache active streams, as well as Android's own ZSWAP configuration that automatically uses up half the available RAM for swap space, this makes this a critical issue on devices with 2GB or less of total RAM. 30-60 minutes of videos can destroy a user's ability to run other apps on 1GB devices until rebooting, and 1-2 hours can do it for 2GB devices. |
Related: #2257 |
Issue #3425 from @ravilovSo I've had this issue for a long time where after using NP for a while and watching some number of videos NP would suddenly not load videos anymore. It would show the video page, it would load the comments, but in the video box on top it would just show the spinner and would sit like that infinitely. From that point on it would refuse to load any other videos as well, in exactly the same way (so it's not some weird issue with just that one video). The only solution would be to force-stop NP and restart. It would then work for a while and then refuse to load again. This issue happens so randomly and is quite hard to reproduce consistently so I just learned to live with it, restarting NP as necessary. Today though I found this in my
I'm hoping this might help eliminate this issue for good. Fingers crossed. |
Is it possible that this issue is also what causes NewPipe to start an empty audio playlist if a Bluetooth device sends the play command after NewPipe has been closed? |
What's the status of this issue? |
Still an issue as of v0.19.5 (the latest on F-Droid atm) Edit: Just want to add that at least in my opinion, it should ideally reuse the same stream for the entire playlist until playback is ended (which is already does), as well as for any subsequent streams played while that pop-up window is still open (which it doesn't) before closing out the stream when the window, pop-up or otherwise, is closed (which it also doesn't do). Similarly, if the user pauses playback, the stream should be remembered and reused if a new item is begun before the paused stream is closed out. And lastly, maybe merge audio-only and video playbacks into a single list and notification? Otherwise we'll run into complications with multiple open streams at once since it would require implementing a mixer inside NewPipe to keep things separate while still using the same mediaplayer stream. |
@Yowlen Could you test 0.20.0? |
@Redirion What say? Exoplayer issue? |
Hey @Stypox can you have a look at this commit which could help to fix this issue if I'm not wrong. 'Just player' is also based on exo player and this commit works perfectly to open and close audio sessions. |
@rawlife56 thank you! |
from what I see after reading the docs for AudioEffect, it just allows other applications to modify the session to add effects / change parameters. This way NewPipe could utilize system equalizer apps like the Cyanogenmod AudioFX. But I don't see how this has any effect on the opening or closure of the audio session itself. |
found a / the possible issue: we open the audio effect control session, but never close it. This has been in code since this commit f284a79 |
2017 👀 |
NewPipe ends up leaving open the streams when it's done using them. Even worse, NewPipe doesn't recycle old streams, causing a memory leak to form in Android's internal mediaserver over time, as it requires explicit commands to be given in order to free memory used by audio it plays. On low-RAM devices, this can cause problems if the user starts playing multiple videos.
Basically, the way I found this out is via an equalizer app that I use due to my sensitivity with certain frequencies:
https://play.google.com/store/apps/details?id=com.devdnua.equalizer.free
In this app, I was exploring the settings to make sure everything was just the way I want them, and I found the "View Active Audio Sessions" area. NewPipe had a ton in this list, despite no actively-playing videos at the time, so I began to investigate. The summary of my findings with NewPipe is as follows:
I should note a few other things, as well:
killall -9 mediaserver
as root in a terminal or something. This will kill all streams, including currently-playing ones, so if NewPipe is currently playing something and the terminal command is used, the audio will cut out and NewPipe will never be the wiser. Video will still play. However, it will be silent until NewPipe starts a new stream via one of the methods outlined above.The recommended solution is to have NewPipe close out each stream when it's done playing, as well as have it recycle streams when shutting down currently-playing items in favor of new ones. Also, audio and video currently use separate streams, so replacing them so that only one notification/stream or the other can exist at one time would also be helpful.
The text was updated successfully, but these errors were encountered: