pili-engineering / PLDroidPlayer

PLDroidPlayer 是七牛推出的一款免费的适用于 Android 平台的播放器 SDK,采用全自研的跨平台播放内核,拥有丰富的功能和优异的性能,可高度定制化和二次开发。
https://developer.qiniu.com/pili/sdk/1210/the-android-client-sdk
4.54k stars 953 forks source link

Intermittent crash on Budget devices (of MI, LeEco, Vivo ) on 3G and 2G #914

Open gouravd opened 6 years ago

gouravd commented 6 years ago

We are observing native crashes only on slower networks (like 3G and 2G connections) on Budget devices of MI, Vivo, LeEco mainly. When we replace with VideoView we don't see these crashes..

I can confirm its not related to a specific file..Here's what I observe

1) The pili most likely is trying and retrying to load/play audio and during this the native memory shoots from 100mb to 700 mb. Whenever it crashes LMK(LowMemoryKiller) is invoked and the native memory usage is in this surge..During this surge the app also frees for 1-2 secs

2) in Build 2.1.0 this surge persisted for longer. In 2.1.2..it decreased in next 5-7 secs...but many times before it can come down the LMK is invoked.

3) This is not observed in Moto phones as LMK does not get invoked even if the available memory is pretty low...but in these above mentioned devices..the LMK is much more aggressive and the issue manifests more frequently

The expectation is that the memory surge/leak should not happen and Pili should call one of the Error states and gracefully fail.

The videos are mostly H24 videos of range 640x480 with <1mbps bitrate and most 1 sec Keyframe interval.. Audio can be AAC-LC, AAC LD- AAC-ELD

