Improve Android radio capture lifecycle, VAD and PTT controls
This commit is contained in:
1 parent
52ffb91101
commit
0d44ada922
14 files changed
+839
-385
No files matched your search
@@ -101,6 +101,40 @@ static int pull_max_abs(int npulls) {
|
||||
int main() {
|
||||
printf("=== test_radio_audio ===\n"); fflush(stdout);
|
||||
|
||||
TEST("RX-only: захват выключен, приём декодируется"); {
|
||||
int rc = radio_audio_start(GID, 0);
|
||||
push_const(SRC_A, 1, 10000, 8);
|
||||
int mx = pull_max_abs(16);
|
||||
int active = radio_audio_active();
|
||||
int talking = radio_audio_transmitting();
|
||||
radio_audio_stop();
|
||||
if (rc == 0 && active && !talking && mx > 1000) OK();
|
||||
else FAIL("rc=%d active=%d talking=%d max=%d", rc, active, talking, mx);
|
||||
}
|
||||
|
||||
TEST("TX stop/start mono/stereo сохраняет накопленный RX PCM"); {
|
||||
const int npulls = 16;
|
||||
int freqs[6] = {300, 1000, 2000, 3000, 4000, 5000};
|
||||
uint8_t pkt[6][256];
|
||||
int lens[6], seqs[6] = {0, 1, 2, 3, 4, 5};
|
||||
int16_t ref[npulls * 960], result[npulls * 960];
|
||||
int ok = 0;
|
||||
if (encode_frames(freqs, 6, pkt, lens)) {
|
||||
run_burst(pkt, lens, seqs, seqs, 6, ref, npulls);
|
||||
ok = radio_audio_start(GID, 0) == 0;
|
||||
feed_frames(pkt, lens, seqs, seqs, 6);
|
||||
for (int ch = 1; ch <= 2; ch++) {
|
||||
ok = (radio_audio_capture_start(GID, ch, 0) == 0) && ok;
|
||||
radio_audio_capture_stop();
|
||||
ok = radio_audio_active() && !radio_audio_transmitting() && ok;
|
||||
}
|
||||
for (int i = 0; i < npulls; i++) radio_audio_pull_pcm(GID, result + i * 960, 960);
|
||||
ok = memcmp(ref, result, sizeof(ref)) == 0 && ok;
|
||||
radio_audio_stop();
|
||||
}
|
||||
if (ok) OK(); else FAIL("TX lifecycle изменил RX или не сменил формат захвата");
|
||||
}
|
||||
|
||||
TEST("single-source: decode через jitter-буфер выдаёт ненулевой PCM"); {
|
||||
radio_audio_start(GID, 1);
|
||||
push_const(SRC_A, 1, 10000, 8);
|
||||
|
||||
Reference in new issue
Block a user