google / ExoPlayer

This project is deprecated and stale. The latest ExoPlayer code is available in https://github.com/androidx/media
https://developer.android.com/media/media3/exoplayer
Apache License 2.0
21.7k stars 6.02k forks source link

SimpleExoPlayer.release() in onPause() block the UI thread #8159

Closed zhanghq666 closed 3 years ago

zhanghq666 commented 3 years ago

[REQUIRED] Issue description

SimpleExoPlayer.release() in onPause() block the UI thread, and after that, even I restart my app, player is not work any more unless reboot my device.

[REQUIRED] Reproduction steps

My situation is that I receive file and write to local file system by RandomAccessFile, I will call SimpleExoPlayer to playback my local file after wrote enough bytes. Until now, the playback is ok, but when play complete and exit the player activity, SimpleExoPlayer.release() in activity's onPause() will block, I can see CodeC error in logcat.

[REQUIRED] Link to test content

Local file.

[REQUIRED] A full bug report captured from the device

I have get a bugreport file but I donot know how to attach a file in github issue. Here is the logcat info: 2020-11-04 10:24:00.232 10524-10524/com.candy.capture D/ExoPlayerActivity: onIsLoadingChanged isLoading:false 2020-11-04 10:24:00.354 10524-10864/com.candy.capture I/MediaCodec: (0x7425c58c00) Decoder: mInputBufCnt = 60 fps, mOutputBufCnt = 60 fps, mRenderFrameCnt = 60 fps 2020-11-04 10:24:00.692 10524-10868/com.candy.capture I/BufferQueueProducer: [SurfaceTexture-0-10524-0](this:0x739cda8800,id:0,api:3,p:10524,c:10524) queueBuffer: slot 4 is dropped, handle=0x74183547c0 2020-11-04 10:24:01.213 10524-10868/com.candy.capture I/BufferQueueProducer: [SurfaceTexture-0-10524-0](this:0x739cda8800,id:0,api:3,p:10524,c:10524) queueBuffer: slot 0 is dropped, handle=0x7418353dc0 2020-11-04 10:24:01.356 10524-10864/com.candy.capture I/MediaCodec: (0x7425c58c00) Decoder: mInputBufCnt = 61 fps, mOutputBufCnt = 61 fps, mRenderFrameCnt = 61 fps 2020-11-04 10:24:01.663 10524-10868/com.candy.capture I/BufferQueueProducer: [SurfaceTexture-0-10524-0](this:0x739cda8800,id:0,api:3,p:10524,c:10524) queueBuffer: slot 4 is dropped, handle=0x74183547c0 2020-11-04 10:24:02.358 10524-10864/com.candy.capture I/MediaCodec: (0x7425c58c00) Decoder: mInputBufCnt = 60 fps, mOutputBufCnt = 60 fps, mRenderFrameCnt = 60 fps 2020-11-04 10:24:03.967 10524-10864/com.candy.capture D/AudioTrack: stop(24): 0x7425d09400, prior state:STATE_ACTIVE 2020-11-04 10:24:03.967 10524-10864/com.candy.capture D/AudioTrack: stop(24): called with 1503232 frames delivered 2020-11-04 10:24:03.967 10524-10864/com.candy.capture D/AudioTrack: stop(24): 0x7425d09400 stop done 2020-11-04 10:24:04.147 10524-10524/com.candy.capture D/ExoPlayerActivity: onPause 2020-11-04 10:24:04.148 10524-10524/com.candy.capture D/ExoPlayerActivity: onPlaybackStateChanged 1 2020-11-04 10:24:04.148 10524-10864/com.candy.capture I/MediaCodec: Video flush() 2020-11-04 10:24:04.148 10524-10524/com.candy.capture D/ExoPlayerActivity: onIsPlayingChanged isPlaying:false 2020-11-04 10:24:04.148 10524-10524/com.candy.capture I/ExoPlayerImpl: Release eba836b [ExoPlayerLib/2.12.1] [PACM00, PACM00, OPPO, 29] [goog.exo.core] 2020-11-04 10:24:07.148 10524-10868/com.candy.capture E/ACodec: signalError(omxError 0x80001001, internalError -110) 2020-11-04 10:24:07.148 10524-10868/com.candy.capture D/IAtlas: IAtlas::init CallingPid 10524 2020-11-04 10:24:07.149 10524-10867/com.candy.capture E/MediaCodec: Codec reported err 0xffffff92, actionCode 0, while in state 7 2020-11-04 10:24:07.149 10524-10868/com.candy.capture D/IAtlas: IAtlas::init this 0x7421716350 2020-11-04 10:24:07.151 10524-10867/com.candy.capture D/SurfaceUtils: disconnecting from surface 0x73a5306010, reason disconnectFromSurface 2020-11-04 10:24:07.151 10524-10867/com.candy.capture D/Surface: Surface::disconnect(this=0x73a5306000,api=3) 2020-11-04 10:24:07.151 10524-10867/com.candy.capture I/BufferQueueProducer: [SurfaceTexture-0-10524-0](this:0x739cda8800,id:0,api:3,p:10524,c:10524) disconnect(P): api 3 2020-11-04 10:24:07.151 10524-10695/com.candy.capture D/RefBase: RefBase: Explicit destruction, weak count = 0 (in 0x73c87dcc28) 2020-11-04 10:24:07.151 10524-10695/com.candy.capture W/RefBase: CallStack::getCurrentInternal not linked, returning null 2020-11-04 10:24:07.151 10524-10695/com.candy.capture W/RefBase: CallStack::logStackInternal not linked 2020-11-04 10:24:07.151 10524-10695/com.candy.capture I/GPUAUX: [AUX]~GPUAUXContext:77: destory: 0x73c8bdfad0 2020-11-04 10:24:07.153 10524-10695/com.candy.capture D/RefBase: RefBase: Explicit destruction, weak count = 0 (in 0x73c85a8d28) 2020-11-04 10:24:07.153 10524-10695/com.candy.capture W/RefBase: CallStack::getCurrentInternal not linked, returning null 2020-11-04 10:24:07.153 10524-10695/com.candy.capture W/RefBase: CallStack::logStackInternal not linked 2020-11-04 10:24:07.153 10524-10695/com.candy.capture I/GPUAUX: [AUX]~GPUAUXContext:77: destory: 0x73c8be01c0 2020-11-04 10:24:07.153 10524-10695/com.candy.capture D/RefBase: RefBase: Explicit destruction, weak count = 0 (in 0x73c85a7428) 2020-11-04 10:24:07.153 10524-10695/com.candy.capture W/RefBase: CallStack::getCurrentInternal not linked, returning null 2020-11-04 10:24:07.153 10524-10695/com.candy.capture W/RefBase: CallStack::logStackInternal not linked 2020-11-04 10:24:07.153 10524-10695/com.candy.capture I/GPUAUX: [AUX]~GPUAUXContext:77: destory: 0x73c8bde8d0 2020-11-04 10:24:07.154 10524-10695/com.candy.capture D/RefBase: RefBase: Explicit destruction, weak count = 0 (in 0x73c87db5a8) 2020-11-04 10:24:07.154 10524-10864/com.candy.capture E/ExoPlayerImplInternal: Disable failed. android.media.MediaCodec$CodecException: Error 0xffffff92 at android.media.MediaCodec.native_flush(Native Method) at android.media.MediaCodec.flush(MediaCodec.java:2194) at com.google.android.exoplayer2.mediacodec.SynchronousMediaCodecAdapter.flush(SynchronousMediaCodecAdapter.java:81) at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.flushOrReleaseCodec(MediaCodecRenderer.java:914) at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.onDisabled(MediaCodecRenderer.java:773) at com.google.android.exoplayer2.video.MediaCodecVideoRenderer.onDisabled(MediaCodecVideoRenderer.java:454) at com.google.android.exoplayer2.BaseRenderer.disable(BaseRenderer.java:175) at com.google.android.exoplayer2.ExoPlayerImplInternal.disableRenderer(ExoPlayerImplInternal.java:1507) at com.google.android.exoplayer2.ExoPlayerImplInternal.resetInternal(ExoPlayerImplInternal.java:1254) at com.google.android.exoplayer2.ExoPlayerImplInternal.stopInternal(ExoPlayerImplInternal.java:1218) at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:483) at android.os.Handler.dispatchMessage(Handler.java:103) at android.os.Looper.loop(Looper.java:237) at android.os.HandlerThread.run(HandlerThread.java:67) 2020-11-04 10:24:07.154 10524-10695/com.candy.capture W/RefBase: CallStack::getCurrentInternal not linked, returning null 2020-11-04 10:24:07.154 10524-10695/com.candy.capture W/RefBase: CallStack::logStackInternal not linked 2020-11-04 10:24:07.154 10524-10695/com.candy.capture I/GPUAUX: [AUX]~GPUAUXContext:77: destory: 0x7431edfe40 2020-11-04 10:24:07.154 10524-10695/com.candy.capture D/RefBase: RefBase: Explicit destruction, weak count = 0 (in 0x73c85aa8a8) 2020-11-04 10:24:07.154 10524-10695/com.candy.capture W/RefBase: CallStack::getCurrentInternal not linked, returning null 2020-11-04 10:24:07.154 10524-10695/com.candy.capture W/RefBase: CallStack::logStackInternal not linked 2020-11-04 10:24:07.154 10524-10695/com.candy.capture I/GPUAUX: [AUX]~GPUAUXContext:77: destory: 0x73c8be02b0 2020-11-04 10:24:07.155 10524-10695/com.candy.capture D/RefBase: RefBase: Explicit destruction, weak count = 0 (in 0x73c85aab28) 2020-11-04 10:24:07.155 10524-10695/com.candy.capture W/RefBase: CallStack::getCurrentInternal not linked, returning null 2020-11-04 10:24:07.155 10524-10695/com.candy.capture W/RefBase: CallStack::logStackInternal not linked 2020-11-04 10:24:07.155 10524-10695/com.candy.capture I/GPUAUX: [AUX]~GPUAUXContext:77: destory: 0x73c8be0370 2020-11-04 10:24:07.155 10524-10695/com.candy.capture D/RefBase: RefBase: Explicit destruction, weak count = 0 (in 0x73c87db328) 2020-11-04 10:24:07.155 10524-10695/com.candy.capture W/RefBase: CallStack::getCurrentInternal not linked, returning null 2020-11-04 10:24:07.155 10524-10695/com.candy.capture W/RefBase: CallStack::logStackInternal not linked 2020-11-04 10:24:07.155 10524-10695/com.candy.capture I/GPUAUX: [AUX]~GPUAUXContext:77: destory: 0x73c8bdf3e0 2020-11-04 10:24:07.156 10524-10695/com.candy.capture D/RefBase: RefBase: Explicit destruction, weak count = 0 (in 0x73c85a8fa8) 2020-11-04 10:24:07.156 10524-10695/com.candy.capture W/RefBase: CallStack::getCurrentInternal not linked, returning null 2020-11-04 10:24:07.156 10524-10695/com.candy.capture W/RefBase: CallStack::logStackInternal not linked 2020-11-04 10:24:07.156 10524-10695/com.candy.capture I/GPUAUX: [AUX]~GPUAUXContext:77: destory: 0x73c8bdf650 2020-11-04 10:24:07.158 10524-10864/com.candy.capture I/MediaCodec: Audio flush() 2020-11-04 10:24:07.159 10524-10695/com.candy.capture D/RefBase: RefBase: Explicit destruction, weak count = 0 (in 0x73c85aada8) 2020-11-04 10:24:07.159 10524-10695/com.candy.capture W/RefBase: CallStack::getCurrentInternal not linked, returning null 2020-11-04 10:24:07.159 10524-10695/com.candy.capture W/RefBase: CallStack::logStackInternal not linked 2020-11-04 10:24:07.159 10524-10864/com.candy.capture I/MediaCodec: Video release() 2020-11-04 10:24:07.159 10524-10695/com.candy.capture I/GPUAUX: [AUX]~GPUAUXContext:77: destory: 0x73c8be0430 2020-11-04 10:24:07.159 10524-10864/com.candy.capture D/IAtlas: IAtlas::init CallingPid 10524 2020-11-04 10:24:07.159 10524-10864/com.candy.capture D/IAtlas: IAtlas::init this 0x7425c85b60 2020-11-04 10:24:07.160 10524-10695/com.candy.capture D/RefBase: RefBase: Explicit destruction, weak count = 0 (in 0x73c85a76a8) 2020-11-04 10:24:07.160 10524-10695/com.candy.capture W/RefBase: CallStack::getCurrentInternal not linked, returning null 2020-11-04 10:24:07.160 10524-10695/com.candy.capture W/RefBase: CallStack::logStackInternal not linked 2020-11-04 10:24:07.160 10524-10695/com.candy.capture I/GPUAUX: [AUX]~GPUAUXContext:77: destory: 0x73c8bdea20 2020-11-04 10:24:07.160 10524-10695/com.candy.capture D/RefBase: RefBase: Explicit destruction, weak count = 0 (in 0x7421660ea8) 2020-11-04 10:24:07.160 10524-10695/com.candy.capture W/RefBase: CallStack::getCurrentInternal not linked, returning null 2020-11-04 10:24:07.160 10524-10695/com.candy.capture W/RefBase: CallStack::logStackInternal not linked 2020-11-04 10:24:07.160 10524-10695/com.candy.capture I/GPUAUX: [AUX]~GPUAUXContext:77: destory: 0x73c8be03d0 2020-11-04 10:24:07.161 10524-10930/com.candy.capture D/AudioTrack: stop(24): 0x7425d09400, prior state:STATE_FLUSHED 2020-11-04 10:24:07.161 10524-10930/com.candy.capture D/AudioTrack: ~AudioTrack(24): 0x7425d09400 2020-11-04 10:24:07.161 10524-10930/com.candy.capture D/AudioTrack: stop(24): 0x7425d09400, prior state:STATE_FLUSHED 2020-11-04 10:24:10.160 10524-10868/com.candy.capture I/ACodec: [OMX.MTK.VIDEO.DECODER.HEVC] forcing the release of codec 2020-11-04 10:24:10.664 10524-10538/com.candy.capture I/m.candy.captur: Thread[4,tid=10538,WaitingInMainSignalCatcherLoop,Thread*=0x7425c1e800,peer=0x1be4e6b0,"Signal Catcher"]: reacting to signal 3 2020-11-04 10:24:10.894 10524-10538/com.candy.capture I/m.candy.captur: Wrote stack traces to tombstoned 2020-11-04 10:24:41.496 10524-10538/com.candy.capture I/m.candy.captur: Thread[4,tid=10538,WaitingInMainSignalCatcherLoop,Thread*=0x7425c1e800,peer=0x1be4e6b0,"Signal Catcher"]: reacting to signal 3 2020-11-04 10:24:41.707 10524-10538/com.candy.capture I/m.candy.captur: Wrote stack traces to tombstoned 2020-11-04 10:25:05.604 10524-10688/com.candy.capture I/m.candy.captur: Explicit concurrent copying GC freed 272025(15MB) AllocSpace objects, 15(1948KB) LOS objects, 49% free, 20MB/40MB, paused 146us total 88.967ms 2020-11-04 10:25:31.426 10524-10688/com.candy.capture W/FastPrintWriter: Write failure java.io.IOException: write failed: EPIPE (Broken pipe) at libcore.io.IoBridge.write(IoBridge.java:544) at java.io.FileOutputStream.write(FileOutputStream.java:392) at com.android.internal.util.FastPrintWriter.flushBytesLocked(FastPrintWriter.java:354) at com.android.internal.util.FastPrintWriter.flushLocked(FastPrintWriter.java:377) at com.android.internal.util.FastPrintWriter.flush(FastPrintWriter.java:412) at android.os.Binder.dump(Binder.java:810) at android.os.Binder.onTransact(Binder.java:744) at com.android.internal.view.IInputMethodClient$Stub.onTransact(IInputMethodClient.java:196) at android.os.Binder.execTransactInternal(Binder.java:1021) at android.os.Binder.execTransact(Binder.java:994) Caused by: android.system.ErrnoException: write failed: EPIPE (Broken pipe) at libcore.io.Linux.writeBytes(Native Method) at libcore.io.Linux.write(Linux.java:294) at libcore.io.ForwardingOs.write(ForwardingOs.java:241) at libcore.io.BlockGuardOs.write(BlockGuardOs.java:416) at libcore.io.ForwardingOs.write(ForwardingOs.java:241) at libcore.io.IoBridge.write(IoBridge.java:539) at java.io.FileOutputStream.write(FileOutputStream.java:392)  at com.android.internal.util.FastPrintWriter.flushBytesLocked(FastPrintWriter.java:354)  at com.android.internal.util.FastPrintWriter.flushLocked(FastPrintWriter.java:377)  at com.android.internal.util.FastPrintWriter.flush(FastPrintWriter.java:412)  at android.os.Binder.dump(Binder.java:810)  at android.os.Binder.onTransact(Binder.java:744)  at com.android.internal.view.IInputMethodClient$Stub.onTransact(IInputMethodClient.java:196)  at android.os.Binder.execTransactInternal(Binder.java:1021)  at android.os.Binder.execTransact(Binder.java:994)  2020-11-04 10:25:43.509 10524-10688/com.candy.capture I/m.candy.captur: Explicit concurrent copying GC freed 10588(432KB) AllocSpace objects, 3(60KB) LOS objects, 49% free, 20MB/40MB, paused 200us total 85.996ms

[REQUIRED] Version of ExoPlayer being used

com.google.android.exoplayer:exoplayer:2.12.1

[REQUIRED] Device(s) and version(s) of Android being used

OPPO R15 with Android 10

zhanghq666 commented 3 years ago

My fault!! I figure out it is cause by my file writing bug, I'll close this.