Сохрани накопленные исправления аудио, async и диагностики
This commit is contained in:
1 parent
b1e3193899
commit
bdcf8b5634
59 files changed
+4611
-1441
No files matched your search
@@ -20,6 +20,11 @@ static int decode(void* arg, const uint8_t* enc, int len, int16_t* pcm, int cap)
|
||||
for (int i = 0; i < cap; i++) pcm[i] = (int16_t)(8000 * std::sin(2 * 3.141592653589793 * 440 * i / 48000));
|
||||
return cap;
|
||||
}
|
||||
struct broken_decoder { int attempts = 0; };
|
||||
static int decode_bad(void* arg, const uint8_t*, int, int16_t*, int) {
|
||||
++static_cast<broken_decoder*>(arg)->attempts;
|
||||
return -1;
|
||||
}
|
||||
static void push(call_jitter* j, int id, int64_t received_ms = -1) {
|
||||
call_jitter_push(j, (const uint8_t*)&id, sizeof(id), (uint32_t)(id * 20), received_ms < 0 ? id * 20 : received_ms);
|
||||
}
|
||||
@@ -247,6 +252,18 @@ int main() {
|
||||
CHECK(audible);
|
||||
call_audio_release(125);
|
||||
}
|
||||
{
|
||||
broken_decoder decoder;
|
||||
auto* jitter = call_jitter_create(decode_bad, &decoder, 1000);
|
||||
for (int i = 0; i < CALL_JITTER_MAX_FRAMES; ++i) push(jitter, i);
|
||||
CHECK(call_jitter_pull(jitter, pcm, 480) == 0);
|
||||
CHECK(decoder.attempts > 0 && decoder.attempts <= 9);
|
||||
call_jitter_reset(jitter);
|
||||
int depth = 0;
|
||||
call_jitter_get_stats(jitter, &depth, nullptr, nullptr, nullptr, nullptr);
|
||||
CHECK(depth <= 1000);
|
||||
call_jitter_destroy(jitter);
|
||||
}
|
||||
std::printf("call_jitter: %s\n", failures ? "FAILED" : "PASSED");
|
||||
return failures ? 1 : 0;
|
||||
}
|
||||
Reference in new issue
Block a user