03-28 11:09:53.824 9034 9800 V QPlayer : Audio track, nMinBufSize 12312 03-28 11:09:53.825 9034 9800 D AudioTrack: set(): streamType -1, sampleRate 44100, format 0x1, channelMask 0x1, frameCount 6156, flags #0, notificationFrames 0, sessionId 0, transferType 3, uid -1, pid -1 03-28 11:09:53.826 9034 9800 D AudioTrack: set() streamType -1 frameCount 6156 flags 0000 03-28 11:09:53.826 9034 9800 D AudioTrack: audiotrack 0x8eb6a400 set Type -1, rate 44100, fmt 1, chn 1, fcnt 6156, flags 0000 03-28 11:09:53.826 9034 9800 D AudioTrack: set: Create AudioTrackThread 03-28 11:09:53.830 9034 9800 D AudioSystem: getIoDescriptor: ioHandle = 2, index = 0, mIoDescriptors = 0xd5913f68 03-28 11:09:53.830 9034 9800 D AudioSystem: getIoDescriptor: ioHandle = 2, index = 0, mIoDescriptors = 0xd5913f68 03-28 11:09:53.830 9034 9800 D AudioSystem: getIoDescriptor: ioHandle = 2, index = 0, mIoDescriptors = 0xd5913f68 03-28 11:09:53.836 9034 9800 E IMemory : cannot map BpMemoryHeap (binder=0xc7c4f280), size=4194304, fd=193 (Out of memory) 03-28 11:09:53.836 9034 9800 E AudioTrack: Could not get control block 03-28 11:09:53.841 9034 9800 E AudioTrack-JNI: Error -19 initializing AudioTrack 03-28 11:09:53.841 9034 9800 D AudioTrack: ~audioTrack 0x8eb6a400 03-28 11:09:53.841 9034 9800 D AudioTrackCenter: removeTrack, trackPtr:0x8eb6a400 03-28 11:09:53.841 9034 9800 E android.media.AudioTrack: Error code -20 when initializing AudioTrack. 03-28 11:09:53.843 311 767 D DrmManager(Native): pid = 9034 03-28 11:09:53.843 311 767 D DrmManager(Native): pid_str = 9034 03-28 11:09:53.854 9034 9800 E art : JNI DETECTED ERROR IN APPLICATION: JNI NewByteArray called with pending exception java.lang.IllegalStateException: play() called on uninitialized AudioTrack. 03-28 11:09:53.854 9034 9800 E art : at void android.media.AudioTrack.play() (AudioTrack.java:1574) 03-28 11:09:53.854 9034 9800 E art : at int com.qiniu.qplayer.mediaEngine.MediaPlayer$a.a(int, int) (MediaPlayer.java:1418) 03-28 11:09:53.854 9034 9800 E art : at void com.qiniu.qplayer.mediaEngine.MediaPlayer.postEventFromNative(java.lang.Object, int, int, int, java.lang.Object) (MediaPlayer.java:955) 03-28 11:09:53.854 9034 9800 E art : in call to NewByteArray 03-28 11:09:53.854 9034 9800 E art : "Thread-743" prio=9 tid=52 Runnable 03-28 11:09:53.854 9034 9800 E art : | group="main" sCount=0 dsCount=0 obj=0x12de9220 self=0xcd7e4b00 03-28 11:09:53.854 9034 9800 E art : | sysTid=9800 nice=-6 cgrp=default sched=0/0 handle=0xd1a4b930 03-28 11:09:53.854 9034 9800 E art : | state=R schedstat=( 7173617 29048076 75 ) utm=0 stm=0 core=0 HZ=100 03-28 11:09:53.854 9034 9800 E art : | stack=0xd1a2d000-0xd1a2f000 stackSize=126KB 03-28 11:09:53.854 9034 9800 E art : | held mutexes= "mutator lock"(shared held) 03-28 11:09:53.854 9034 9800 E art : (no managed stack frames) 03-28 11:09:53.854 9034 9800 F art : art/runtime/java_vm_ext.cc:421] JNI DETECTED ERROR IN APPLICATION: JNI NewByteArray called with pending exception java.lang.IllegalStateException: play() called on uninitialized AudioTrack. 03-28 11:09:53.854 9034 9800 F art : art/runtime/java_vm_ext.cc:421] at void android.media.AudioTrack.play() (AudioTrack.java:1574) 03-28 11:09:53.854 9034 9800 F art : art/runtime/java_vm_ext.cc:421] at int com.qiniu.qplayer.mediaEngine.MediaPlayer$a.a(int, int) (MediaPlayer.java:1418) 03-28 11:09:53.854 9034 9800 F art : art/runtime/java_vm_ext.cc:421] at void com.qiniu.qplayer.mediaEngine.MediaPlayer.postEventFromNative(java.lang.Object, int, int, int, java.lang.Object) (MediaPlayer.java:955) 03-28 11:09:53.854 9034 9800 F art : art/runtime/java_vm_ext.cc:421] 03-28 11:09:53.854 9034 9800 F art : art/runtime/java_vm_ext.cc:421] in call to NewByteArray 03-28 11:09:53.854 9034 9800 F art : art/runtime/java_vm_ext.cc:421] "Thread-743" prio=9 tid=52 Runnable 03-28 11:09:53.854 9034 9800 F art : art/runtime/java_vm_ext.cc:421] | group="main" sCount=0 dsCount=0 obj=0x12de9220 self=0xcd7e4b00 03-28 11:09:53.854 9034 9800 F art : art/runtime/java_vm_ext.cc:421] | sysTid=9800 nice=-6 cgrp=default sched=0/0 handle=0xd1a4b930 03-28 11:09:53.854 9034 9800 F art : art/runtime/java_vm_ext.cc:421] | state=R schedstat=( 7173617 29048076 75 ) utm=0 stm=0 core=0 HZ=100 03-28 11:09:53.854 9034 9800 F art : art/runtime/java_vm_ext.cc:421] | stack=0xd1a2d000-0xd1a2f000 stackSize=126KB 03-28 11:09:53.854 9034 9800 F art : art/runtime/java_vm_ext.cc:421] | held mutexes= "mutator lock"(shared held) 03-28 11:09:53.854 9034 9800 F art : art/runtime/java_vm_ext.cc:421] (no managed stack frames) 03-28 11:09:53.854 9034 9800 F art : art/runtime/java_vm_ext.cc:421] 03-28 11:09:53.888 9034 9034 I @@@QCLOG: Info TF7498DE4 QCFuncLog L256 ----SetVolume Value is 00000000 start. 03-28 11:09:53.888 9034 9034 I @@@QCLOG: Info TF7498DE4 QCFuncLog L278 ----SetVolume leave! no return. Ussed Time: 0 03-28 11:09:53.902 311 767 D DrmManager(Native): pid = 9034 03-28 11:09:53.902 311 767 D DrmManager(Native): pid_str = 9034 03-28 11:09:53.924 9034 9034 I @@@QCLOG: Info TF7498DE4 QCFuncLog L256 ----SetVolume Value is 00000000 start. 03-28 11:09:53.924 9034 9034 I @@@QCLOG: Info TF7498DE4 QCFuncLog L278 ----SetVolume leave! no return. Ussed Time: 0

fengfutong commented 6 years ago

JNI DETECTED ERROR IN APPLICATION: JNI NewByteArray called with pending exception java.lang.IllegalStateException: play() called on uninitialized AudioTrack. 我也遇到了这个问题。不知道您解决了没有

gouravd commented 6 years ago

Is this solved in 2.1.4?...I see some similar issues fixed in 2.1.3