原文鏈接: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
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/15199.html
標籤:AI
上一篇:安卓APP的http訪問權限
