With MediaCodec API, i'm getting OutputBufferIndex as -1 everytime. Any possible solution?
outputBufferIndex = codec.dequeueOutputBuffer(info,outtimeout);
loginfo();
if (outputBufferIndex >= 0)
{
// outputBuffer is ready to be processed or rendered.
codec.releaseOutputBuffer(outputBufferIndex, true);
}
else if (outputBufferIndex == MediaCodec.INFO_OUTPUT_BUFFERS_CHANGED)
{
outputBuffers = codec.getOutputBuffers();
Log.i(TAG, "op_buf_changed");
}
else if (outputBufferIndex == MediaCodec.INFO_OUTPUT_FORMAT_CHANGED)
{
// Subsequent data will conform to new format.
MediaFormat opmediaformat = codec.getOutputFormat();
Log.i(TAG, "op_buf_format_changed");
}
else
{
Log.i(TAG, "no_out_buffer");
}
Also I've got the same problem with inputbufferindex but by setting proper "TimeoutUs" value I got that solved. But in case of OutputBuffer it doesn't help.