Skip to content

Commit

Permalink
Rename FORMAT to ENCODING
Browse files Browse the repository at this point in the history
The AudioFormat contains several properties. This specific value is
named "encoding".
  • Loading branch information
rom1v committed May 24, 2023
1 parent 38900d7 commit 597d2cc
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions server/src/main/java/com/genymobile/scrcpy/AudioCapture.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public final class AudioCapture {
public static final int SAMPLE_RATE = 48000;
public static final int CHANNEL_CONFIG = AudioFormat.CHANNEL_IN_STEREO;
public static final int CHANNELS = 2;
public static final int FORMAT = AudioFormat.ENCODING_PCM_16BIT;
public static final int ENCODING = AudioFormat.ENCODING_PCM_16BIT;
public static final int BYTES_PER_SAMPLE = 2;

private AudioRecord recorder;
Expand All @@ -37,7 +37,7 @@ public static int millisToBytes(int millis) {

private static AudioFormat createAudioFormat() {
AudioFormat.Builder builder = new AudioFormat.Builder();
builder.setEncoding(FORMAT);
builder.setEncoding(ENCODING);
builder.setSampleRate(SAMPLE_RATE);
builder.setChannelMask(CHANNEL_CONFIG);
return builder.build();
Expand All @@ -53,7 +53,7 @@ private static AudioRecord createAudioRecord() {
}
builder.setAudioSource(SOURCE);
builder.setAudioFormat(createAudioFormat());
int minBufferSize = AudioRecord.getMinBufferSize(SAMPLE_RATE, CHANNEL_CONFIG, FORMAT);
int minBufferSize = AudioRecord.getMinBufferSize(SAMPLE_RATE, CHANNEL_CONFIG, ENCODING);
// This buffer size does not impact latency
builder.setBufferSizeInBytes(8 * minBufferSize);
return builder.build();
Expand Down

0 comments on commit 597d2cc

Please sign in to comment.