createInputSurface返回错误-10000

打开omx log,看到是因为在mediacodec configure的时候设置的color format不对,因为之前用的是input buffer的方式,现在想用input surface来给video encoder送数据。

 OMXNodeInstance: [0xf6a1a884:qcom.encoder.avc] createInputSurface requires COLOR_FormatSurface (AndroidOpaque) color format instead of COLOR_FormatYUV420SemiPlanar(0x15)
 msm_vidc: high: 00000001: h264e: msm_venc_s_ctrl: name Frame Rate, id 0x992077 value 1966080
 msm_vidc: high: 00000001: h264e: msm_vidc_calculate_input_buffer_count: input min 4 min_host 8 actual 8
 msm_vidc: high: 00000001: h264e: msm_vidc_calculate_output_buffer_count: output min 4 min_host 4 actual 4
 TWGraphicBufferSource: Unable to set input surface: -38
 ACodec  : [OMX.qcom.video.encoder.avc] Unable to configure for node (err -38)
 ACodec  : [OMX.qcom.video.encoder.avc] onCreateInputSurface returning error -38
 MediaCodec: createInputSurface failed, err=-38
 NdkMediaCodec: sf error code: -38

修改为COLOR_FormatSurface即可:

COLOR_FormatSurface

public static final int COLOR_FormatSurface
Constant Value: 2130708361 (0x7f000789)

你可能感兴趣的:(createInputSurface返回错误-10000)