mirror of
https://github.com/Genymobile/scrcpy
synced 2025-01-20 06:30:56 +00:00
Ignore minBufferSize on error
A negative return value from AudioRecord.getMinBufferSize() represents an error. Only consider positive values (0 would be invalid). Refs #5228 <https://github.com/Genymobile/scrcpy/issues/5228>
This commit is contained in:
parent
bec3321fff
commit
6451ad271a
@ -56,8 +56,11 @@ public class AudioDirectCapture implements AudioCapture {
|
||||
builder.setAudioSource(audioSource);
|
||||
builder.setAudioFormat(AudioConfig.createAudioFormat());
|
||||
int minBufferSize = AudioRecord.getMinBufferSize(SAMPLE_RATE, CHANNEL_CONFIG, ENCODING);
|
||||
// This buffer size does not impact latency
|
||||
builder.setBufferSizeInBytes(8 * minBufferSize);
|
||||
if (minBufferSize > 0) {
|
||||
// This buffer size does not impact latency
|
||||
builder.setBufferSizeInBytes(8 * minBufferSize);
|
||||
}
|
||||
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user