android.media.MediaCodec$CodecException: Error 0xfffffc0e
source link: https://blog.csdn.net/m0_37039192/article/details/101288646
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
android.media.MediaCodec$CodecException: Error 0xfffffc0e
原文链接:https://blog.csdn.net/zhang___yong/article/details/82760756
报错代码:
final MediaFormat format = MediaFormat.createVideoFormat(MIME_TYPE, mWidth, mHeight);
mMediaCodec.configure(format, null, null,MediaCodec.CONFIGURE_FLAG_ENCODE);
原因:传入放入宽高中高不是2的倍数,换言之,是个单数。
int formatWidth = mWidth;
int formatHeight = mHeight;
if ((formatWidth & 1) == 1) {
formatWidth--;
}
if ((formatHeight & 1) == 1) {
formatHeight--;
}
final MediaFormat format = MediaFormat.createVideoFormat(MIME_TYPE, formatWidth, formatHeight);
————————————————
版权声明:本文为CSDN博主「zhang___yong」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/zhang___yong/article/details/82760756
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK