uestccokey / EZFilter

A lightweight (<180KB), easy-to-extend Android filter and dynamic sticker framework for adding filters and stickers for camera, video, bitmap and view.(一个轻量级(<180KB)、易扩展的Android滤镜和动态贴纸框架,支持摄像头、视频、图片和视图添加滤镜和贴纸。)
MIT License
208 stars 57 forks source link

Some devices are crashing while start record a portrait imported video #26

Closed jackaru closed 6 years ago

jackaru commented 6 years ago

While testing app in certain devices, some crashes while start recording a portrait oriented video from camera or video saved by EZFilter (whatsapp doesn't crash for... reason?), that's same bug I was having months ago

Code for import:

 if (requestCode == REQUEST_CODE_CHOOSE && resultCode == RESULT_OK) {
            final List<String> paths = Matisse.obtainPathResult(data);
            if (!paths.isEmpty()) {
                String mimeType = URLConnection.guessContentTypeFromName(paths.get(0));
                if(mimeType.startsWith("video")) {
                    mRenderPipeline = EZFilter.input(Uri.parse(paths.get(0)))
                            .setLoop(true)
                            .into(mRenderView); 

Error appear when mRenderPipeline.startRecording to camera/ezfilter videos in portrait:

04-10 16:05:50.201 30626-30856/com.owner.filtertest E/ACodec: [OMX.Exynos.AVC.Encoder] failed to set input port definition parameters.
04-10 16:05:50.201 30626-30856/com.owner.filtertest E/ACodec:  configureCodec multi window instance fail  appPid : 30626
04-10 16:05:50.211 30626-30856/com.owner.filtertest E/ACodec: [OMX.Exynos.AVC.Encoder] configureCodec returning error -5001
    signalError(omxError 0x80001001, internalError -5001)
04-10 16:05:50.211 30626-30855/com.owner.filtertest E/MediaCodec: Codec reported err 0xffffec77, actionCode 0, while in state 3
04-10 16:05:50.211 30626-30626/com.owner.filtertest E/MediaCodec: configure failed with err 0xffffec77, resetting...
04-10 16:05:50.231 30626-30626/com.owner.filtertest E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.owner.filtertest , PID: 30626
    android.media.MediaCodec$CodecException: Error 0xffffec77
        at android.media.MediaCodec.native_configure(Native Method)
        at android.media.MediaCodec.configure(MediaCodec.java:1778)
        at cn.ezandroid.ezfilter.media.record.MediaVideoEncoder.prepare(MediaVideoEncoder.java:60)
        at cn.ezandroid.ezfilter.media.record.MediaMuxerWrapper.prepare(MediaMuxerWrapper.java:40)
        at cn.ezandroid.ezfilter.media.record.RecordableEndPointRender.startRecording(RecordableEndPointRender.java:124)
        at cn.ezandroid.ezfilter.core.RenderPipeline.startRecording(RenderPipeline.java:634)
        at com.owner.filtertest .CameraActivity.startRecording(CameraActivity.java:690)
        at com.owner.filtertest .CameraActivity.bridge$lambda$0$CameraActivity(CameraActivity.java)
        at com.owner.filtertest .CameraActivity$$Lambda$3.run(Unknown Source)
        at android.os.Handler.handleCallback(Handler.java:739)
        at android.os.Handler.dispatchMessage(Handler.java:95)
        at android.os.Looper.loop(Looper.java:158)
        at android.app.ActivityThread.main(ActivityThread.java:7230)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
uestccokey commented 6 years ago

In the develop branch I made a big refactoring, you can test it, in my project, there is no problem with crashes. Some api changes, you can refer to demo code

jackaru commented 6 years ago

Finally! I will update to new version after the refactor will include mRenderPipeline.enableRecordAudio, mRenderPipeline.setRecordOutputPath and old utilities. It would be nice if after video rendering is finished it will automatically refresh the output path, to make the video appear in Gallery, or maybe set a rendering listener! I'm having issues in 60% devices with manually refreshing output, I think it's caused by refreshing it before it's full rendered Thanks for all :)

uestccokey commented 6 years ago

Oh, I'm sorry, I was very busy last week. In version 2.0.0, an interface IRecordListener is added to the RecordableRender class, and the onFinish function will be callback after the rendering is completed.

jackaru commented 6 years ago

Thank you for the update! 👍