Expose non-destructive jitter buffer diagnostic snapshots
This commit is contained in:
1 parent
d1cbb64884
commit
e53ea2e04a
3 files changed
+23
-8
No files matched your search
@@ -133,6 +133,7 @@ int call_jitter_pull(struct call_jitter* j, int16_t* out, int max_samples) {
|
||||
std::lock_guard<std::mutex> lock(j->mtx);
|
||||
j->diagnostics.depth_ms = (int)depth; j->diagnostics.reserve_ms = reserve;
|
||||
j->diagnostics.tempo_x100 = j->tempo_x100; j->diagnostics.waiting = 1;
|
||||
j->diagnostics.pcm_samples = 0;
|
||||
return 0;
|
||||
}
|
||||
j->primed = true;
|
||||
@@ -198,6 +199,7 @@ int call_jitter_pull(struct call_jitter* j, int16_t* out, int max_samples) {
|
||||
j->diagnostics.resumed |= resumed;
|
||||
j->diagnostics.catching_up = catching;
|
||||
j->diagnostics.waiting = n < max_samples;
|
||||
j->diagnostics.pcm_samples = n;
|
||||
}
|
||||
if (n < max_samples) {
|
||||
j->primed = false;
|
||||
@@ -205,11 +207,18 @@ int call_jitter_pull(struct call_jitter* j, int16_t* out, int max_samples) {
|
||||
return n;
|
||||
}
|
||||
|
||||
void call_jitter_take_diagnostics(struct call_jitter* j, struct call_jitter_diagnostics* out) {
|
||||
void call_jitter_get_diagnostics(struct call_jitter* j, struct call_jitter_diagnostics* out, int reset_events) {
|
||||
std::lock_guard<std::mutex> lock(j->mtx);
|
||||
*out = j->diagnostics;
|
||||
j->diagnostics.decode_errors = j->diagnostics.budget_hits = 0;
|
||||
j->diagnostics.resumed = 0;
|
||||
out->encoded_ms = j->count * CALL_JITTER_FRAME_MS;
|
||||
out->processing_ms = j->processing_ms;
|
||||
out->reserve_ms = j->arrival_window.reserve;
|
||||
out->arrival_spread_ms = j->arrival_window.high - j->arrival_window.low;
|
||||
out->underruns = j->underruns;
|
||||
if (reset_events) {
|
||||
j->diagnostics.decode_errors = j->diagnostics.budget_hits = 0;
|
||||
j->diagnostics.resumed = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void call_jitter_silence(struct call_jitter* j, unsigned samples) {
|
||||
|
||||
Reference in new issue
Block a user