amzn / exoplayer-amazon-port

Official port of ExoPlayer for Amazon devices
Apache License 2.0
173 stars 80 forks source link

Native out of memory on playing 4k video on AFTMM #105

Open PratimMallick opened 4 years ago

PratimMallick commented 4 years ago

[REQUIRED] Issue description Player stops playing with out of memory in native while playing 4k content (DASH) on AFTMM firestick. This stream is encoded using h265, so it is using the hevc decoder. From the logs it looks like a native out of memory happened when GraphicBufferAllocator tried to allocate memory

2020-07-03 17:49:06.417 251-1527/? E/ion: ioctl c0144900 failed with code -1: Out of memory 2020-07-03 17:49:06.417 251-1527/? E/IMGSRV: :0: MTKGenericAlloc: Allocating memory via ion heap_id_mask=0x2000 size(15716480) failed (Out of memory) 2020-07-03 17:49:06.417 251-1527/? E/Gralloc1On0Adapter: gralloc0 allocation failed: -12 (Out of memory) 2020-07-03 17:49:06.417 251-1527/? E/GraphicBufferAllocator: Failed to allocate (3840 x 2176) format 2130706439 usage 16804147: 5 2020-07-03 17:49:06.418 251-1527/? D/GraphicBufferAllocator: Allocated buffers: 0xa74a9aa0: 8100.00 KiB | 1920 (1920) x 1080 | 1 | 0x00001a00 | FramebufferSurface 0xa74a9be0: 8100.00 KiB | 1920 (1920) x 1080 | 1 | 0x00001a00 | FramebufferSurface 0xa74a9d20: 8100.00 KiB | 1920 (1920) x 1080 | 1 | 0x00001a00 | FramebufferSurface 0xa74abf80: 8100.00 KiB | 1920 (1920) x 1080 | 1 | 0x00000b00 | com.google.android.exoplayer2.demo/com.google.android.exoplayer2.demo.PlayerActivity 0xa74ac020: unknown | 3840 (3840) x 1472 | 7F000007 | 0x01006933 | SurfaceView - com.google.android.exoplayer2.demo/com.google.android.exoplayer2.demo.PlayerActivity 0xa74ac700: 8100.00 KiB | 1920 (1920) x 1080 | 1 | 0x00000b00 | com.google.android.exoplayer2.demo/com.google.android.exoplayer2.demo.PlayerActivity 0xa7c8c000: unknown | 3840 (3840) x 2176 | 7F000007 | 0x01006933 | SurfaceView - com.google.android.exoplayer2.demo/com.google.android.exoplayer2.demo.PlayerActivity 0xa7c8c280: unknown | 3840 (3840) x 2176 | 7F000007 | 0x01006933 | SurfaceView 2020-07-03 17:49:06.418 251-1527/? E/BufferQueueProducer: [SurfaceView - com.google.android.exoplayer2.demo/com.google.android.exoplayer2.demo.PlayerActivity] dequeueBuffer: createGraphicBuffer failed 2020-07-03 17:49:06.418 30738-30889/com.google.android.exoplayer2.demo E/ACodec: dequeueBuffer failed: Out of memory (12) 2020-07-03 17:49:06.419 30738-30889/com.google.android.exoplayer2.demo E/ACodec: Failed to allocate output port buffers after port reconfiguration: (-12) 2020-07-03 17:49:06.419 30738-30889/com.google.android.exoplayer2.demo E/ACodec: signalError(omxError 0x80001001, internalError -12) 2020-07-03 17:49:06.419 30738-30888/com.google.android.exoplayer2.demo E/MediaCodec: Codec reported err 0xfffffff4, actionCode 0, while in state 6 2020-07-03 17:49:06.419 278-904/? D/MtkOmxVdecEx: [0xb37bb800] MtkOmxVdec::GetState (mState=OMX_StateExecuting) 2020-07-03 17:49:06.419 278-904/? D/MtkOmxVdecEx: [0xb37bb800] MtkOmxVdec::SendCommand cmd=OMX_CommandStateSet 2020-07-03 17:49:06.419 278-904/? E/MtkOmxVdecEx: [0xb37bb800] current status is MTK_OMX_OUT_PORT_ENABLE_PENDING, alloced output 4 total 10 2020-07-03 17:49:06.419 278-904/? E/MtkOmxVdecEx: [0xb37bb800] signal mOutPortAllocDoneSem (1) to cancel port enable reconfig. 2020-07-03 17:49:06.419 278-904/? D/MtkOmxVdecEx: [0xb37bb800] set MTK_OMX_VDEC_IDLE_PENDING 2020-07-03 17:49:06.420 278-904/? D/MtkOmxVdecEx: [0xb37bb800] MtkOmxVdec::GetState (mState=OMX_StateExecuting) 2020-07-03 17:49:06.420 278-30891/? D/MtkOmxVdecEx: [0xb37bb800] mPortReconfigInProgress as FALSE 2020-07-03 17:49:06.420 278-30891/? D/MtkOmxVdecEx: [0xb37bb800] # Got general command (OMX_CommandStateSet) 2020-07-03 17:49:06.420 278-30891/? D/MtkOmxVdecEx: [0xb37bb800] Request [OMX_StateExecuting]-> [OMX_StateIdle] 2020-07-03 17:49:06.420 278-30891/? D/MtkOmxVdecEx: [0xb37bb800] +FlushInputPort 2020-07-03 17:49:06.420 278-30891/? D/MtkOmxVdecEx: [0xb37bb800] --- ETBQ: mNumPendingInput 5; mEmptyThisBufQ.size() 5 2020-07-03 17:49:06.420 278-30897/? D/VDO_LOG: [h265_coreDecode] do core flush. 2020-07-03 17:49:06.420 278-30891/? I/PPFramework: flushAllBufQ 2020-07-03 17:49:06.420 30738-30888/com.google.android.exoplayer2.demo I/MediaCodecLogger: xxx.4K.secure.HW.video.hevc.DecoderErrorFatal = 1

