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

OutOfMemoryError {ExoPlayerImplInternal:Handler} #4221

Closed
srinivasstpl opened this issue May 8, 2018 · 6 comments
Closed

OutOfMemoryError {ExoPlayerImplInternal:Handler} #4221

srinivasstpl opened this issue May 8, 2018 · 6 comments
Assignees

Comments

@srinivasstpl
Copy link

Google Analytics reflects that one particular device Huawei DUK-L09 Honor 8 Pro keeps encountering this issue. Unfortunately, the only information I get regarding this is OutOfMemoryError {ExoPlayerImplInternal:Handler}

@tonihei
Copy link
Collaborator

tonihei commented May 8, 2018

This device seems to have 4 or 6 GB of RAM. So, it's definitely not a low-end device which may have issues buffering media with ExoPlayer. Note that the maximum we aim to keep in the buffer at the moment is around 16MB only.

Is there any other indication as to what may happen on this device? For example, do you know what media item the device was playing? Or whether your app may allocate memory for other reasons such that no memory is left for ExoPlayer?

@tonihei tonihei self-assigned this May 8, 2018
@srinivasstpl
Copy link
Author

Thanks for the prompt response, I am certainly considering the aspect wherein no memory is left for ExoPlayer. For the content that ExoPlayer is playing, it's an mp4 video. Is it possible that if the video resolution that's being supplied to ExoPlayer is far more than the device's screen resolution, this issue may occur?

@tonihei
Copy link
Collaborator

tonihei commented May 9, 2018

What video resolution are we talking about? By default, ExoPlayer tries to buffer at least 15 seconds worth of media (irrespective of the 16MB mentioned above). So for very high res videos, this may easily exceed 16 MB.
Not sure how easy you can test this, but there is an option in our DefaultLoadControl that lets you prefer the size threshold over the time threshold (i.e. set prioritizeTimeOverSizeThresholds=false). This would as far as possible prevent exceeding the the max buffer size in bytes even for high resolution videos.

An alternative explanation is that there are problems with bad interleaving in MP4 files (see #3481 or #3670). It's of course impossible to say without example media whether this is the problem here. We also recently pushed a workaround that should prevent this from happening for most cases (from ExoPlayer 2.7). Which version are you using?

@srinivasstpl
Copy link
Author

srinivasstpl commented May 18, 2018

Apologies for the delayed response, I finally received the stacktrace of the aforementioned issue in the Google Play Console:

java.lang.OutOfMemoryError: 
  at android.media.MediaCodec$BufferInfo.dup (MediaCodec.java:1544)
  at android.media.MediaCodec.dequeueOutputBuffer (MediaCodec.java:2649)
  at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.drainOutputBuffer (MediaCodecRenderer.java:1005)
  at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.render (MediaCodecRenderer.java:567)
  at com.google.android.exoplayer2.ExoPlayerImplInternal.doSomeWork (ExoPlayerImplInternal.java:518)
  at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage (ExoPlayerImplInternal.java:301)
  at android.os.Handler.dispatchMessage (Handler.java:104)
  at android.os.Looper.loop (Looper.java:166)
  at android.os.HandlerThread.run (HandlerThread.java:65)

I hope this can help diagnose the issue further.

@tonihei
Copy link
Collaborator

tonihei commented May 18, 2018

That's unfortunately not helpful for an OOM because the point where the system eventually is out of memory is most of the time independent from the cause of excessive memory usage.

To reproduce the issue, it would be helpful if

  • You can confirm it really only occurs for Huawei Honor 8 phones. That would speak for a device specific issue.
  • Provide us with an example of a media file which caused the OOM.

@tonihei
Copy link
Collaborator

tonihei commented Jun 21, 2018

Closing as we don't have any more info to go on. If you have additional information which would help to solve the issue, please reopen.

@tonihei tonihei closed this as completed Jun 21, 2018
@google google locked and limited conversation to collaborators Nov 23, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants