begeekmyfriend / yasea

RTMP live streaming client for Android
MIT License
4.89k stars 1.32k forks source link

MediaCodec exception #334

Open tibor-zukina opened 7 years ago

tibor-zukina commented 7 years ago
    **vencoder.configure(videoFormat, null, null, MediaCodec.CONFIGURE_FLAG_ENCODE);**

This line in class SrsEncoder causes an exception with your demo app on devices Nexus 7 (API 22, Lolipop) and Jiayu S3 Advanced (API 25, Nougat). It works fine on LG G4 (API 23, Marshmallow), Lenovo S650 (API 19) and Alcatel SPop (API 16). This is the stack trace: FATAL EXCEPTION: main Process: net.ossrs.yasea.demo, PID: 14499 android.media.MediaCodec$CodecException: Error 0xffffffc3 at android.media.MediaCodec.native_configure(Native Method) at android.media.MediaCodec.configure(MediaCodec.java:1884) at net.ossrs.yasea.SrsEncoder.start(SrsEncoder.java:163) at net.ossrs.yasea.SrsPublisher.startEncode(SrsPublisher.java:138) at net.ossrs.yasea.SrsPublisher.startPublish(SrsPublisher.java:157) at net.ossrs.yasea.demo.MainActivity$1.onClick(MainActivity.java:87) at android.view.View.performClick(View.java:5639) at android.view.View$PerformClick.run(View.java:22387) at android.os.Handler.handleCallback(Handler.java:751) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:6155) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:888) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:778)

begeekmyfriend commented 7 years ago

It is sad to hear that there are some devices do not support MediaCodec perfectly. But I notice that the devices that do not support are something with new model or platform. I will keep track on them in the future since I have not found any alternative solution yet.

tibor-zukina commented 7 years ago

Maybe the problem is that those two devices originally had lower API but they were rooted and higher API was force installed. LG G4 was originally updated to Marshmallow by Google and it works. I will buy 2 more test devices this week (API 19 and API21) and report you if there are any MediaCodec errors.

begeekmyfriend commented 7 years ago

I appreciate your kindness and I am jealous of your richness...

tibor-zukina commented 7 years ago

I tested it on two more devices I bought (Alpentab 10.1 , API 19 , NOA H44SE, API 21). There are no MediaCodec problems on any of them.

begeekmyfriend commented 7 years ago

One compromise to switch hard and soft encoding can be done in MediaCodec exception handler written in SrsEncodeHandler.java and implement it in MainActivity.java, but I have no such device for test.

xpathexception commented 7 years ago

Same issue on Meizu MX4 Android 6.0.1