androidx / androidx/media

OOM probably due to bad file

Open
#1,109 1 comment 0 reactions 1 assignee View on GitHub

@rohitjoins is already working on this.

Since Feb 24, 2024.

bug needs triage
Dominant language
Java
Stars
3k
Forks
955
Avg merge
12d 14h
Merged PRs (30d)
2

Description

Version

Media3 pre-release (alpha, beta or RC not in this list)

More version details

1.3 RC1

Devices that reproduce the issue

Not sure this is related to a specific device.
Last report on Crashlytics is "Motorola One Action" Android 11

Devices that do not reproduce the issue

No response

Reproducible in the demo app?

Not tested

Reproduction steps

I don't have one :( Probably triggered by some bad media.

Expected result

No crash or a way for the application to recover via standard ExoPlayer renderer errors.

Actual result

The app crash.

Fatal Exception: java.lang.OutOfMemoryError: Failed to allocate a 416356563 byte allocation with 8388608 free bytes and 83MB until OOM, target footprint 457338320, growth limit 536870912
       at dalvik.system.VMRuntime.newNonMovableArray(VMRuntime.java)
       at java.nio.DirectByteBuffer$MemoryRef.<init>(DirectByteBuffer.java:70)
       at java.nio.ByteBuffer.allocateDirect(ByteBuffer.java:258)
       at androidx.media3.decoder.DecoderInputBuffer.createReplacementByteBuffer(DecoderInputBuffer.java:241)
       at androidx.media3.decoder.DecoderInputBuffer.ensureSpaceForWrite(DecoderInputBuffer.java:195)
       at androidx.media3.exoplayer.source.SampleDataQueue.readSampleData(SampleDataQueue.java:292)
       at androidx.media3.exoplayer.source.SampleDataQueue.readToBuffer(SampleDataQueue.java:130)
       at androidx.media3.exoplayer.source.SampleQueue.read(SampleQueue.java:440)
       at androidx.media3.exoplayer.source.ProgressiveMediaPeriod.readData(ProgressiveMediaPeriod.java:499)
       at androidx.media3.exoplayer.source.ProgressiveMediaPeriod$SampleStreamImpl.readData(ProgressiveMediaPeriod.java:969)
       at androidx.media3.exoplayer.BaseRenderer.readSource(BaseRenderer.java:524)
       at androidx.media3.exoplayer.audio.DecoderAudioRenderer.feedInputBuffer(DecoderAudioRenderer.java:520)
       at androidx.media3.exoplayer.audio.DecoderAudioRenderer.render(DecoderAudioRenderer.java:325)
       at androidx.media3.exoplayer.ExoPlayerImplInternal.doSomeWork(ExoPlayerImplInternal.java:1102)
       at androidx.media3.exoplayer.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:541)
       at android.os.Handler.dispatchMessage(Handler.java:102)
       at android.os.Looper.loop(Looper.java:250)
       at android.os.HandlerThread.run(HandlerThread.java:67)

The important thing is the value : 416356563 byte, that's 416Mb to decode a sample, this obviously can't be allocated.

While the root cause generating the wrong value would be nice to reproduce if one user finally contact me, I think that such errors should be caught and return a decoder error and not crash the app.

Media

I do not have a reproduction file.

Bug Report
  • You will email the zip file produced by adb bugreport to android-media-github@google.com after filing this issue.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.