What does it mean if Android MediaCodec dequeueOutputBuffer returns -1? -
i followed official android documentation setup encoder audio input using mediacodec object. method dequeueoutputbuffer in code below returns -1. return value mean?
my code:
/*configuarion of mediacodec object*/ codec = mediacodec.createencoderbytype("audio/mp4a-latm"); mediaformat format = new mediaformat(); format.setstring(mediaformat.key_mime, "audio/mp4a-latm"); format.setinteger(mediaformat.key_channel_count, 1); format.setinteger(mediaformat.key_sample_rate, 44100); format.setinteger(mediaformat.key_bit_rate, 64 * 1024); format.setinteger(mediaformat.key_aac_profile,mediacodecinfo.codecprofilelevel.aacobjecthe); codec.configure(format, null, null, mediacodec.configure_flag_encode); codec.start(); bytebuffer[] inputbuffers = codec.getinputbuffers(); bytebuffer[] outputbuffers = codec.getoutputbuffers(); /*main loop encode audio data*/ (;;) { int inputbufferindex = codec.dequeueinputbuffer(-1); -->this never 0 data should written correctly! if (inputbufferindex >= 0) { // write data audiorecord in queue inputbuffer = inputbuffers[inputbufferindex]; inputbuffer.clear(); inputbuffer.put(buf);-->data audiorecord object encoder.queueinputbuffer(inputbufferindex, 0, buf.length, 0, 0); codec.queueinputbuffer(inputbufferindex, ...); } int outputbufferindex = codec.dequeueoutputbuffer(bufferinfo, 0);-------->>> "-1" if (outputbufferindex >= 0) { //do never called because outputbufferindex -1??
getting -1 return value when have passed non negative timeoutus
indicates call dequeueoutputbuffer
has timed out. according android sample, returns following integer
public static final int info_try_again_later = -1;
Comments
Post a Comment