Reputation: 912
I've managed to use SimpleExoPlayer to play HLS streams successfully and implemented a working way of selecting different playback speeds (1.25x, 1.5x, etc) by setting PlaybackParameters
on the player. But in some devices, when I select any playback speed different than 1x, the player starts to skip a lot of frames and audio becomes a little distorted.
On the ExoPlayer release notes of 2.6.0 it says that when the renderer can't keep the pace, they start displaying only key-frames, which I suspect is what is happening. But I've seen that using playback speed of 2x on YouTube app on the same smartphone works perfectly, so I wonder if there is anything I can do to improve the performance of the ExoPlayer renderer. Maybe I'm not using HW decoding when setting playback speed? Is there any configuration for that?
I'm currently using ExoPlayer version 2.6.1
. The objects I use are a SimpleExoPlayer
instance with a DefaultRenderersFactory
activating extensions (using EXTENSION_RENDERER_MODE_ON
) and a DefaultTrackSelector
. For media source, I'm using HlsMediaSource
with a locally created Handler
. If there is any other relevant information/code that I could provide to help understanding the context, please let me know.
Upvotes: 2
Views: 3245
Reputation: 912
When building the app on release
, the problem does not happen. This is due to optimizations on the JVM used by Sonic lib (an ExoPlayer dependency) being turned off when running the app on debug mode, according to andrewlewis
at a discussion on the project's github:
"The new implementation uses the Java version of Sonic, so its performance is affected by what optimizations the Java runtime applies. There is a certain optimization that is turned off on debuggable builds, which causes an inner loop in Sonic to be very slow. If you build a release APK this optimization should apply (on all API versions) and I found that performance was fine on various devices I tested, including a Samsung Galaxy S4 running Android 4.2.2 (API 17)." - andrewlewis
source: https://github.com/google/ExoPlayer/issues/26#issuecomment-296133260
API 24+ works fine on Debug and Release.
There is also a text about this on the ExoPlayer documentation here: https://google.github.io/ExoPlayer/faqs.html#why-doesnt-setplaybackparameters-work-properly-on-some-devices
Upvotes: 0