首先排除硬件原因,如外部干扰、坏音箱等等,确认问题是由软件导致的。
int bufferSizeInFrames = oboeStream.getFramesPerBurst() * 2; // 每次处理两个BURST的数据
oboe::AudioStreamBuilder builder;
builder.setBufferCapacityInFrames(bufferSizeInFrames);
const int minThreadCount = ob_get_availability() == OB_AVAILABILITY_FULL ? 2 : 1; oboe::AudioStreamBuilder builder; builder.setPerformanceMode(PerformanceMode::LowLatency) .setCallback(sampleStream.get()); if (cpuCount > minThreadCount) builder.setFramesPerCallback(ObUtils::kMinimumThreadFrameCount * minThreadCount);
oboe::AudioStreamBuilder builder; builder.setFormat(AudioFormat::Float) // 使用浮点型 .setSampleRate(44100) // 采样率设为44100 .setChannelCount(2) // 双声道 .setSharingMode(SharingMode::Exclusive);