1.解码视频出来的数据 使用OpenGL 渲染 不显示内容????
自检逻辑:1.解码出来的数据是否完整
2.textureId是否用错:直接解码出来的内容是yuv数据要使用 samplerExternalOES 类型的TextureId !一般使用 sampler2D类型。
2.在使用MediaCodec进行 编码时报错:android.media.MediaCodec$CodecException: Error 0xfffffc0e
报错位置:
final MediaFormat format = MediaFormat.createVideoFormat(MIME_TYPE, mWidth, mHeight);
mMediaCodec.configure(format, null, null,MediaCodec.CONFIGURE_FLAG_ENCODE);
原因:传入放入宽高中高不是2的倍数,换言之,是个单数。
解决:
//使设置的宽高是2的倍数 防止设置MediaFormat 后 在mMediaCodec.configure时报错
//“android.media.MediaCodec$CodecException: Error 0xfffffc0e”
//MediaFormat format = MediaFormat.createVideoFormat(MIME_TYPE, mWidth, mHeight);
//mMediaCodec.configure(format, null, null, MediaCodec.CONFIGURE_FLAG_ENCODE);
if ((width & 1) == 1) {
width--;
}
if ((height & 1) == 1) {
height--;
}