If your ByteBuffer has an array backend (you created it by the wrap()
static method) you can pass the byte[] array to native code and access
it by JNI's GetByteArrayElements/ReleaseByteArrayElements. Keep in
mind that you should sum the return value of avcodec_decode_audio3 and
keep calling that function until the sum reaches avpkt->size. That's
because in some scenarios there can be more than one audio frame in
one AVPacket.