INNER CODE UNIT · C
want
Cateners/tiny_container · app/src/main/cpp/tiny_audio_jni.c:169
uint32_t want = (uint32_t)nframes * (uint32_t)bpf;
uint32_t got = ring_read(&g.ring, (uint8_t*)buf, want);
/* If underrun, pad with silence (zeroes) – memcpy won't touch tail */
if (got < want)
memset((uint8_t*)buf + got, 0, want - got);
return AAUDIO_CALLBACK_RESULT_CONTINUE;
}
static void err_cb(AAudioStream *s, void *ud, aaudio_result_t e)
{
(void)s; (void)ud;
if (e == AAUDIO_ERROR_DISCONNECTED) {
LOGI("AAudio disconnect → restart");
atomic_store_explicit(&g.aaudio_restart, true, memory_order_release);
} else LOGE("AAudio err: %d", (int)e);
}