question: @ TargetApi ( Build . VERSION_CODES . JELLY_BEAN ) private void dequeueOutputBuffer ( MediaCodec codec , ByteBuffer [ ] outputBuffers , int index , MediaCodec . BufferInfo info ) { if ( Build . VERSION . SDK_INT >= Build . VERSION_CODES . JELLY_BEAN ) { ByteBuffer buffer = outputBuffers [ index ] ; Log . i ( "size/remaining: " + info . size + "/" + buffer . remaining ( ) ) ; if ( info . size <= buffer . remaining ( ) ) { final byte [ ] bufferCopied = new byte [ info . size ] ; buffer . get ( bufferCopied ) ; codec . releaseOutputBuffer ( index , false ) ; addEncoded ( bufferCopied ) ; if ( Log . DEBUG ) { AudioUtils . showSomeBytes ( "out" , bufferCopied ) ; } } else { Log . e ( "size > remaining" ) ; codec . releaseOutputBuffer ( index , false ) ; } } }
target:  Save the encoded (output) buffer into the complete encoded recording. TODO: copy directly (without the intermediate byte array)