Reduce Linux voice capture latency and verify device timing
This commit is contained in:
1 parent
3276204196
commit
7477da42a5
11 files changed
+342
-38
No files matched your search
@@ -32,13 +32,16 @@ int main() {
|
||||
assert(capture.captureSequence == 1440 && capture.captureFrames == 1440 && capture.captureBlocks == 3);
|
||||
assert(capture.captureJumps == 1 && capture.captureMaxDelta == 4000 && capture.captureMinDelta == 0);
|
||||
assert(capture.captureMissing == 480 && capture.captureEstimated == 0);
|
||||
assert(capture.captureMinLatency == 96000 && capture.captureMaxLatency == 100000);
|
||||
assert(capture.captureLatency.low == 96000 && capture.captureLatency.high == 100000);
|
||||
assert(capture.captureLatency.count == 3 && capture.captureLatency.average() == 97333);
|
||||
assert(capture.captureBlock.low == 10000 && capture.captureBlock.high == 10000);
|
||||
report(devices, now(CLOCK_MONOTONIC), 1.0);
|
||||
timing.first_us = 1034000; timing.missing = 0; timing.measured = 0;
|
||||
audio_diag_capture_clock(nullptr, &timing);
|
||||
assert(take(e)); consume(e, devices);
|
||||
assert(capture.captureJumps == 0 && capture.captureMissing == 0 && capture.captureEstimated == 1);
|
||||
assert(capture.captureSequence == 1920 && capture.captureBlocks == 1 && capture.captureFrames == 480);
|
||||
assert(capture.captureLatency.count == 0 && capture.captureBlock.count == 1);
|
||||
// Отсутствующий timestamp не превращается в измеренную нулевую задержку.
|
||||
audio_playback_timing output{30000, 1000, 1200, 48000, 1};
|
||||
audio_diag_playback_clock(nullptr, &output);
|
||||
@@ -47,11 +50,12 @@ int main() {
|
||||
output.latency_us = 999999; output.measured = 0;
|
||||
audio_diag_playback_clock(nullptr, &output);
|
||||
while (take(e)) consume(e, devices);
|
||||
assert(capture.playbackBlocks == 3 && capture.playbackFrames == 3120 && capture.playbackMeasured == 2);
|
||||
assert(capture.playbackMinLatency == -1000 && capture.playbackMaxLatency == 30000);
|
||||
assert(capture.playbackMaxBlock == 25000 && capture.playbackMaxConverter == 1000);
|
||||
assert(capture.playbackBlocks == 3 && capture.playbackFrames == 3120 && capture.playbackLatency.count == 2);
|
||||
assert(capture.playbackLatency.low == -1000 && capture.playbackLatency.high == 30000);
|
||||
assert(capture.playbackBlock.high == 25000 && capture.playbackMaxConverter == 1000);
|
||||
assert(capture.playbackLatency.average() == 14500 && capture.playbackBlock.low == 20000);
|
||||
report(devices, now(CLOCK_MONOTONIC), 1.0);
|
||||
assert(capture.playbackBlocks == 0 && capture.playbackMeasured == 0 && capture.playbackMaxBlock == 0);
|
||||
assert(capture.playbackBlocks == 0 && capture.playbackLatency.count == 0 && capture.playbackBlock.high == 0);
|
||||
std::vector<std::thread> workers;
|
||||
for (int p = 0; p < producers; ++p) workers.emplace_back([p, &done]() {
|
||||
for (int i = 0; i < perProducer; ++i)
|
||||
|
||||
Reference in new issue
Block a user