2

In our project we use Android exoPLayer version 2. But when we trying to play the live hls with unstable network connection(a lot of tcp drops) the player crashes with OOM. Before OOM player works with freezes.

Throwing OutOfMemoryError "Failed to allocate a 65548 byte allocation with 50824 free bytes and 49KB until OOM

2021-02-08 13:15:35.484 18315-20931/com.ertelecom.domrutvstb E/LoadTask: OutOfMemory error loading stream
    java.lang.OutOfMemoryError: Failed to allocate a 65548 byte allocation with 176 free bytes and 176B until OOM
        at com.google.android.exoplayer2.upstream.DefaultAllocator.allocate(DefaultAllocator.java:102)
        at com.google.android.exoplayer2.source.SampleQueue.preAppend(SampleQueue.java:703)
        at com.google.android.exoplayer2.source.SampleQueue.sampleData(SampleQueue.java:639)
        at com.google.android.exoplayer2.extractor.ts.MpegAudioReader.readFrameRemainder(MpegAudioReader.java:210)
        at com.google.android.exoplayer2.extractor.ts.MpegAudioReader.consume(MpegAudioReader.java:101)
        at com.google.android.exoplayer2.extractor.ts.PesReader.consume(PesReader.java:136)
        at com.google.android.exoplayer2.extractor.ts.TsExtractor.read(TsExtractor.java:339)
        at com.google.android.exoplayer2.source.ProgressiveMediaPeriod$ExtractingLoadable.load(ProgressiveMediaPeriod.java:987)
        at com.google.android.exoplayer2.upstream.Loader$LoadTask.run(Loader.java:391)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
        at java.lang.Thread.run(Thread.java:761)

For udp stream with unstable network connection all are ok. I guess it can be fixed by magic ExoPlayer initialization but I don't know how. Could you give advice how to setup Exoplayer to work on ustable network without OOM and freezes.

Roman Kazmin
  • 931
  • 6
  • 18
  • I may have the same problem. when i download video using `Downloading media` in https://exoplayer.dev/downloading-media.html but the proble is that when network connection gets disconnected app crashes with no specific pointer to where it should be solved. if you have found any solution plz let me know. – StackOverflower Jan 10 '23 at 11:12

0 Answers0