-
Notifications
You must be signed in to change notification settings - Fork 6k
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
.ogg is stuttering when play #8891
Comments
I am not an audio compression/codec expert but this sounds unrelated to ExoPlayer and more related to the device's audio decoder. I tried playing a few the ogg files in the repo that you linked but I did not observe any audio stuttering. Some ideas:
|
Yes, I'm using the MediaPlayer is this PoC and it's working.
I'm trying to generate this file but I can't because I have to export in eight channels. Do you have any idea how to do it? I did more tests and noticed that Xiaomi Mi9, Galaxy A50 and Moto G9 power has this problem. In this PoC has more .ogg files without the instrument "Reco Reco" and if you play works fine .You can test this. |
At this point, I assume there's something wrong with the platform's decoder on this specific devices, and I'd advise to try ExoPlayer with the ffmpeg extension so that the player uses ffmpeg for decoding the audio files. @krocard any other thoughts/recommendations on this issue? |
Playing your POC and our demo app with the android emulator (pixel 3XL), I could hear audio underruns.
On low end devices like the emulator, the decoder has a very hard time decoding fast enough for real time playback. It barely manages it, but with a lot of variability. Some frames take sometime a very long time to decode, which starves the audioTrack, leading to an audible underrun. The reason that MediaPlayer is not (as) affected compared to AudioTrack is that it uses an audio buffer twice as big. This can easily be observed by doubling ExoPlayer/library/core/src/main/java/com/google/android/exoplayer2/audio/DefaultAudioSink.java Lines 256 to 257 in bd54394
|
I would recommend lowering the bitrate of the audio file played. 8 channel 1.9kb/s is an extremely low compression ratio (only ~35%). I guess the highest quality setting of libvorbis was used to encode them. Halving the bitrate should provide ample enough quality for playback. |
We did the maximum compression of the audio file and it works on Xiaomi and Galaxy A50, but it doesn't work on Moto G (9) Power. |
Hello, @krocard. Can you help with the previous question? I updated the poc with test compression audios for analysis. |
What bitrate are the audio file now? Underrun can have many causes, it is possible that the Moto G has an other issue. Passing a custom buffer size to the
I would recommend using method 2 to validating that increasing the buffer size does indeed solve you issue. |
We did the way 1 and didn't work. Do you have any suggest? |
Can you share your change? Additionally, I would still recommend trying option 2 if you have access to the device first as it is a quick way to make sure increasing the buffer indeed fixes your issue. |
I updated the project https://github.com/rbattaglin25/poc_exoplayer.git with these changes. You can help us trying option 2, we don't know how to make this. |
Option 2 is copying
I looked at the option 1, there are several issues: https://github.com/rbattaglin25/poc_exoplayer/blob/9b5698875fb5df831908c3f483115697a4872d2f/app/src/main/java/com/ebatuque/poc_ebatuque_android/AudioServiceExoPlayer.java#L63 You should not call Next the buffer size passed to
Though this solution 1 is fragile, it will break in passthrough. |
Thinking more about it, given that we want ExoPlayer to be a seamless upgrade over MediaPlayer, and that customizing the BufferSize requires expert knowledge as well fragile code. I believe we should align ExoPlayer to MediaPlayer. |
The plan is now to allow ExoPlayer users to customize the calculation of the AudioTrack buffer size. I will report the exact API went it is merged. |
Move the code in its own class as DefaultAudioTrack is getting very big. It also help for testability. The new class is easily configurable and highly tested. Manual test was used to catch any regression. google/ExoPlayer#8891 PiperOrigin-RevId: 415268938
*** Original commit *** Make audio track min buffer size configurable. Move the code in its own class as DefaultAudioTrack is getting very big. It also help for testability. The new class is easily configurable and highly tested. Manual test was used to catch any regression. google/ExoPlayer#8891 *** PiperOrigin-RevId: 415469179
Move the code in its own class as DefaultAudioTrack is getting very big. It also help for testability. The new class is easily configurable and highly tested. Manual test was used to catch any regression. #8891 PiperOrigin-RevId: 415268938
*** Original commit *** Make audio track min buffer size configurable. Move the code in its own class as DefaultAudioTrack is getting very big. It also help for testability. The new class is easily configurable and highly tested. Manual test was used to catch any regression. #8891 *** PiperOrigin-RevId: 415469179
Move the code in its own class as DefaultAudioTrack is getting very big. It also help for testability. The new class is easily configurable and highly tested. Manual test was used to catch any regression. google/ExoPlayer#8891 PiperOrigin-RevId: 424602011
Move the code in its own class as DefaultAudioTrack is getting very big. It also help for testability. The new class is easily configurable and highly tested. Manual test was used to catch any regression. #8891 PiperOrigin-RevId: 424602011
The size of the audio track buffer is now configurable. Setting the min buffer duration to 500ms as should allow to have the same underrun behaviour as MediaPlayer. Lines 71 to 74 in a308c69
|
We noticed when the file .ogg contains the instrument "Reco Reco" the audio is stuttering in some specific devices. For example, Samsung Galaxy Tab S3 with SDK 28.
https://github.com/rbattaglin25/poc_exoplayer.git
Here is a small project using exoplayer that has this problem.
The text was updated successfully, but these errors were encountered: