martinbonnin / ExoPlayer

Apache License 2.0
22 stars 3 forks source link

OOPS, OutOfMemoryError #9

Closed crossle closed 10 years ago

crossle commented 10 years ago
                    E  java.lang.RuntimeException: An error occured while executing doInBackground()
                    E      at android.os.AsyncTask$3.done(AsyncTask.java:300)
                    E      at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355)
                    E      at java.util.concurrent.FutureTask.setException(FutureTask.java:222)
                    E      at java.util.concurrent.FutureTask.run(FutureTask.java:242)
                    E      at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
                    E      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
                    E      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
                    E      at java.lang.Thread.run(Thread.java:841)
                    E  Caused by: java.lang.OutOfMemoryError
                    E      at dalvik.system.VMRuntime.newNonMovableArray(Native Method)
                    E      at java.nio.MemoryBlock.allocate(MemoryBlock.java:125)
                    E      at java.nio.ByteBuffer.allocateDirect(ByteBuffer.java:72)
                    E      at com.google.android.exoplayer.hls.Packet.resizeSample(Packet.java:47)
                    E      at com.google.android.exoplayer.parser.ts.TSExtractor$PESHandler.handlePayload(TSExtractor.java:135)
                    E      at com.google.android.exoplayer.parser.ts.TSExtractor.readOnePacket(TSExtractor.java:393)
                    E      at com.google.android.exoplayer.parser.ts.TSExtractor.read(TSExtractor.java:403)
                    E      at com.google.android.exoplayer.parser.ts.TSExtractorWithParsers.read(TSExtractorWithParsers.java:37)
                    E      at com.google.android.exoplayer.hls.HLSSampleSource$ChunkTask.doInBackground(HLSSampleSource.java:615)
                    E      at com.google.android.exoplayer.hls.HLSSampleSource$ChunkTask.doInBackground(HLSSampleSource.java:1)
                    E      at android.os.AsyncTask$2.call(AsyncTask.java:288)
                    E      at java.util.concurrent.FutureTask.run(FutureTask.java:237)
                    E      ... 4 mor
martinbonnin commented 10 years ago

Thanks for the bug report but please give a bit more context. Ideally, I need:

Thanks,

crossle commented 10 years ago
  1. The lastest code hls branch
  2. Android 4.4 Galaxy nexus
  3. VOD not live
  4. Only once. about when playback 10 min
  5. Test link https://hls-shou-tv.storage.googleapis.com/539abf3e307861502f150000/53c2190b30786159c95f0200/source/index.m3u8
crossle commented 10 years ago
dalvikvm-heap  I  Clamp target GC heap from 67.821MB to 64.000MB
                    I  Forcing collection of SoftReferences for 77208-byte allocation
                    I  Clamp target GC heap from 67.813MB to 64.000MB
                    E  Out of memory on a 77208-byte allocation.
          dalvikvm  I  "AsyncTask #1" prio=5 tid=12 RUNNABLE
                    I    | group="main" sCount=0 dsCount=0 obj=0x41c16268 self=0x5d8a2e28
                    I    | sysTid=29879 nice=10 sched=0/0 cgrp=apps/bg_non_interactive handle=1569337984
                    I    | state=R schedstat=( 2973449649 5915435853 8588 ) utm=250 stm=46 core=1
                    I    at dalvik.system.VMRuntime.newNonMovableArray(Native Method)
                    I    at java.nio.MemoryBlock.allocate(MemoryBlock.java:125)
                    I    at java.nio.ByteBuffer.allocateDirect(ByteBuffer.java:72)
                    I    at com.google.android.exoplayer.hls.Packet.resizeSample(Packet.java:47)
                    I    at com.google.android.exoplayer.parser.ts.TSExtractor$PESHandler.handlePayload(TSExtractor.java:135)
                    I    at com.google.android.exoplayer.parser.ts.TSExtractor.readOnePacket(TSExtractor.java:393)
                    I    at com.google.android.exoplayer.parser.ts.TSExtractor.read(TSExtractor.java:403)
                    I    at com.google.android.exoplayer.parser.ts.TSExtractorWithParsers.read(TSExtractorWithParsers.java:37)
                    I    at com.google.android.exoplayer.hls.HLSSampleSource$ChunkTask.doInBackground(HLSSampleSource.java:615)
                    I    at com.google.android.exoplayer.hls.HLSSampleSource$ChunkTask.doInBackground(HLSSampleSource.java:1)
                    I    at android.os.AsyncTask$2.call(AsyncTask.java:288)
                    I    at java.util.concurrent.FutureTask.run(FutureTask.java:237)
                    I    at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
                    I    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
                    I    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
                    I    at java.lang.Thread.run(Thread.java:841)
crossle commented 10 years ago

I sure the memory have this problem.

martinbonnin commented 10 years ago

hi, I have just reworked a bit the memory management. In addition to consume less memory, you can now override the maxBufferSize value for your application using HLSSampleSource.setMaxBufferSize().