音频输入线程: 队列输入缓冲区中未捕获的 CodecException 导致服务器退出
作者: ronnie849创建于 2026年9月17日更新于 2026年9月17日
inputThread calls queueInputBuffer at AudioEncoder.java:113:
mediaCodec.queueInputBuffer(task.index, bufferInfo.offset, bufferInfo.size, bufferInfo.presentationTimeUs, bufferInfo.flags);
The thread that runs it catches only checked exceptions — AudioEncoder.java:238-246:
inputThread = new Thread(() -> {
try {
inputThread(mediaCodecRef, capture);
} catch (IOException | InterruptedException e) {
Ln.e("Audio capture error", e);
} finally {
end();
}
}, "audio-in");
MediaCodec.CodecException is a RuntimeException, so it is not caught here. Note the asymmetry in consequences:
内容来源: Genymobile/scrcpy