rockcarry / fanplayer

A portable video player based on ffmpeg for windows and android platform.
GNU Lesser General Public License v3.0
605 stars 161 forks source link

android中,close之后,重新播放,闪退 #48

Open HelloTodayWolrd opened 3 years ago

HelloTodayWolrd commented 3 years ago

代码如下:

String url = "rtsp:\192.168.5.11\live" public void startPlay() { if(null != mPlayer) { mPlayer.pause(); mPlayer.close(); } mPlayer = new MediaPlayer(url, mHandler, initParam); mPlayer.play(); }

调用上面函数,多次调用就会大概率闪退。有办法解决么?

HelloTodayWolrd commented 3 years ago

错误信息: A/libc: Fatal signal 7 (SIGBUS), code 0 (SI_USER) in tid 32013 (Thread-45), pid 29135

HelloTodayWolrd commented 3 years ago

D/: [ZeroHung]ZrhungDoSendWithHievent: hievent send wp = 280, pid= 29135, tid = 31491 D/fanplayer: non-existing PPS 0 referenced non-existing PPS 0 referenced decode_slice_header error no frame! D/fanplayer: non-existing PPS 0 referenced non-existing PPS 0 referenced decode_slice_header error no frame! D/fanplayer: non-existing PPS 0 referenced non-existing PPS 0 referenced decode_slice_header error D/fanplayer: no frame! D/fanplayer: non-existing PPS 0 referenced non-existing PPS 0 referenced decode_slice_header error no frame! D/fanplayer: non-existing PPS 0 referenced D/fanplayer: non-existing PPS 0 referenced decode_slice_header error no frame! D/fanplayer: non-existing PPS 0 referenced non-existing PPS 0 referenced decode_slice_header error no frame! D/fanplayer: non-existing PPS 0 referenced D/fanplayer: non-existing PPS 0 referenced decode_slice_header error no frame! D/fanplayer: non-existing PPS 0 referenced non-existing PPS 0 referenced decode_slice_header error no frame! I/OMXClient: IOmx service obtained I/ACodec: In onAllocateComponent create compenent, codec name: OMX.hisi.video.decoder.avc I/ACodec: [OMX.hisi.video.decoder.avc] got color aspects (R:0(Unspecified), P:0(Unspecified), M:0(Unspecified), T:0(Unspecified)) err=0(NO_ERROR) I/ACodec: onStart I/ACodec: [OMX.hisi.video.decoder.avc] got color aspects (R:1(Full), P:1(BT709_5), M:1(BT709_5), T:3(SMPTE170M)) err=0(NO_ERROR) D/fanplayer: using android mediacodec hardware decoder h264_mediacodec ! I/AudioTrack-JNI: AudioTrack_setup for usage=1 content=2 flags=0x0x800 tags= W/AudioTrack: Use of stream types is deprecated for operations other than volume control See the documentation for what to use instead with android.media.AudioAttributes to qualify your playback use case V/PlayerBase: baseStart() piid=1079 D/android.media.AudioTrack: [HSM] AudioTrace play() uid: 10166, pid: 29135 E/BufferQueueProducer: [SurfaceTexture-0-29135-0]:1272: connect: already connected (cur=2 req=2) E/Surface: Surface::unlockAndPost failed, no locked buffer E/BufferQueueProducer: [SurfaceTexture-0-29135-0]:1272: connect: already connected (cur=2 req=2) E/Surface: Surface::unlockAndPost failed, no locked buffer E/BufferQueueProducer: [SurfaceTexture-0-29135-0]:1272: connect: already connected (cur=2 req=2) E/Surface: Surface::unlockAndPost failed, no locked buffer E/BufferQueueProducer: [SurfaceTexture-0-29135-0]:1272: connect: already connected (cur=2 req=2) W/AudioSystem: onAudioException error:-2103444121 sessionId:665 V/PlayerBase: baseStop() piid=1079 W/System: A resource failed to call release. V/PlayerBase: baseRelease() piid=1071 state=0 W/System: A resource failed to call release. A/libc: Fatal signal 7 (SIGBUS), code 0 (SI_USER) in tid 32013 (Thread-45), pid 29135 Disconnected from the target VM, address: 'localhost:22251', transport: 'socket'

HelloTodayWolrd commented 2 years ago

没人答,自问自答吧:surface被上一个player对象占用导致的,改下setDisplayTexture方法避免这个问题就好了

rockcarry commented 2 years ago

近期的代码在优化这个问题,vdev-android.cpp 里面做了修改。 你也可以 debug 下

HelloTodayWolrd commented 2 years ago

还有个问题是Windows下的,程序关闭的时候有时候会发生异常(后来发现播放的过程中调用player_close也是一样),调试发现d3d_release_and_create方法下的IDirect3DSurface9_Release(c->bkbuf ); 这一句引发的,把她注释掉就好了,不过不太理解,不知道作者是否知道原因。

rockcarry commented 2 years ago

v1.9.2 版本 release 了,针对反复打开关闭播放器较低概率出现崩溃的问题,做了优化。

jambestwick commented 2 years ago

ffmpeg 导致的bug 崩溃

07-09 09:50:35.299 452 520 I OMXClient: IOmx service obtained 07-09 09:50:35.299 458 458 I OMXMaster: makeComponentInstance(OMX.google.amrnb.decoder) in omx@1.0-service process 07-09 09:50:35.303 713 713 I Zygote : seccomp disabled by setenforce 0 07-09 09:50:35.306 548 565 W ActivityManager: Slow operation: 133ms so far, now at startProcess: returned from zygote! 07-09 09:50:35.306 548 565 W ActivityManager: Slow operation: 133ms so far, now at startProcess: done updating battery stats 07-09 09:50:35.306 548 565 W ActivityManager: Slow operation: 133ms so far, now at startProcess: building log message 07-09 09:50:35.306 548 565 I ActivityManager: Start proc 713:WebViewLoader-armeabi-v7a/1037 [android.webkit.WebViewLibraryLoader$RelroFileCreator] for 07-09 09:50:35.306 548 565 W ActivityManager: Slow operation: 133ms so far, now at startProcess: starting to update pids map 07-09 09:50:35.306 548 565 W ActivityManager: Slow operation: 133ms so far, now at startProcess: done updating pids map 07-09 09:50:35.306 548 565 W ActivityManager: Slow operation: 133ms so far, now at startProcess: asking zygote to start proc 07-09 09:50:35.311 548 548 I GnssLocationProvider: WakeLock acquired by sendMessage(INITIALIZE_HANDLER, 0, null)

String[] ffmpegCommand = new String[]{"-i", rtspUrl, "-acodec", "copy", "-vcodec", "copy", filePath};