Skip to content

Commit

Permalink
audio is recorded but fast and distorted
Browse files Browse the repository at this point in the history
  • Loading branch information
Shaji Khan committed Mar 17, 2024
1 parent 004e525 commit e2fa448
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions app/src/main/java/com/shajikhan/ladspa/amprack/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -2794,21 +2794,21 @@ static void setTuner (float [] data, int size) {
if (mainActivity.camera2.mMuxerStarted) {
ByteBuffer buffer = mainActivity.camera2.audioEncoder.getOutputBuffer(aIndex);
if (buffer != null) {
if (fileOutputStream != null) {
buffer.rewind();
try {
for (int i = 0 ; i < bufferInfo.size ; i ++)
dataOutputStream.write(buffer.get(i));
} catch (IOException e) {
Log.e(TAG, "setTuner: ", e);
throw new RuntimeException(e);
}
}

buffer.rewind();
mainActivity.camera2.mMuxer.writeSampleData(mainActivity.camera2.audioTrackIndex, buffer, bufferInfo);
Log.d(TAG, "[aac]: popped data of size " + bufferInfo.size + " " + bufferInfo.presentationTimeUs);
}

if (fileOutputStream != null) {
buffer.rewind();
try {
for (int i = 0 ; i < bufferInfo.size ; i ++)
dataOutputStream.write(buffer.get(i));
} catch (IOException e) {
Log.e(TAG, "setTuner: ", e);
throw new RuntimeException(e);
}
}
}

mainActivity.camera2.audioEncoder.releaseOutputBuffer(aIndex, false);
Expand Down

0 comments on commit e2fa448

Please sign in to comment.