while (!mAudioExtractorDone) {
int size = mAudioExtractor.readSampleData(decoderInputBuffer, 0);
long presentationTime = mAudioExtractor.getSampleTime();
if (VERBOSE) {
Log.d(TAG, "audio extractor: returned buffer of size " + size);
Log.d(TAG, "audio extractor: returned buffer for time " + presentationTime);
}
if (size >= 0) {
codec.queueInputBuffer(
index,
0,
size,
presentationTime,
mAudioExtractor.getSampleFlags());
mAudioExtractor.advance();
mAudioExtractedFrameCount++;
logState();
} else {
mAudioExtractorDone = true;
if (VERBOSE) {
Log.d(TAG, "audio extractor: EOS");
}
codec.queueInputBuffer(
index,
0,
0,
0,
MediaCodec.BUFFER_FLAG_END_OF_STREAM);
}
should change to this codes int onInputBufferAvailable callback, otherwise there will be an IllegalStateException for MadiaCodec encoder or decoder
should change to this codes int onInputBufferAvailable callback, otherwise there will be an IllegalStateException for MadiaCodec encoder or decoder