问题
is it possible to trigger the encoder to send i-frames when using a surface as the input ? I know its possible when when queuing input buffers, but I didnt find a way to do so when using createInputSurface .
回答1:
You can't set flags on the buffers. This also affects BUFFER_FLAG_END_OF_STREAM, but for that you have the signalEndOfInputStream() call.
I frames will be sent every KEY_FRAME_RATE * KEY_I_FRAME_INTERVAL buffers. (I don't know how firm that is -- I suspect they might appear more or less often in practice.)
来源:https://stackoverflow.com/questions/22987816/force-i-frame-when-using-mediacodec-with-createinputsurface