[REQUIRED] Reproduction steps Play the 4k content using exo sample app. This issue only happens when switching between 2160p and 1440p. Happens sometimes while going from 1080p to 1440p layer too. Chances of getting this error increases when seek is done multiple times or incase of network fluctions. Either ways it looks like this issue comes when there is layer change. We get the following logs from the java layer

[REQUIRED] Link to test content Test content. Please use the below: "uri": "https://vod-1300670515.cos.ap-mumbai.myqcloud.com/hotstar_4k_test/testreel_0711/master.mpd", "drm_scheme": "widevine", "drm_license_url": "https://ipl.service.expressplay.com/hms/wv/rights/?ExpressPlayToken=BQAAABNlKb8AAAAAALDrHvw6eTXoSmBWBb5scoH90fHDb4jbIVUumrRVc7FSXRBZWjPT8eYWf5tozgL65ItF-e5O1nrMqeuoBa9OzKy3NEOxcohve7aWrkqD5ULWloUMIF6xA-ziJw7I6KKI0aJ62NMN1quYLsGll1S7eFfOvLXTg-jnhKIrr-lVbazziCDuJnkwwJaRfJRCpmbHRD06-RqJnYDp8fGdOrt7z7co8CxLzx9jX6Gm5fpcsC6RWmssVx9JZjq7-VvVaKKN6jDMxdDp"

[REQUIRED] A full bug report captured from the device https://drive.google.com/file/d/16XhL0FFtBXHm8ctgGFnou--tYtTXpJmg/view?usp=sharing

[REQUIRED] Version of ExoPlayer being used 2.11.3(latest)

[REQUIRED] Device(s) and version(s) of Android being used Reproducible easily on AFTMM firestick model . Android SDK version 25

baconz commented 3 years ago

For the record, this asset will reliably reproduce with the demo app on 2.15.1 using AFTSS running 7.2.4.2:

 {
    "name": "Philo",
    "samples": [
      {
        "name": "Unencrypted with drm_session_for_clear_content",
        "uri": "https://www.philo.com/storage/dev/seth/aftss/decrypted.mpd",
        "drm_scheme": "widevine",
        "drm_license_uri": "https://proxy.uat.widevine.com/proxy?provider=widevine_test",
        "drm_session_for_clear_content": true
      }
    ]
  }

If we do not initialize a DRM session, the asset will play through just fine.

alexandrubeu commented 1 year ago

I've got the same problem with 4k fireTV sticks gen 2018. Do you know if there is a solution?